1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

devs: add some checks for a dev with no path name

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.
This commit is contained in:
David Teigland 2020-05-13 15:47:20 -05:00
parent 2d1fe38d84
commit 2f29765e7f
2 changed files with 6 additions and 0 deletions

View 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);

View 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;