1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-29 15:22:30 +03:00

snapshot: use lv_check_not_in_use

Instead of plain open_count check, try to use 'smarter'
lv_check_not_in_use() function.
This commit is contained in:
Zdenek Kabelac 2013-11-22 15:27:47 +01:00
parent 6d196410fc
commit 4a061a35c7
2 changed files with 9 additions and 11 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.105 -
=====================================
Use lv_check_not_in_use() when testing device in use before merging.
Move test for target present from init_snapshot_merge() to lvconvert.
Check for failure of lvmcache_add_mda() when writing pv.
Check for failure of dev_get_size() when reporting device size.

View File

@ -1906,17 +1906,14 @@ static int lvconvert_merge(struct cmd_context *cmd,
* constructor and DM should prevent appropriate devices from
* being open.
*/
if (lv_info(cmd, origin, 0, &info, 1, 0)) {
if (info.open_count) {
log_error("Can't merge over open origin volume");
merge_on_activate = 1;
}
}
if (lv_info(cmd, lv, 0, &info, 1, 0)) {
if (info.open_count) {
log_print_unless_silent("Can't merge when snapshot is open");
merge_on_activate = 1;
}
if (lv_info(cmd, origin, 0, &info, 1, 0) &&
!lv_check_not_in_use(cmd, origin, &info)) {
log_print_unless_silent("Can't merge over open origin volume.");
merge_on_activate = 1;
} else if (lv_info(cmd, lv, 0, &info, 1, 0) &&
!lv_check_not_in_use(cmd, lv, &info)) {
log_print_unless_silent("Can't merge when snapshot is open.");
merge_on_activate = 1;
}
init_snapshot_merge(snap_seg, origin);