]> sourceware.org Git - lvm2.git/commitdiff
label: check only with active device for rescan
authorZdenek Kabelac <zkabelac@redhat.com>
Sat, 27 Feb 2021 20:20:37 +0000 (21:20 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Tue, 2 Mar 2021 21:54:40 +0000 (22:54 +0100)
When 'lv_info()' is called with &info structure,
the presence of node has to be checked from this structure.
Without this we were needlesly trying to look out 0:0 device.

lib/label/label.c

index 318cf4d6c1130a0bf24ca949ad1a0bda59c43dae..8cbed7dd83aefda9ac42dcd42e2d3731609ffe9c 100644 (file)
@@ -1424,12 +1424,12 @@ void label_scan_invalidate_lv(struct cmd_context *cmd, struct logical_volume *lv
        struct device *dev;
        dev_t devt;
 
-       if (!lv_info(cmd, lv, 0, &lvinfo, 0, 0))
-               return;
-
-       devt = MKDEV(lvinfo.major, lvinfo.minor);
-       if ((dev = dev_cache_get_by_devt(cmd, devt, NULL, NULL)))
-               label_scan_invalidate(dev);
+       if (lv_info(cmd, lv, 0, &lvinfo, 0, 0) && lvinfo.exists) {
+               /* FIXME: Still unclear what is it supposed to find */
+               devt = MKDEV(lvinfo.major, lvinfo.minor);
+               if ((dev = dev_cache_get_by_devt(cmd, devt, NULL, NULL)))
+                       label_scan_invalidate(dev);
+       }
 }
 
 /*
This page took 0.035434 seconds and 5 git commands to generate.