mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
Fix read-only snapshot creation.
This commit is contained in:
parent
39cee65c6b
commit
47a2c1c6e5
@ -1409,6 +1409,7 @@ static int _expand_snapshot(struct dev_manager *dm, struct logical_volume *lv,
|
||||
dl->populate = _populate_vanilla;
|
||||
_clear_flag(dl, VISIBLE);
|
||||
_clear_flag(dl, TOPLEVEL);
|
||||
_set_flag(dl, READWRITE);
|
||||
|
||||
cow_dlid = dl->dlid;
|
||||
|
||||
|
@ -453,6 +453,8 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
|
||||
"supported yet");
|
||||
return 0;
|
||||
}
|
||||
/* Must zero cow */
|
||||
status |= LVM_WRITE;
|
||||
}
|
||||
|
||||
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) {
|
||||
/* Reset permission after zeroing */
|
||||
if (!(lp->permission & LVM_WRITE))
|
||||
lv->status &= ~LVM_WRITE;
|
||||
if (!lock_vol(cmd, lv->lvid.s, LCK_LV_DEACTIVATE)) {
|
||||
log_err("Couldn't unlock snapshot.");
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user