summaryrefslogtreecommitdiff
path: root/drivers/scsi/st.c
diff options
context:
space:
mode:
authorKai Mäkisara <Kai.Makisara@kolumbus.fi>2025-02-01 17:11:06 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2025-02-03 17:51:31 -0500
commit2c445d5f832a51dfd8527fcce7323f79d37c0432 (patch)
tree098cb3766a58f5cb2531a398411aaffe8798e070 /drivers/scsi/st.c
parent341128dfe10a7c8681d86e81b5bc63902da644ef (diff)
scsi: st: Add sysfs file position_lost_in_reset
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> Link: https://lore.kernel.org/r/20250201151106.25529-1-Kai.Makisara@kolumbus.fi Reviewed-by: John Meneghini <jmeneghi@redhat.com> Tested-by: John Meneghini <jmeneghi@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/st.c')
-rw-r--r--drivers/scsi/st.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 6ec1cfeb92ff..85867120c8a9 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4703,6 +4703,24 @@ options_show(struct device *dev, struct device_attribute *attr, char *buf)
}
static DEVICE_ATTR_RO(options);
+/**
+ * position_lost_in_reset_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 position_lost_in_reset_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(position_lost_in_reset);
+
/* Support for tape stats */
/**
@@ -4887,6 +4905,7 @@ static struct attribute *st_dev_attrs[] = {
&dev_attr_default_density.attr,
&dev_attr_default_compression.attr,
&dev_attr_options.attr,
+ &dev_attr_position_lost_in_reset.attr,
NULL,
};