From: Kai Mäkisara Date: Wed, 6 Nov 2024 09:57:23 +0000 (+0200) Subject: scsi: st: New session only when Unit Attention for new tape X-Git-Tag: microblaze-v6.16~545^2~1^2 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=a4550b28c8c853e7241ecf30b4f1d9c6bc631fda;p=linux-2.6-microblaze.git scsi: st: New session only when Unit Attention for new tape Currently the code starts new tape session when any Unit Attention (UA) is seen when opening the device. This leads to incorrectly clearing pos_unknown when the UA is for reset. Set new session only when the UA is for a new tape. Signed-off-by: Kai Mäkisara Link: https://lore.kernel.org/r/20241106095723.63254-4-Kai.Makisara@kolumbus.fi Reviewed-by: John Meneghini Tested-by: John Meneghini Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 4863802371a7..fe0618ac9769 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -991,7 +991,10 @@ static int test_ready(struct scsi_tape *STp, int do_wait) scode = cmdstatp->sense_hdr.sense_key; if (scode == UNIT_ATTENTION) { /* New media? */ - new_session = 1; + if (cmdstatp->sense_hdr.asc == 0x28) { /* New media */ + new_session = 1; + DEBC_printk(STp, "New tape session."); + } if (attentions < MAX_ATTENTIONS) { attentions++; continue;