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

Subscribers

People subscribed via source and target branches