Merge ~rafaeldtinoco/ubuntu/+source/sg3-utils:lp1833618-bionic into ubuntu/+source/sg3-utils:ubuntu/bionic-devel

Proposed by Rafael David Tinoco
Status: Needs review
Proposed branch: ~rafaeldtinoco/ubuntu/+source/sg3-utils:lp1833618-bionic
Merge into: ubuntu/+source/sg3-utils:ubuntu/bionic-devel
Diff against target: 156 lines (+130/-0)
4 files modified
debian/changelog (+8/-0)
debian/patches/55-scsi-sg3_id.rules-ID_SERIAL-fix.patch (+85/-0)
debian/patches/new-location-for-major-and-minor.patch (+35/-0)
debian/patches/series (+2/-0)
Reviewer Review Type Date Requested Status
Steve Langasek (community) Approve
Rafael David Tinoco (community) Approve
Ryan Harper (community) Approve
Review via email: mp+373440@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

I'll wait for feedback in bug:

https://bugs.launchpad.net/ubuntu/+source/sg3-utils/+bug/1833618

Before asking for this to be sponsored (fyio).

d8fe484... by Rafael David Tinoco

55-scsi-sg3_id.rules: ID_SERIAL fix for USB SPC-only devices

This upstream commit changes the udev rules logic for USB block devices
that only supports SCSI PRIMARY COMMANDS, not supporting SCSI INQ 0x80
nor 0x83.

Despite a possible delay, still existing in this version, whenever a
SPC-only block device (pendrive ?) is attached, this version fixes the
main issue for (LP: 1833618), wrong ID_SERIAL for those devices.

507c4d7... by Rafael David Tinoco

Fix for FTBFS in Ubuntu Disco due to header changes.

- new location for major() and minor()

0161dca... by Rafael David Tinoco

changelog

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :
Revision history for this message
Ryan Harper (raharper) wrote :

One comment for clarification. I believe this is OK as-is due to sg3-utils not being installed in the bionic server image by default.

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

you mean leaving Bionic as won't fix for this ?

I'm okay with that, public bug is already documenting the issue and has a patch if anyone wants (which is just changing udev rules).

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

sorry, ignore previous comment, checking inline comments..

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) :
Revision history for this message
Ryan Harper (raharper) wrote :

Thanks for the clarification.

review: Approve
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Thx, I'll move on with this fix then (also based on Christian's review of the Disco version):

https://code.launchpad.net/~rafaeldtinoco/ubuntu/+source/sg3-utils/+git/sg3-utils/+merge/373439

review: Approve
Revision history for this message
Steve Langasek (vorlon) :
review: Approve

Unmerged commits

0161dca... by Rafael David Tinoco

changelog

507c4d7... by Rafael David Tinoco

Fix for FTBFS in Ubuntu Disco due to header changes.

- new location for major() and minor()

d8fe484... by Rafael David Tinoco

55-scsi-sg3_id.rules: ID_SERIAL fix for USB SPC-only devices

This upstream commit changes the udev rules logic for USB block devices
that only supports SCSI PRIMARY COMMANDS, not supporting SCSI INQ 0x80
nor 0x83.

Despite a possible delay, still existing in this version, whenever a
SPC-only block device (pendrive ?) is attached, this version fixes the
main issue for (LP: 1833618), wrong ID_SERIAL for those devices.

a938448... by Mathieu Trudel-Lapierre

Import patches-unapplied version 1.42-2ubuntu1 to ubuntu/yakkety-proposed

Imported using git-ubuntu import.

Changelog parent: ab52525db3b33aa54a26e51fe755d5fd26e80cb2

New changelog entries:
  * debian/control, debian/rules: build a sg3-udeb installer package again.
  * debian/sg3-udeb.install: install the right binaries for sg3-udeb.

ab52525... by Ritesh Raj Sarraf

Import patches-unapplied version 1.42-2 to debian/sid

Imported using git-ubuntu import.

Changelog parent: db7e88927ff9f83e1d21b4b09e926b9c7eb6f755

New changelog entries:
  * [a3ba3f8] Don't hardcode architecture in install files
  * Also close below bug. Its udev rule error is fixed in 1.42
    (Closes: #799680)
  * [1602649] Add debian/gbp.conf to explicitly enable pristine-tar
    for this package's packaging
  * [5e8831f] Imported Upstream version 1.42
  * [207bf28] Update symbol list for 1.42
  * [5bb50a3] Bump debhelper to 9
  * [3ef31a6] Fix Vcs URLs
  * [ed19382] Update install list

db7e889... by Ritesh Raj Sarraf

Import patches-unapplied version 1.41-1 to debian/sid

Imported using git-ubuntu import.

Changelog parent: 9878f2db3b3e92091df79e531c85df58f2a89e1c

New changelog entries:
  [ Mauricio Faria de Oliveira ]
  * sg3-utils-udev (new binary package): provide the udev rules for
    SCSI-ID mappings and symlinks at boot time for multipath-tools:
    - debian/control: add sg3-utils-udev
    - debian/rules: build it with override_dh_{install,clean}
    - debian/initramfs/hooks: add_udev_rules() and copy_exec() 'sg_inq'
      to initramfs
    - debian/sg3-utils-udev.post{inst,rm}: call update-initramfs
  [ Ritesh Raj Sarraf ]
  * [7c346df] Add misc:Depends to dependency
  * [b719c1a] Clean up README.source
  * [e799461] Remove stale debian/ folder in upstream branch
  * [92db371] Imported Upstream version 1.41
  * [dadce5a] Recover debian/ files from improper gbp import
    --filter=debian
  * [e7aa4ba] Refresh patch debian/patches/ship-rescan-script.sh
  * [33af743] Update symbols introduced in 1.41

9878f2d... by Ritesh Raj Sarraf

Import patches-unapplied version 1.39-1 to debian/sid

Imported using git-ubuntu import.

Changelog parent: 27cd9b81a06147b914a15cc572ad0965784b1109

New changelog entries:
  * [a3a22b2] Imported Upstream version 1.39
  * [c1a14cb] Update symbols list

27cd9b8... by Ritesh Raj Sarraf

Import patches-unapplied version 1.38-2 to debian/sid

Imported using git-ubuntu import.

Changelog parent: d19f50707ab87250494a2cb88e069c653afc0bd2

New changelog entries:
  * [c9b57d9] Ship the rescan-scsi-bus.sh script (Closes: #758926)
    Note: The scsitools package also ships a rescan-scsi-bus script.
    To make the files not overwrite, rescan-scsi-bus.sh script is
    shipped into /usr/bin/

d19f507... by Ritesh Raj Sarraf

Import patches-unapplied version 1.38-1 to debian/sid

Imported using git-ubuntu import.

Changelog parent: 0ce210b2dfc9a478788c1541508bc04ab18fe7f4

New changelog entries:
  * [d956539] Use dh-autoreconf for build.
    Thanks to Colin Watson (Closes: #732541)
  * [2fc0300] Imported Upstream version 1.38

0ce210b... by Ritesh Raj Sarraf

Import patches-unapplied version 1.36-1 to debian/sid

Imported using git-ubuntu import.

Changelog parent: 4bc36facc67f10635543f4668023671c8f3c9930

New changelog entries:
  * [69e9dac] Imported Upstream version 1.36
  * [cb75936] Add debian compat, level 7
  * [68fed25] update README.source
  * [3c724fc] Add build-dep autotools-dev
  * [e4b9fdd] add destdir to install path
  * [7cfff11] Simplify build with debhelper
  * [f9a7540] Update symbols for 1.36 release
  * [7b0b48d] Enable hardening build

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 15acda8..be1c47c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
1sg3-utils (1.42-2ubuntu2~18.04~1) bionic; urgency=medium
2
3 * d/p/55-scsi-sg3_id.rules-ID_SERIAL-fix.patch: ID_SERIAL fix for USB
4 SPC-only devices in 55-scsi-sg3_id.rules (LP: #1833618)
5 * d/p/new-location-for-major-and-minor.patch: Fix FTBS header issue
6
7 -- Rafael David Tinoco <rafaeldtinoco@ubuntu.com> Wed, 09 Oct 2019 06:38:32 +0000
8
1sg3-utils (1.42-2ubuntu1) yakkety; urgency=medium9sg3-utils (1.42-2ubuntu1) yakkety; urgency=medium
210
3 * debian/control, debian/rules: build a sg3-udeb installer package again.11 * debian/control, debian/rules: build a sg3-udeb installer package again.
diff --git a/debian/patches/55-scsi-sg3_id.rules-ID_SERIAL-fix.patch b/debian/patches/55-scsi-sg3_id.rules-ID_SERIAL-fix.patch
4new file mode 10064412new file mode 100644
index 0000000..7eddde3
--- /dev/null
+++ b/debian/patches/55-scsi-sg3_id.rules-ID_SERIAL-fix.patch
@@ -0,0 +1,85 @@
1Description: 55-scsi-sg3_id.rules: ID_SERIAL fix for USB SPC-only devices
2
3Upstream commit had changes for:
4
5git-svn-id: svn://localhost/trunk@703 6180dd3e-e324-4e3e-922d-17de1ae2f315
6---
7 ChangeLog | 4 +++-
8 scripts/55-scsi-sg3_id.rules | 15 ++++++++----
9 scripts/rescan-scsi-bus.sh | 46 ++++++++++++++++++++----------------
10 3 files changed, 38 insertions(+), 27 deletions(-)
11
12But, for this SRU, I'm backporting ONLY the changes in:
13
14 55-scsi-sg3_id.rules | 15 ++++++++++-----
15 1 file changed, 10 insertions(+), 5 deletions(-)
16
17Because I'm only interested in the fix for USB SPC-only devices ID_SERIAL.
18
19This upstream commit changes the udev rules logic for USB block devices
20that only supports SCSI PRIMARY COMMANDS, not supporting SCSI INQ 0x80
21nor 0x83.
22
23Despite a possible delay, still existing in this version, whenever a
24SPC-only block device (pendrive ?) is attached, this version fixes the
25main issue for LP: 1833618, wrong ID_SERIAL for those devices.
26
27Udev rules from sg3-utils will, still, execute SCSI INQ 0X80 trying to use VPDs
28from the kernel, and those will fail fast. Unfortunately, the subsequent SCSI
29INQ 0x83 command, also trying to use VPDs from kernel, will take much longer
30time (sometimes up to 1 minute) to fail when it sees there is no existing
31vpd_pg83 file in sysfs and send an INQ to the USB block device, adding a delay
32in the device attachment. This is not being addressed in this fix as this is
33still present in upstream version.
34
35This last issue has to be addressed in a future sg3-utils-merge and
36that is why is being documented here (when this patch will likely be
37dropped).
38
39Signed-off-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
40
41Author: Douglas Gilbert <dgilbert@interlog.com>
42Origin: upstream, https://github.com/hreinecke/sg3_utils/commit/988e967513f
43Bug-Ubuntu: https://bugs.launchpad.net/bugs/1833618
44Last-Update: 2019-10-09
45---
46 scripts/55-scsi-sg3_id.rules | 15 ++++++++++-----
47 1 file changed, 10 insertions(+), 5 deletions(-)
48
49diff --git a/scripts/55-scsi-sg3_id.rules b/scripts/55-scsi-sg3_id.rules
50index e914a5d..8c7356b 100644
51--- a/scripts/55-scsi-sg3_id.rules
52+++ b/scripts/55-scsi-sg3_id.rules
53@@ -7,7 +7,12 @@ SUBSYSTEM!="block", GOTO="sg3_utils_id_end"
54 # Import values for partitions
55 ENV{DEVTYPE}=="partition", IMPORT{parent}="SCSI_*", ENV{ID_SCSI}="1"
56 # SCSI INQUIRY values
57-KERNEL=="sd*[!0-9]|sr*", IMPORT{program}="/usr/bin/sg_inq --export $tempnode", ENV{ID_SCSI}="1"
58+# If the 'inquiry' sysfs attribute is present the kernel will already
59+# have scanned for VPD pages, so if the vpd page attribute is not
60+# present it is not supported (or deemed unsafe to access).
61+# Hence we can skip the call to sg_inq and avoid I/O altogether.
62+KERNEL=="sd*[!0-9]|sr*", IMPORT{program}="/usr/bin/sg_inq --export --inhex=/sys/block/$kernel/device/inquiry --raw", ENV{ID_SCSI}="1", ENV{ID_SCSI_SN}="1", ENV{ID_SCSI_DI}="1"
63+KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}!="1", IMPORT{program}="/usr/bin/sg_inq --export $tempnode", ENV{ID_SCSI}="1"
64 # scsi_id compat mappings
65 ENV{SCSI_VENDOR}=="?*", ENV{ID_VENDOR}="$env{SCSI_VENDOR}"
66 ENV{SCSI_VENDOR_ENC}=="?*", ENV{ID_VENDOR_ENC}="$env{SCSI_VENDOR_ENC}"
67@@ -16,11 +21,11 @@ ENV{SCSI_MODEL_ENC}=="?*", ENV{ID_MODEL_ENC}="$env{SCSI_MODEL_ENC}"
68 ENV{SCSI_REVISION}=="?*", ENV{ID_REVISION}="$env{SCSI_REVISION}"
69 ENV{SCSI_TYPE}=="?*", ENV{ID_TYPE}="$env{SCSI_TYPE}"
70 # SCSI EVPD page 0x80 values
71-KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", IMPORT{program}="/usr/bin/sg_inq --export --inhex=/sys/block/$kernel/device/vpd_pg80 --raw", ENV{ID_SCSI_SN}="1"
72-KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", ENV{ID_SCSI_SN}!="1", IMPORT{program}="/usr/bin/sg_inq --export --page=sn $tempnode", ENV{ID_SCSI_SN}="1"
73+KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", ENV{ID_SCSI_SN}=="1", IMPORT{program}="/usr/bin/sg_inq --export --inhex=/sys/block/$kernel/device/vpd_pg80 --raw"
74+KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", ENV{ID_SCSI_SN}!="1", IMPORT{program}="/usr/bin/sg_inq --export --page=sn $tempnode"
75 # SCSI EVPD page 0x83 values
76-KERNEL=="sd*[!0-9]", ENV{ID_SCSI}=="1", IMPORT{program}="/usr/bin/sg_inq --export --inhex=/sys/block/$kernel/device/vpd_pg83 --raw", ENV{ID_SCSI_DI}="1"
77-KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", ENV{ID_SCSI_DI}!="1", IMPORT{program}="/usr/bin/sg_inq --export --page=di $tempnode", ENV{ID_SCSI_DI}="1"
78+KERNEL=="sd*[!0-9]", ENV{ID_SCSI}=="1", ENV{ID_SCSI_DI}=="1", IMPORT{program}="/usr/bin/sg_inq --export --inhex=/sys/block/$kernel/device/vpd_pg83 --raw"
79+KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", ENV{ID_SCSI_DI}!="1", IMPORT{program}="/usr/bin/sg_inq --export --page=di $tempnode"
80
81 # ID_WWN compat mapping
82 ENV{SCSI_IDENT_LUN_NAA_REGEXT}=="?*", ENV{ID_WWN}!="?*", ENV{ID_WWN}="0x$env{SCSI_IDENT_LUN_NAA_REGEXT}"
83--
842.20.1
85
diff --git a/debian/patches/new-location-for-major-and-minor.patch b/debian/patches/new-location-for-major-and-minor.patch
0new file mode 10064486new file mode 100644
index 0000000..4196aa7
--- /dev/null
+++ b/debian/patches/new-location-for-major-and-minor.patch
@@ -0,0 +1,35 @@
1Description: new location for major() and minor()
2
3[Backport]
4 Only backported the header location change.
5
6Signed-off-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
7
8Author: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
9Origin: backport, https://github.com/hreinecke/sg3_utils/commit/3e50c99af4a4
10Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/sg3-utils/+bug/1833618
11Last-Update: 2019-10-01
12---
13 src/sg_map26.c | 5 ++++-
14 1 file changed, 4 insertions(+), 1 deletion(-)
15
16diff --git a/src/sg_map26.c b/src/sg_map26.c
17index 1a1301a..92f6de9 100644
18--- a/src/sg_map26.c
19+++ b/src/sg_map26.c
20@@ -31,8 +31,11 @@
21 #include <dirent.h>
22 #include <libgen.h>
23 #include <sys/ioctl.h>
24-#include <sys/types.h>
25 #include <sys/stat.h>
26+#include <sys/sysmacros.h> /* new location for major + minor */
27+#ifndef major
28+#include <sys/types.h>
29+#endif
30 #include <linux/major.h>
31
32 #ifdef HAVE_CONFIG_H
33--
342.20.1
35
diff --git a/debian/patches/series b/debian/patches/series
index 30d2fb2..fa0b7a4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
1ship-rescan-script.sh1ship-rescan-script.sh
255-scsi-sg3_id.rules-ID_SERIAL-fix.patch
3new-location-for-major-and-minor.patch

Subscribers

People subscribed via source and target branches