mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
snapshots: use lv_check_not_in_use
Switch from a simple 'open_count' test on opened snaphost to a more 'skilled' lv_check_not_in_use().
This commit is contained in:
parent
778de22d51
commit
84b3852ee5
@ -1,5 +1,6 @@
|
||||
Version 2.02.105 -
|
||||
=====================================
|
||||
Replace open_count check with lv_check_not_in_use() for snapshot open test.
|
||||
Add error messages with LV names for failing lv refresh.
|
||||
Compile/link daemons with RELRO and PIE options to harden daemon security.
|
||||
Support per-object compilation cflags via CFLAGS_object.o.
|
||||
|
@ -1910,19 +1910,14 @@ static int _lv_has_open_snapshots(struct logical_volume *lv)
|
||||
struct lvinfo info;
|
||||
int r = 0;
|
||||
|
||||
dm_list_iterate_items_gen(snap_seg, &lv->snapshot_segs, origin_list) {
|
||||
if (!lv_info(lv->vg->cmd, snap_seg->cow, 0, &info, 1, 0)) {
|
||||
r = 1;
|
||||
continue;
|
||||
}
|
||||
dm_list_iterate_items_gen(snap_seg, &lv->snapshot_segs, origin_list)
|
||||
if (!lv_info(lv->vg->cmd, snap_seg->cow, 0, &info, 1, 0) ||
|
||||
!lv_check_not_in_use(lv->vg->cmd, snap_seg->cow, &info))
|
||||
r++;
|
||||
|
||||
if (info.exists && info.open_count) {
|
||||
log_error("LV %s/%s has open snapshot %s: "
|
||||
"not deactivating", lv->vg->name, lv->name,
|
||||
snap_seg->cow->name);
|
||||
r = 1;
|
||||
}
|
||||
}
|
||||
if (r)
|
||||
log_error("LV %s/%s has open %d snapshot(s), not deactivating.",
|
||||
lv->vg->name, lv->name, r);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user