Re: [PATCH 1/2] scsi: tape: add third party poweron reset 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:
> 
> Many tape devices will automatically rewind following a poweron/reset.
> This can result in data loss as other operations in the driver can write
> to the tape when the position is unknown. E.g. MTEOM can write a
> filemark at the beginning of the tape. This patch adds code to detect
> poweron/reset unit attentions and prevents the driver from writing to
> the tape when the position could be unknown.
> 
> Customer reported problem description:
> 
> ...

Good catch!

I think that, in an ideal world, the lower levels should detect the reset (STp->device->was_reset),
but this depends on how you define the model from the user point of view (what the virtual
HBA is). But, in the real world, this is a good safeguard and it solves a real problem.

Thanks, Kai

> Suggested-by: Jeffrey Hutzelman <jhutz@xxxxxxx>
> Signed-off-by: John Meneghini <jmeneghi@xxxxxxxxxx>
Acked-by: Kai Mäkisara <kai.makisara@xxxxxxxxxxx <mailto:kai.makisara@xxxxxxxxxxx>>
> ---
> drivers/scsi/st.c | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
> index 14d7981ddcdd..338aa8c42968 100644
> --- a/drivers/scsi/st.c
> +++ b/drivers/scsi/st.c
> @@ -414,6 +414,8 @@ static int st_chk_result(struct scsi_tape *STp, struct st_request * SRpnt)
> if (cmdstatp->have_sense &&
>    cmdstatp->sense_hdr.asc == 0 && cmdstatp->sense_hdr.ascq == 0x17)
> 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 */
> 
> 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