From: mwilck@suse.com
To: Douglas Gilbert <dgilbert@interlog.com>, Hannes Reinecke <hare@suse.de>
Cc: James Bottomley <jejb@linux.vnet.ibm.com>,
linux-scsi@vger.kernel.org,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Franck Bui <fbui@suse.de>,
dm-devel@redhat.com, Martin Wilck <mwilck@suse.com>
Subject: [dm-devel] [PATCH 3/3] udev: add 00-scsi-sg3_config.rules for user configuration
Date: Mon, 27 Mar 2023 15:24:59 +0200 [thread overview]
Message-ID: <20230327132459.29531-4-mwilck@suse.com> (raw)
In-Reply-To: <20230327132459.29531-1-mwilck@suse.com>
From: Martin Wilck <mwilck@suse.com>
Add a dedicated early rules file to simplify configuring the behavior
of the SCSI udev rules shipped with sg3_utils.
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
Makefile.am | 1 +
scripts/00-scsi-sg3_config.rules | 23 +++++++++++++++++++++++
scripts/55-scsi-sg3_id.rules | 6 ++----
scripts/58-scsi-sg3_symlink.rules | 6 +-----
4 files changed, 27 insertions(+), 9 deletions(-)
create mode 100644 scripts/00-scsi-sg3_config.rules
diff --git a/Makefile.am b/Makefile.am
index 240acbe..ce7ee71 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -123,6 +123,7 @@ EXTRA_DIST += \
inhex/z_act_query.hex
EXTRA_DIST += \
+ scripts/00-scsi-sg3_config.rules \
scripts/40-usb-blacklist.rules \
scripts/54-before-scsi-sg3_id.rules \
scripts/55-scsi-sg3_id.rules \
diff --git a/scripts/00-scsi-sg3_config.rules b/scripts/00-scsi-sg3_config.rules
new file mode 100644
index 0000000..43d6f16
--- /dev/null
+++ b/scripts/00-scsi-sg3_config.rules
@@ -0,0 +1,23 @@
+# Configuration for SCSI device identification
+
+# To apply changes, copy this file to /etc/udev/rules.d and edit to suit your needs.
+# DO NOT EDIT THIS FILE IN PLACE!
+
+ACTION!="add|change", GOTO="scsi_identify_end"
+SUBSYSTEMS=="scsi", GOTO="scsi_identify"
+GOTO="scsi_identify_end"
+LABEL="scsi_identify"
+
+# Set ID_SCSI_INQUIRY to 0 to force running "sg_inq" for obtaining device IDs
+# from SCSI VPDs, rather than looking them up in sysfs (not recommended).
+ENV{ID_SCSI_INQUIRY}=""
+
+# Set enabled unreliable sources for setting the ID_SERIAL property.
+# See 55-scsi-sg3_id.rules for detailed documentation.
+ENV{.SCSI_ID_SERIAL_SRC}="T"
+
+# Set enabled unreliable sources for creating additional /dev/disk/by-id/scsi* symlinks.
+# See 58-scsi-sg3_symlink.rules for detailed documentation.
+ENV{.SCSI_SYMLINK_SRC}=""
+
+LABEL="scsi_identify_end"
diff --git a/scripts/55-scsi-sg3_id.rules b/scripts/55-scsi-sg3_id.rules
index 33b2ad3..5e9732d 100644
--- a/scripts/55-scsi-sg3_id.rules
+++ b/scripts/55-scsi-sg3_id.rules
@@ -36,7 +36,7 @@ KERNEL!="sd*[!0-9]|sr*", GOTO="sg3_utils_id_end"
# have scanned for VPD pages, so if the vpd page attribute is not
# present it is not supported (or deemed unsafe to access).
# Hence we can skip the call to sg_inq and avoid I/O altogether.
-# Set 'ID_SCSI_INQUIRY=0' in an earlier udev rule if the kernel
+# Set ENV{ID_SCSI_INQUIRY}="0" in 00-scsi-sg3_config.rules if the kernel
# fails to scan VPD pages correctly; the rules will then fall
# back to calling sg_vpd directly.
LABEL="scsi_inquiry"
@@ -119,9 +119,7 @@ ENV{ID_SCSI_SERIAL}!="?*", ENV{SCSI_IDENT_SERIAL}=="?*", ENV{ID_SCSI_SERIAL}="$e
# Be aware that multipath actually needs unique identifiers, though.
# Using ambiguous identifiers for ID_SERIAL can cause data corruption with multipath.
#
-# To configure this, add an early rule (e.g. /etc/udev/rules.d/00-scsi-serial.rules) e.g. like this:
-# ACTION!="remove", KERNEL=="sd*|sr*|st*|nst*|cciss*", ENV{.SCSI_ID_SERIAL_SRC}="TLVS"
-#
+# To configure the behavior, set ENV{.SCSI_ID_SERIAL_SRC} in 00-scsi-sg3_config.rules.
# By default, only T10 vendor ID is allowed.
ENV{.SCSI_ID_SERIAL_SRC}!="?*", ENV{.SCSI_ID_SERIAL_SRC}="T"
diff --git a/scripts/58-scsi-sg3_symlink.rules b/scripts/58-scsi-sg3_symlink.rules
index 99fdc23..dfe8f77 100644
--- a/scripts/58-scsi-sg3_symlink.rules
+++ b/scripts/58-scsi-sg3_symlink.rules
@@ -23,12 +23,8 @@ ENV{UDEV_DISABLE_PERSISTENT_STORAGE_RULES_FLAG}=="1", GOTO="sg3_utils_symlink_en
# This only needs to be changed if some subsystem, like dm-crypt or LVM, depends on the
# additional symlinks being present for device identification.
#
-# To configure the behavior, add an early rule (e.g. /etc/udev/rules.d/00-scsi-serial.rules)
-# like this:
-# ACTION!="remove", KERNEL=="sd*|sr*|st*|nst*|cciss*", ENV{.SCSI_SYMLINK_SRC}="TS"
-#
+# To configure the behavior, set ENV{.SCSI_SYMLINK_SRC} in 00-scsi-sg3_config.rules.
# By default, no possibly ambiguous additional symlinks will be created.
-ENV{.SCSI_SYMLINK_SRC}!="?*", ENV{.SCSI_SYMLINK_SRC}=""
# 0: vpd page 0x80 identifier
ENV{.SCSI_SYMLINK_SRC}=="*S*", ENV{SCSI_IDENT_SERIAL}=="?*", ENV{DEVTYPE}=="disk", \
--
2.39.2
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
next prev parent reply other threads:[~2023-03-27 13:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-27 13:24 [dm-devel] [RFC PATCH 0/3] sg3_utils: udev rules: restrict use of ambiguous device IDs mwilck
2023-03-27 13:24 ` [dm-devel] [PATCH 1/3] 55-scsi-sg3_id.rules: don't set unreliable device ID by default mwilck
2023-03-27 13:24 ` [dm-devel] [PATCH 2/3] 58-scsi-sg3_symlink.rules: don't create extra by-id symlinks " mwilck
2023-03-27 13:24 ` mwilck [this message]
2023-03-27 23:58 ` [dm-devel] [RFC PATCH 0/3] sg3_utils: udev rules: restrict use of ambiguous device IDs Douglas Gilbert
2023-03-28 7:52 ` Martin Wilck
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=20230327132459.29531-4-mwilck@suse.com \
--to=mwilck@suse.com \
--cc=dgilbert@interlog.com \
--cc=dm-devel@redhat.com \
--cc=fbui@suse.de \
--cc=hare@suse.de \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).