Re: [PATCH 2/2] scsi: tape: add unexpected rewind handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On 22. Aug 2023, at 21.14, John Meneghini <jmeneghi@xxxxxxxxxx> wrote:
> 
> Handle the unexpected condition where the tape drive reports
> that tape is rewinding.
> 
> ...
> I'm providing this patch because I think it's valuable for testing
> purposes and it should be safe. Any time the device unexpectedly
> reports "Rewind is in progress", it should be safe to set
> pos_unknown in the driver.
> 
I am a bit hesitant about this, because it does not recognize if the rewind in
progress was initiated by the user or not. In immediate mode (ST_NOWAIT
option), a user rewind may be still in progress when a (impatient) user
tries to do something else.

One possibility would be to make this conditional on !STp->immediate.

Another, perhaps better, method would be to use the STps->rw state
variable. A new state ST_REWINDING could be introduced (or state
should be set to ST_IDLE when rewinding).

(Looking at the state, I think it should be set to something else than
ST_WRITING more frequently. This could, in some cases prevent
improper automatic writing of filemarks. See, for instance, the problem
with failing rewinds in the report with PATCH 1/2.)

Thanks, Kai


> Tested-by: Laurence Oberman <loberman@xxxxxxxxxx>
> Signed-off-by: John Meneghini <jmeneghi@xxxxxxxxxx>
> ---
> drivers/scsi/st.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
> index 338aa8c42968..b641490ed9d1 100644
> --- a/drivers/scsi/st.c
> +++ b/drivers/scsi/st.c
> @@ -416,6 +416,9 @@ static int st_chk_result(struct scsi_tape *STp, struct st_request * SRpnt)
> STp->cleaning_req = 1; /* ASC and ASCQ => cleaning requested */
> if (cmdstatp->have_sense && scode == UNIT_ATTENTION && cmdstatp->sense_hdr.asc == 0x29)
> STp->pos_unknown = 1; /* ASC => power on / reset */
> + if (cmdstatp->have_sense && cmdstatp->sense_hdr.asc == 0
> + && cmdstatp->sense_hdr.ascq == 0x1a)
> + STp->pos_unknown = 1; /* ASCQ => rewind in progress */
> 
> STp->pos_unknown |= STp->device->was_reset;
> 
> -- 
> 2.39.3
> 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux