Skip to content

Commit 4bf442b

Browse files
committed
scsi: st: Don't set pos_unknown just after device recognition
jira NONE_AUTOMATION Rebuild_History Non-Buildable kernel-5.14.0-570.12.1.el9_6 commit-author Kai Mäkisara <[email protected]> commit 98b3788 Commit 9604eea ("scsi: st: Add third party poweron reset handling") in v6.6 added new code to handle the Power On/Reset Unit Attention (POR UA) sense data. This was in addition to the existing method. When this Unit Attention is received, the driver blocks attempts to read, write and some other operations because the reset may have rewinded the tape. Because of the added code, also the initial POR UA resulted in blocking operations, including those that are used to set the driver options after the device is recognized. Also, reading and writing are refused, whereas they succeeded before this commit. Add code to not set pos_unknown to block operations if the POR UA is received from the first test_ready() call after the st device has been created. This restores the behavior before v6.6. Signed-off-by: Kai Mäkisara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Fixes: 9604eea ("scsi: st: Add third party poweron reset handling") CC: [email protected] Closes: https://lore.kernel.org/linux-scsi/[email protected]/ Signed-off-by: Martin K. Petersen <[email protected]> (cherry picked from commit 98b3788) Signed-off-by: Jonathan Maple <[email protected]>
1 parent 6cbbe65 commit 4bf442b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

drivers/scsi/st.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,11 @@ static int test_ready(struct scsi_tape *STp, int do_wait)
10291029
retval = new_session ? CHKRES_NEW_SESSION : CHKRES_READY;
10301030
break;
10311031
}
1032+
if (STp->first_tur) {
1033+
/* Don't set pos_unknown right after device recognition */
1034+
STp->pos_unknown = 0;
1035+
STp->first_tur = 0;
1036+
}
10321037

10331038
if (SRpnt != NULL)
10341039
st_release_request(SRpnt);
@@ -4327,6 +4332,7 @@ static int st_probe(struct device *dev)
43274332
blk_queue_rq_timeout(tpnt->device->request_queue, ST_TIMEOUT);
43284333
tpnt->long_timeout = ST_LONG_TIMEOUT;
43294334
tpnt->try_dio = try_direct_io;
4335+
tpnt->first_tur = 1;
43304336

43314337
for (i = 0; i < ST_NBR_MODES; i++) {
43324338
STm = &(tpnt->modes[i]);

drivers/scsi/st.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ struct scsi_tape {
170170
unsigned char rew_at_close; /* rewind necessary at close */
171171
unsigned char inited;
172172
unsigned char cleaning_req; /* cleaning requested? */
173+
unsigned char first_tur; /* first TEST UNIT READY */
173174
int block_size;
174175
int min_block;
175176
int max_block;

0 commit comments

Comments
 (0)