diff options
author | Kai Mäkisara <[email protected]> | 2024-11-06 11:57:23 +0200 |
---|---|---|
committer | Martin K. Petersen <[email protected]> | 2024-11-06 21:18:16 -0500 |
commit | a4550b28c8c853e7241ecf30b4f1d9c6bc631fda (patch) | |
tree | 1d6142e26a502e1d349950efc2c47c8fc7645ba7 | |
parent | 0b120edb37dc9dd8ca82893d386922eb6b16f860 (diff) |
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: John Meneghini <[email protected]>
Tested-by: John Meneghini <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
-rw-r--r-- | drivers/scsi/st.c | 5 |
1 files changed, 4 insertions, 1 deletions
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; |