From: John Meneghini <jmeneghi@redhat.com>
To: "Kai Mäkisara" <Kai.Makisara@kolumbus.fi>, linux-scsi@vger.kernel.org
Cc: martin.petersen@oracle.com,
James.Bottomley@HansenPartnership.com, loberman@redhat.com
Subject: Re: [PATCH v2 4/4] scsi: st: Add sysfs file reset_blocked
Date: Wed, 11 Dec 2024 16:57:25 -0500 [thread overview]
Message-ID: <363296a4-6235-4447-8e45-ec32a49c0fe6@redhat.com> (raw)
In-Reply-To: <20241125140301.3912-5-Kai.Makisara@kolumbus.fi>
Reviewed-by: John Meneghini <jmeneghi@redhat.com>
Tested-by: John Meneghini <jmeneghi@redhat.com>
On 11/25/24 09:03, Kai Mäkisara wrote:
> If the value read from the file is 1, reads and writes from/to the
> device are blocked because the tape position may not match user's
> expectation (tape rewound after device reset).
>
> Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
> ---
> Documentation/scsi/st.rst | 5 +++++
> drivers/scsi/st.c | 19 +++++++++++++++++++
> 2 files changed, 24 insertions(+)
>
> diff --git a/Documentation/scsi/st.rst b/Documentation/scsi/st.rst
> index d3b28c28d74c..2209f03faad3 100644
> --- a/Documentation/scsi/st.rst
> +++ b/Documentation/scsi/st.rst
> @@ -157,6 +157,11 @@ enabled driver and mode options. The value in the file is a bit mask where the
> bit definitions are the same as those used with MTSETDRVBUFFER in setting the
> options.
>
> +Each directory contains the entry 'reset_blocked'. If this value is one,
> +reading and writing to the device is blocked after device reset. Most
> +devices rewind the tape after reset and the writes/read don't access the
> +tape position the user expects.
> +
> A link named 'tape' is made from the SCSI device directory to the class
> directory corresponding to the mode 0 auto-rewind device (e.g., st0).
>
> diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
> index ad86dfbc8919..0e6a87f1f47f 100644
> --- a/drivers/scsi/st.c
> +++ b/drivers/scsi/st.c
> @@ -4697,6 +4697,24 @@ options_show(struct device *dev, struct device_attribute *attr, char *buf)
> }
> static DEVICE_ATTR_RO(options);
>
> +/**
> + * reset_blocked_show - Value 1 indicates that reads, writes, etc. are blocked
> + * because a device reset has occurred and no operation positioning the tape
> + * has been issued.
> + * @dev: struct device
> + * @attr: attribute structure
> + * @buf: buffer to return formatted data in
> + */
> +static ssize_t reset_blocked_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct st_modedef *STm = dev_get_drvdata(dev);
> + struct scsi_tape *STp = STm->tape;
> +
> + return sprintf(buf, "%d", STp->pos_unknown);
> +}
> +static DEVICE_ATTR_RO(reset_blocked);
> +
> /* Support for tape stats */
>
> /**
> @@ -4881,6 +4899,7 @@ static struct attribute *st_dev_attrs[] = {
> &dev_attr_default_density.attr,
> &dev_attr_default_compression.attr,
> &dev_attr_options.attr,
> + &dev_attr_reset_blocked.attr,
> NULL,
> };
>
next prev parent reply other threads:[~2024-12-11 21:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 14:02 [PATCH v2 0/4] scsi: st: scsi_error: More reset patches Kai Mäkisara
2024-11-25 14:02 ` [PATCH v2 1/4] scsi: st: Restore some drive settings after reset Kai Mäkisara
2024-11-25 14:02 ` [PATCH v2 2/4] scsi: scsi_error: Add counters for New Media and Power On/Reset UNIT ATTENTIONs Kai Mäkisara
2024-12-11 21:57 ` John Meneghini
2024-12-11 22:14 ` Bart Van Assche
2024-12-12 18:33 ` "Kai Mäkisara (Kolumbus)"
2024-11-25 14:03 ` [PATCH v2 3/4] scsi: st: Modify st.c to use the new scsi_error counters Kai Mäkisara
2024-12-11 22:14 ` John Meneghini
2024-11-25 14:03 ` [PATCH v2 4/4] scsi: st: Add sysfs file reset_blocked Kai Mäkisara
2024-12-11 21:57 ` John Meneghini [this message]
2024-12-11 21:57 ` [PATCH v2 0/4] scsi: st: scsi_error: More reset patches John Meneghini
2024-12-12 18:27 ` "Kai Mäkisara (Kolumbus)"
2024-12-13 13:09 ` "Kai Mäkisara (Kolumbus)"
2024-12-13 17:32 ` John Meneghini
2024-12-14 13:46 ` "Kai Mäkisara (Kolumbus)"
2024-12-20 22:14 ` John Meneghini
2024-12-21 7:57 ` "Kai Mäkisara (Kolumbus)"
2024-12-13 15:09 ` John Meneghini
2024-12-13 15:28 ` John Meneghini
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=363296a4-6235-4447-8e45-ec32a49c0fe6@redhat.com \
--to=jmeneghi@redhat.com \
--cc=James.Bottomley@HansenPartnership.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.