diff options
| author | Laurence Oberman <loberman@redhat.com> | 2026-09-29 15:28:18 -0400 |
|---|---|---|
| committer | Martin K. Petersen (Oracle) <mkp@kernel.org> | 2026-10-03 10:29:48 -0400 |
| commit | 8d1cc285194dbcba88c136e1ff7c25cb10e38a5b (patch) | |
| tree | 42e3d100a1cd68430a7d744e35f5872b2713654f /tools/lib/python/kdoc/python_version.py | |
| parent | df2908090cda368b01ff43709f51890076c56157 (diff) | |
| download | linux-next-8d1cc285194dbcba88c136e1ff7c25cb10e38a5b.tar.gz linux-next-8d1cc285194dbcba88c136e1ff7c25cb10e38a5b.zip | |
scsi: st: Restore changed drive settings after reset also for MTLOAD and MTRETEN
A device reset returns the drive's density and block size to their
defaults. Commit 7081dc75df79 ("scsi: st: Restore some drive settings
after reset") re-applies values changed by the user when the position is
recovered with MTREW, MTSEEK or MTEOM. MTLOAD and MTRETEN are also allowed
to clear the reset condition and also leave the same medium at BOT, but
they restore nothing.
Because check_tape() reads the drive's block size with MODE SENSE on every
open, the driver silently switches to the drive default after the reset.
An application that set fixed-block mode with MTSETBLK and recovers with
MTLOAD or MTRETEN keeps writing, but variable-length blocks, without any
error.
Restore the changed density and block size for MTLOAD and MTRETEN as well.
Both operations may make the drive report a new medium, and the new session
started by check_tape() clears the "changed" flags and applies the mode
defaults. So save the values before the operation, let check_tape() run
first (do_load_unload() already calls it for MTLOAD; call it after
MTRETEN), and then re-apply them. Retry the restore once in case a unit
attention is still pending. Only restore when the drive is ready after the
operation: with an immediate-mode load and O_NONBLOCK, check_tape() does
not wait and the drive may still be loading. In immediate mode
(MT_ST_NOWAIT) MTRETEN may return before the retension has finished; do not
wait for it there.
MTOFFL is not changed: the medium is unloaded and a different one may be
loaded next, for which the mode defaults apply.
Reproduced with scsi_debug (which reports a new medium after MTRETEN and
MTLOAD) and with IBM LTO drives on FC (which do not).
Fixes: 7081dc75df79 ("scsi: st: Restore some drive settings after reset")
Assisted-by: Claude sashiko
Signed-off-by: Laurence Oberman <loberman@redhat.com>
Reviewed-by: Kai Mäkisara <kai.makisara@kolumbus.fi>
Link: https://patch.msgid.link/20260929192821.997675-2-loberman@redhat.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
