Skip to content

Commit

Permalink
scsi: st: New session only when Unit Attention for new tape
Browse files Browse the repository at this point in the history
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 <Kai.Makisara@kolumbus.fi>
Link: https://lore.kernel.org/r/20241106095723.63254-4-Kai.Makisara@kolumbus.fi
Reviewed-by: John Meneghini <jmeneghi@redhat.com>
Tested-by: John Meneghini <jmeneghi@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Kai Mäkisara authored and Martin K. Petersen committed Nov 7, 2024
1 parent 0b120ed commit a4550b2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/scsi/st.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a4550b2

Please sign in to comment.