public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: John Meneghini <jmeneghi@redhat.com>
To: "Kai Mäkisara" <Kai.Makisara@kolumbus.fi>, linux-scsi@vger.kernel.org
Cc: martin.petersen@oracle.com, loberman@redhat.com
Subject: Re: [PATCH v3 1/4] scsi: st: Restore some drive settings after reset
Date: Thu, 30 Jan 2025 13:13:55 -0500	[thread overview]
Message-ID: <e9b1006a-078b-476e-949a-8fd6e62d72cc@redhat.com> (raw)
In-Reply-To: <20250120194925.44432-2-Kai.Makisara@kolumbus.fi>

I've tested this patch out and it works as expected.

Reviewed-by: John Meneghini <jmeneghi@redhat.com>
Tested-by: John Meneghini <jmeneghi@redhat.com>

On 1/20/25 2:49 PM, Kai Mäkisara wrote:
> Some of the allowed operations put the tape into a known position
> to continue operation assuming only the tape position has changed.
> But reset sets partition, density and block size to drive default
> values. These should be restored to the values before reset.
> 
> Normally the current block size and density are stored by the drive.
> If the settings have been changed, the changed values have to be
> saved by the driver across reset.
> 
> Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>

> diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
> index ebbd50ec0cda..0fc9afe60862 100644
> --- a/drivers/scsi/st.c
> +++ b/drivers/scsi/st.c
>   \f
> @@ -2930,14 +2929,17 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon
>   		if (cmd_in == MTSETDENSITY) {
>   			(STp->buffer)->b_data[4] = arg;
>   			STp->density_changed = 1;	/* At least we tried ;-) */
> +			STp->changed_density = arg;
>   		} else if (cmd_in == SET_DENS_AND_BLK)
>   			(STp->buffer)->b_data[4] = arg >> 24;
>   		else
>   			(STp->buffer)->b_data[4] = STp->density;
>   		if (cmd_in == MTSETBLK || cmd_in == SET_DENS_AND_BLK) {
>   			ltmp = arg & MT_ST_BLKSIZE_MASK;
> -			if (cmd_in == MTSETBLK)
> +			if (cmd_in == MTSETBLK) {
>   				STp->blksize_changed = 1; /* At least we tried ;-) */
> +				STp->changed_blksize = arg;
> +			}
>   		} else
>   			ltmp = STp->block_size;
>   		(STp->buffer)->b_data[9] = (ltmp >> 16);
> @@ -3636,9 +3638,25 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg)
>   				retval = (-EIO);
>   				goto out;
>   			}
> -			reset_state(STp);
> +			reset_state(STp); /* Clears pos_unknown */
>   			/* remove this when the midlevel properly clears was_reset */
>   			STp->device->was_reset = 0;

I see we are still clearing the mid layer was_reset flag here.  Is there any way we can remove this in a future patch?

/John


  reply	other threads:[~2025-01-30 18:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-20 19:49 [PATCH v3 0/4] scsi: st: scsi_error: More reset patches Kai Mäkisara
2025-01-20 19:49 ` [PATCH v3 1/4] scsi: st: Restore some drive settings after reset Kai Mäkisara
2025-01-30 18:13   ` John Meneghini [this message]
2025-01-20 19:49 ` [PATCH v3 2/4] scsi: scsi_error: Add counters for New Media and Power On/Reset UNIT ATTENTIONs Kai Mäkisara
2025-01-30 18:13   ` John Meneghini
2025-01-20 19:49 ` [PATCH v3 3/4] scsi: st: scsi_device: Modify st.c to use the new scsi_error counters Kai Mäkisara
2025-01-30 18:18   ` John Meneghini
2025-01-20 19:49 ` [PATCH v3 4/4] scsi: st: Add sysfs file reset_blocked Kai Mäkisara
2025-01-30 18:27   ` John Meneghini
2025-01-31 10:49     ` "Kai Mäkisara (Kolumbus)"
2025-01-31 19:48       ` John Meneghini
2025-02-01 15:11   ` [PATCH v3b 4/4] scsi: st: Add sysfs file position_lost_in_reset Kai Mäkisara
2025-02-03 22:53 ` [PATCH v3 0/4] scsi: st: scsi_error: More reset patches Martin K. Petersen
2025-02-10  2:58 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e9b1006a-078b-476e-949a-8fd6e62d72cc@redhat.com \
    --to=jmeneghi@redhat.com \
    --cc=Kai.Makisara@kolumbus.fi \
    --cc=linux-scsi@vger.kernel.org \
    --cc=loberman@redhat.com \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox