1
0
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:
Alasdair Kergon 2003-09-16 16:08:05 +00:00
parent 5b6a23726a
commit b2a849142b
2 changed files with 6 additions and 0 deletions

View File

@ -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;

View File

@ -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;