diff --git a/SOURCES/40-usb-blacklist.rules b/SOURCES/40-usb-blacklist.rules new file mode 100644 index 0000000..6cce3e6 --- /dev/null +++ b/SOURCES/40-usb-blacklist.rules @@ -0,0 +1,14 @@ +# +# Blacklist specific USB devices +# +# don't inquire sn and di on broken devices (https://bugzilla.suse.com/show_bug.cgi?id=840054) + +ACTION!="add|change", GOTO="usb_blacklist_end" +KERNEL!="sd*[!0-9]|sr*", GOTO="usb_blacklist_end" + +# unkown device +ATTRS{idVendor}=="0aec", ATTRS{idProduct}=="3260", ENV{ID_SCSI_INQUIRY}="1" +# Sony/JMicron port replicator +ATTRS{idVendor}=="054c", ATTRS{idProduct}=="06a0", ENV{ID_SCSI_INQUIRY}="1" + +LABEL="usb_blacklist_end" diff --git a/SOURCES/59-fc-wwpn-id.rules b/SOURCES/59-fc-wwpn-id.rules new file mode 100644 index 0000000..5ad0a5c --- /dev/null +++ b/SOURCES/59-fc-wwpn-id.rules @@ -0,0 +1,17 @@ +# +# FC WWPN-based by-path links +# + +ACTION!="add|change", GOTO="fc_wwpn_end" +KERNEL!="sd*", GOTO="fc_wwpn_end" + +ENV{DEVTYPE}=="disk", IMPORT{program}="fc_wwpn_id %p" +ENV{DEVTYPE}=="partition", IMPORT{parent}="FC_*" +ENV{FC_TARGET_WWPN}!="?*", GOTO="fc_wwpn_end" +ENV{FC_INITIATOR_WWPN}!="?*", GOTO="fc_wwpn_end" +ENV{FC_TARGET_LUN}!="?*", GOTO="fc_wwpn_end" + +ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-path/fc-$env{FC_INITIATOR_WWPN}-$env{FC_TARGET_WWPN}-lun-$env{FC_TARGET_LUN}" +ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-path/fc-$env{FC_INITIATOR_WWPN}-$env{FC_TARGET_WWPN}-lun-$env{FC_TARGET_LUN}-part%n" + +LABEL="fc_wwpn_end" diff --git a/SOURCES/fc_wwpn_id-non_FC-devices.patch b/SOURCES/fc_wwpn_id-non_FC-devices.patch new file mode 100644 index 0000000..6bff83a --- /dev/null +++ b/SOURCES/fc_wwpn_id-non_FC-devices.patch @@ -0,0 +1,25 @@ +From 37b8af8278bba0b116b579950218f2e610a2ab2b Mon Sep 17 00:00:00 2001 +From: jtpittman195 +Date: Fri, 4 Oct 2019 10:58:24 -0400 +Subject: [PATCH] fc_wwpn_id: add condition to FC_TARGET_LUN return + +If there is no relevant fc_remote_port or fc_host found, there is no need to return the target_lun number. Returning with no condition causes a FC_TARGET_LUN value to be present in the udev database for devices that are not fibre attached. Add condition to check. +--- + scripts/fc_wwpn_id | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/scripts/fc_wwpn_id b/scripts/fc_wwpn_id +index c8d0189..b05c5e8 100644 +--- a/scripts/fc_wwpn_id ++++ b/scripts/fc_wwpn_id +@@ -38,7 +38,9 @@ while [ -n "$d" ] ; do + esac + done + +-echo "FC_TARGET_LUN=$target_lun" ++if [ -n "$rport_wwpn" ] || [ -n "$host_wwpn" ] ; then ++ echo "FC_TARGET_LUN=$target_lun" ++fi + + if [ -n "$rport_wwpn" ] ; then + echo "FC_TARGET_WWPN=$rport_wwpn" diff --git a/SPECS/sg3_utils.spec b/SPECS/sg3_utils.spec index f58a7c5..7971b03 100644 --- a/SPECS/sg3_utils.spec +++ b/SPECS/sg3_utils.spec @@ -3,11 +3,13 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils Version: 1.44 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ and BSD Group: Applications/System Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz Source2: scsi-rescan.8 +Source10: 40-usb-blacklist.rules +Source11: 59-fc-wwpn-id.rules Patch0: BZ_1633235-sg3_utils-1.44-covscan-fix.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1683343 # sg_turs: improper usage show @@ -15,8 +17,13 @@ Patch1: sg_turs-help.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1627657 # sg_raw -V fail Patch2: sg_raw-version.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1760847 +# FC_TARGET_LUN attribute assigned for non FC device +Patch3: fc_wwpn_id-non_FC-devices.patch URL: http://sg.danny.cz/sg/sg3_utils.html Requires: %{name}-libs%{?_isa} = %{version}-%{release} +BuildRequires: systemd + %description @@ -71,6 +78,15 @@ install -p -m 755 scripts/%{rescan_script} $RPM_BUILD_ROOT%{_bindir} install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8 +# install all extra udev rules +mkdir -p $RPM_BUILD_ROOT%{_udevrulesdir} +mkdir -p $RPM_BUILD_ROOT/usr/lib/udev +install -p -m 644 scripts/55-scsi-sg3_id.rules $RPM_BUILD_ROOT%{_udevrulesdir} +install -p -m 644 scripts/58-scsi-sg3_symlink.rules $RPM_BUILD_ROOT%{_udevrulesdir} +install -p -m 644 %{SOURCE10} $RPM_BUILD_ROOT%{_udevrulesdir} +install -p -m 644 %{SOURCE11} $RPM_BUILD_ROOT%{_udevrulesdir} +install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev + %post libs -p /sbin/ldconfig @@ -81,6 +97,8 @@ install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8 %doc AUTHORS BSD_LICENSE COPYING COVERAGE CREDITS ChangeLog README README.sg_start %{_bindir}/* %{_mandir}/man8/* +%{_udevrulesdir}/*.rules +/usr/lib/udev/* %files libs %doc BSD_LICENSE COPYING @@ -92,6 +110,9 @@ install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8 %changelog +* Tue Dec 10 2019 Tomas Bzatek - 1.44-4 +- Enable supplemental udev rules by default (RHBZ #1746414) + * Tue May 28 2019 Tomas Bzatek - 1.44-3 - Fix sg_turs help invocation in an old mode (#1683343) - Fix sg_raw printing error about device not specified on version request (#1627657)