Hello community,

here is the log from the commit of package util-linux for openSUSE:Factory 
checked in at 2018-02-23 15:27:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/util-linux (Old)
 and      /work/SRC/openSUSE:Factory/.util-linux.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "util-linux"

Fri Feb 23 15:27:40 2018 rev:226 rq:577315 version:2.31.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/util-linux/python-libmount.changes       
2018-02-09 15:41:16.832888933 +0100
+++ /work/SRC/openSUSE:Factory/.util-linux.new/python-libmount.changes  
2018-02-23 15:27:43.743007595 +0100
@@ -1,0 +2,6 @@
+Fri Feb  9 15:08:22 CET 2018 - sbra...@suse.com
+
+- Fix lsblk on NVMe
+  (bsc#1078662, util-linux-sysfs-nvme-devno.patch).
+
+-------------------------------------------------------------------
util-linux-systemd.changes: same change
util-linux.changes: same change

New:
----
  util-linux-sysfs-nvme-devno.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-libmount.spec ++++++
--- /var/tmp/diff_new_pack.9Ude8z/_old  2018-02-23 15:27:46.414911066 +0100
+++ /var/tmp/diff_new_pack.9Ude8z/_new  2018-02-23 15:27:46.418910922 +0100
@@ -170,6 +170,8 @@
 Patch5:         util-linux-cramfs.patch
 # PATCH-FIX-UPSTREAM util-linux-fincore-count.patch sbra...@suse.com -- 
Disable bad test fincore/count.
 Patch6:         util-linux-fincore-count.patch
+# PATCH-FIX-UPSTREAM util-linux-sysfs-nvme-devno.patch bsc1078662 
sbra...@suse.com -- Fix lsblk on NVMe.
+Patch7:         util-linux-sysfs-nvme-devno.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 #
@@ -413,6 +415,7 @@
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1
+%patch7 -p1
 #
 # setctsid
 cp -p %{S:22} %{S:23} .

util-linux-systemd.spec: same change
++++++ util-linux.spec ++++++
--- /var/tmp/diff_new_pack.9Ude8z/_old  2018-02-23 15:27:46.522907164 +0100
+++ /var/tmp/diff_new_pack.9Ude8z/_new  2018-02-23 15:27:46.530906875 +0100
@@ -170,6 +170,8 @@
 Patch5:         util-linux-cramfs.patch
 # PATCH-FIX-UPSTREAM util-linux-fincore-count.patch sbra...@suse.com -- 
Disable bad test fincore/count.
 Patch6:         util-linux-fincore-count.patch
+# PATCH-FIX-UPSTREAM util-linux-sysfs-nvme-devno.patch bsc1078662 
sbra...@suse.com -- Fix lsblk on NVMe.
+Patch7:         util-linux-sysfs-nvme-devno.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 #
@@ -413,6 +415,7 @@
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1
+%patch7 -p1
 #
 # setctsid
 cp -p %{S:22} %{S:23} .


++++++ util-linux-sysfs-nvme-devno.patch ++++++
>From d51f05bfecb299a830897106460bf395be440c0a Mon Sep 17 00:00:00 2001
From: Karel Zak <k...@redhat.com>
Date: Fri, 9 Feb 2018 14:18:18 +0100
Subject: [PATCH] lsblk: try device/dev to read devno

Now sysfs_devname_to_devno() reads devno from /dev or
/sys/block/<name>/dev, but it seems that NVME uses
/sys/block/<name>/device/dev.

Reported-by: Potnuri Bharat Teja <bha...@chelsio.com>
Signed-off-by: Karel Zak <k...@redhat.com>
---
 lib/sysfs.c | 97 ++++++++++++++++++++++++++++++++++---------------------------
 1 file changed, 54 insertions(+), 43 deletions(-)

diff --git a/lib/sysfs.c b/lib/sysfs.c
index e8125e511..b1b67c59f 100644
--- a/lib/sysfs.c
+++ b/lib/sysfs.c
@@ -48,10 +48,28 @@ char *sysfs_devno_path(dev_t devno, char *buf, size_t 
bufsiz)
        return sysfs_devno_attribute_path(devno, buf, bufsiz, NULL);
 }
 
+static dev_t read_devno(const char *path)
+{
+       FILE *f;
+       int maj = 0, min = 0;
+       dev_t dev = 0;
+
+       f = fopen(path, "r" UL_CLOEXECSTR);
+       if (!f)
+               return 0;
+
+       if (fscanf(f, "%d:%d", &maj, &min) == 2)
+               dev = makedev(maj, min);
+       fclose(f);
+       return dev;
+}
+
 dev_t sysfs_devname_to_devno(const char *name, const char *parent)
 {
-       char buf[PATH_MAX], *path = NULL;
+       char buf[PATH_MAX];
+       char *_name = NULL;     /* name as encoded in sysfs */
        dev_t dev = 0;
+       int len;
 
        if (strncmp("/dev/", name, 5) == 0) {
                /*
@@ -59,69 +77,62 @@ dev_t sysfs_devname_to_devno(const char *name, const char 
*parent)
                 */
                struct stat st;
 
-               if (stat(name, &st) == 0)
+               if (stat(name, &st) == 0) {
                        dev = st.st_rdev;
-               else
-                       name += 5;      /* unaccesible, or not node in /dev */
+                       goto done;
+               }
+               name += 5;      /* unaccesible, or not node in /dev */
        }
 
-       if (!dev && parent && strncmp("dm-", name, 3)) {
+       _name = strdup(name);
+       if (!_name)
+               goto done;
+       sysfs_devname_dev_to_sys(_name);
+
+       if (parent && strncmp("dm-", name, 3)) {
                /*
                 * Create path to /sys/block/<parent>/<name>/dev
                 */
-               char *_name = strdup(name), *_parent = strdup(parent);
-               int len;
+               char *_parent = strdup(parent);
 
-               if (!_name || !_parent) {
-                       free(_name);
+               if (!_parent) {
                        free(_parent);
-                       return 0;
+                       goto done;
                }
-               sysfs_devname_dev_to_sys(_name);
                sysfs_devname_dev_to_sys(_parent);
 
                len = snprintf(buf, sizeof(buf),
                                _PATH_SYS_BLOCK "/%s/%s/dev", _parent, _name);
-               free(_name);
                free(_parent);
                if (len < 0 || (size_t) len >= sizeof(buf))
-                       return 0;
-               path = buf;
+                       goto done;
 
-       } else if (!dev) {
-               /*
-                * Create path to /sys/block/<sysname>/dev
-                */
-               char *_name = strdup(name);
-               int len;
-
-               if (!_name)
-                       return 0;
-
-               sysfs_devname_dev_to_sys(_name);
-               len = snprintf(buf, sizeof(buf),
-                               _PATH_SYS_BLOCK "/%s/dev", _name);
-               free(_name);
-               if (len < 0 || (size_t) len >= sizeof(buf))
-                       return 0;
-               path = buf;
+               /* don't try anything else for dm-* */
+               dev = read_devno(buf);
+               goto done;
        }
 
-       if (path) {
+       /*
+        * Read from /sys/block/<sysname>/dev
+        */
+       len = snprintf(buf, sizeof(buf),
+                       _PATH_SYS_BLOCK "/%s/dev", _name);
+       if (len < 0 || (size_t) len >= sizeof(buf))
+               goto done;
+       dev = read_devno(buf);
+
+       if (!dev) {
                /*
-                * read devno from sysfs
+                * Read from /sys/block/<sysname>/device/dev
                 */
-               FILE *f;
-               int maj = 0, min = 0;
-
-               f = fopen(path, "r" UL_CLOEXECSTR);
-               if (!f)
-                       return 0;
-
-               if (fscanf(f, "%d:%d", &maj, &min) == 2)
-                       dev = makedev(maj, min);
-               fclose(f);
+               len = snprintf(buf, sizeof(buf),
+                               _PATH_SYS_BLOCK "/%s/device/dev", _name);
+               if (len < 0 || (size_t) len >= sizeof(buf))
+                       goto done;
+               dev = read_devno(buf);
        }
+done:
+       free(_name);
        return dev;
 }
 
-- 
2.16.1


Reply via email to