mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Fix read-only snapshot creation.
This commit is contained in:
parent
5b6a23726a
commit
b2a849142b
@ -1409,6 +1409,7 @@ static int _expand_snapshot(struct dev_manager *dm, struct logical_volume *lv,
|
|||||||
dl->populate = _populate_vanilla;
|
dl->populate = _populate_vanilla;
|
||||||
_clear_flag(dl, VISIBLE);
|
_clear_flag(dl, VISIBLE);
|
||||||
_clear_flag(dl, TOPLEVEL);
|
_clear_flag(dl, TOPLEVEL);
|
||||||
|
_set_flag(dl, READWRITE);
|
||||||
|
|
||||||
cow_dlid = dl->dlid;
|
cow_dlid = dl->dlid;
|
||||||
|
|
||||||
|
@ -453,6 +453,8 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
|
|||||||
"supported yet");
|
"supported yet");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/* Must zero cow */
|
||||||
|
status |= LVM_WRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(lv = lv_create(vg->fid, lp->lv_name, status, alloc,
|
if (!(lv = lv_create(vg->fid, lp->lv_name, status, alloc,
|
||||||
@ -512,6 +514,9 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lp->snapshot) {
|
if (lp->snapshot) {
|
||||||
|
/* Reset permission after zeroing */
|
||||||
|
if (!(lp->permission & LVM_WRITE))
|
||||||
|
lv->status &= ~LVM_WRITE;
|
||||||
if (!lock_vol(cmd, lv->lvid.s, LCK_LV_DEACTIVATE)) {
|
if (!lock_vol(cmd, lv->lvid.s, LCK_LV_DEACTIVATE)) {
|
||||||
log_err("Couldn't unlock snapshot.");
|
log_err("Couldn't unlock snapshot.");
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user