1
0
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:
Zdenek Kabelac 2013-11-29 15:02:57 +01:00
parent 778de22d51
commit 84b3852ee5
2 changed files with 8 additions and 12 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.105 - 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. Add error messages with LV names for failing lv refresh.
Compile/link daemons with RELRO and PIE options to harden daemon security. Compile/link daemons with RELRO and PIE options to harden daemon security.
Support per-object compilation cflags via CFLAGS_object.o. Support per-object compilation cflags via CFLAGS_object.o.

View File

@ -1910,19 +1910,14 @@ static int _lv_has_open_snapshots(struct logical_volume *lv)
struct lvinfo info; struct lvinfo info;
int r = 0; int r = 0;
dm_list_iterate_items_gen(snap_seg, &lv->snapshot_segs, origin_list) { 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)) { if (!lv_info(lv->vg->cmd, snap_seg->cow, 0, &info, 1, 0) ||
r = 1; !lv_check_not_in_use(lv->vg->cmd, snap_seg->cow, &info))
continue; r++;
}
if (info.exists && info.open_count) { if (r)
log_error("LV %s/%s has open snapshot %s: " log_error("LV %s/%s has open %d snapshot(s), not deactivating.",
"not deactivating", lv->vg->name, lv->name, lv->vg->name, lv->name, r);
snap_seg->cow->name);
r = 1;
}
}
return r; return r;
} }