mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lv_check_not_in_use: correct check
Since lv_info() may return 0 without setting info struct, make the test correct and even more readable.
This commit is contained in:
parent
d4293b579d
commit
127c2fc6e2
@ -834,8 +834,10 @@ int lv_check_not_in_use(const struct logical_volume *lv, int error_if_used)
|
||||
struct lvinfo info;
|
||||
unsigned int open_count_check_retries;
|
||||
|
||||
if (!lv_info(lv->vg->cmd, lv, 0, &info, 1, 0) || !info.exists || !info.open_count)
|
||||
return !info.exists ? 2 : 1;
|
||||
if (!lv_info(lv->vg->cmd, lv, 0, &info, 1, 0) || !info.exists)
|
||||
return 2;
|
||||
else if (!info.open_count)
|
||||
return 1;
|
||||
|
||||
/* If sysfs is not used, use open_count information only. */
|
||||
if (dm_sysfs_dir()) {
|
||||
|
Loading…
Reference in New Issue
Block a user