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

cov: check dev_close_immediate

Function can report log_error() on fail path.
This commit is contained in:
Zdenek Kabelac 2018-10-15 16:06:35 +02:00
parent 2513661467
commit b1ff52ca14
3 changed files with 8 additions and 5 deletions

View File

@ -1302,8 +1302,8 @@ static int _check_for_open_devices(int close_immediate)
log_error("Device '%s' has been left open (%d remaining references).",
dev_name(dev), dev->open_count);
num_open++;
if (close_immediate)
dev_close_immediate(dev);
if (close_immediate && !dev_close_immediate(dev))
stack;
}
}

View File

@ -504,7 +504,8 @@ int dev_open_flags(struct device *dev, int flags, int direct, int quiet)
/* dev_close_immediate will decrement this */
dev->open_count++;
dev_close_immediate(dev);
if (!dev_close_immediate(dev))
return_0;
// FIXME: dev with DEV_ALLOCED is released
// but code is referencing it
}
@ -585,7 +586,8 @@ int dev_open_flags(struct device *dev, int flags, int direct, int quiet)
if (!(dev->flags & DEV_REGULAR) &&
((fstat(dev->fd, &buf) < 0) || (buf.st_rdev != dev->dev))) {
log_error("%s: fstat failed: Has device name changed?", name);
dev_close_immediate(dev);
if (!dev_close_immediate(dev))
stack;
return 0;
}

View File

@ -284,7 +284,8 @@ static void _online_pvid_file_create(struct device *dev)
/* We don't care about syncing, these files are not even persistent. */
close(fd);
if (close(fd))
log_sys_debug("close", path);
}
static int _online_pvid_file_exists(const char *pvid)