Skip to content

Commit 5c60bba

Browse files
author
Ewan D. Milne
committed
scsi: st: New session only when Unit Attention for new tape
JIRA: https://issues.redhat.com/browse/RHEL-124946 Upstream Status: From upstream linux mainline 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> (cherry picked from commit a4550b2) Signed-off-by: Ewan D. Milne <emilne@redhat.com>
1 parent 6e9d677 commit 5c60bba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/scsi/st.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,10 @@ static int test_ready(struct scsi_tape *STp, int do_wait)
10021002
scode = cmdstatp->sense_hdr.sense_key;
10031003

10041004
if (scode == UNIT_ATTENTION) { /* New media? */
1005-
new_session = 1;
1005+
if (cmdstatp->sense_hdr.asc == 0x28) { /* New media */
1006+
new_session = 1;
1007+
DEBC_printk(STp, "New tape session.");
1008+
}
10061009
if (attentions < MAX_ATTENTIONS) {
10071010
attentions++;
10081011
continue;

0 commit comments

Comments
 (0)