]> sourceware.org Git - lvm2.git/commitdiff
devs: add some checks for a dev with no path name
authorDavid Teigland <teigland@redhat.com>
Wed, 13 May 2020 20:47:20 +0000 (15:47 -0500)
committerDavid Teigland <teigland@redhat.com>
Wed, 13 May 2020 21:26:26 +0000 (16:26 -0500)
It's possible for a dev-cache entry to remain after all
paths for it have been removed, and other parts of the
code expect that a dev always has a name.  A better fix
may be to remove a device from dev-cache after all paths
to it have been removed.

lib/device/dev-io.c
lib/label/hints.c

index 735441f19970ac9a41de28db14a9dc46df2bcf9b..33b9345ee3e0796e8750030b76731282a61869c5 100644 (file)
@@ -86,6 +86,9 @@ static int _dev_get_size_dev(struct device *dev, uint64_t *size)
        int fd = dev->bcache_fd;
        int do_close = 0;
 
+       if (dm_list_empty(&dev->aliases))
+               return 0;
+
        if (dev->size_seqno == _dev_size_seqno) {
                log_very_verbose("%s: using cached size %" PRIu64 " sectors",
                                 name, dev->size);
index 48fb661b48479ff0fcc44875c6f1dbc89870b639..349d5aaef58c665fe77dc0496011a52e8625265a 100644 (file)
@@ -419,6 +419,9 @@ static int _dev_in_hint_hash(struct cmd_context *cmd, struct device *dev)
 {
        uint64_t devsize = 0;
 
+       if (dm_list_empty(&dev->aliases))
+               return 0;
+
        if (!cmd->filter->passes_filter(cmd, cmd->filter, dev, "regex"))
                return 0;
 
This page took 0.040658 seconds and 5 git commands to generate.