mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-06 00:58:48 +03:00
Fix snapshot cow area deactivation if origin is not active. (2.02.13)
This commit is contained in:
parent
d1158c75e8
commit
5b7d162947
@ -1,5 +1,6 @@
|
||||
Version 2.02.27 -
|
||||
================================
|
||||
Fix snapshot cow area deactivation if origin is not active. (2.02.13)
|
||||
Fix configure libdevmapper.h check when --with-dmdir is used.
|
||||
Turn _add_pv_to_vg() into external library function add_pv_to_vg().
|
||||
Add pv_by_path() external library function.
|
||||
|
@ -478,10 +478,11 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
|
||||
struct logical_volume *lv, *org = NULL, *log_lv = NULL;
|
||||
struct list *pvh, tags;
|
||||
const char *tag = NULL;
|
||||
int consistent = 1;
|
||||
int consistent = 1, origin_active = 0;
|
||||
struct alloc_handle *ah = NULL;
|
||||
char lv_name_buf[128];
|
||||
const char *lv_name;
|
||||
struct lvinfo info;
|
||||
|
||||
status |= lp->permission | VISIBLE_LV;
|
||||
|
||||
@ -615,6 +616,13 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
|
||||
|
||||
/* Must zero cow */
|
||||
status |= LVM_WRITE;
|
||||
|
||||
if (!lv_info(cmd, org, &info, 0)) {
|
||||
log_error("Check for existence of snapshot origin "
|
||||
"'%s' failed.", org->name);
|
||||
return 0;
|
||||
}
|
||||
origin_active = info.exists;
|
||||
}
|
||||
|
||||
if (!lp->extents) {
|
||||
@ -792,6 +800,13 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
|
||||
if (!(lp->permission & LVM_WRITE))
|
||||
lv->status &= ~LVM_WRITE;
|
||||
|
||||
/* COW area must be deactivated if origin is not active */
|
||||
if (!origin_active && !deactivate_lv(cmd, lv)) {
|
||||
log_error("Aborting. Couldn't deactivate snapshot "
|
||||
"COW area.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* cow LV remains active and becomes snapshot LV */
|
||||
|
||||
if (!vg_add_snapshot(vg->fid, NULL, org, lv, NULL,
|
||||
|
Loading…
x
Reference in New Issue
Block a user