mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
snapshot: zero cow header for read-only snapshot
When read-only snapshot was created, tool was skipping header initialization of cow device. If it happened device has been already containing header from some previous snapshot, it's been 'reused' for a newly created snapshot instead of being cleared.
This commit is contained in:
parent
3bb9eda97c
commit
2b044452e3
@ -1,5 +1,6 @@
|
||||
Version 2.02.106 -
|
||||
====================================
|
||||
Zero snapshot COW header when creating read-only snapshot.
|
||||
Comment out config lines in dumpconfig output without default values defined.
|
||||
Improve detection of clustered mirror support.
|
||||
Enhance raid code with feature flags, for now checks for raid10.
|
||||
|
@ -131,4 +131,15 @@ vgremove -ff $vg1
|
||||
|
||||
fi
|
||||
|
||||
lvremove -f $vg
|
||||
|
||||
# Check snapshot really deletes COW header for read-only snapshot
|
||||
aux lvmconf "allocation/wipe_signatures_when_zeroing_new_lvs = 1"
|
||||
lvcreate -L10 -n $lv1 $vg
|
||||
lvcreate -s -L10 -n snap $vg/$lv1
|
||||
# Populate snapshot with some filesystem signatures
|
||||
mkfs.ext4 "$DM_DEV_DIR/$vg/snap"
|
||||
lvremove -f $vg/snap
|
||||
lvcreate -s -pr -l12 -n snap $vg/$lv1
|
||||
|
||||
vgremove -ff $vg
|
||||
|
@ -769,8 +769,12 @@ static int _read_activation_params(struct lvcreate_params *lp,
|
||||
lp->permission = arg_uint_value(cmd, permission_ARG,
|
||||
LVM_READ | LVM_WRITE);
|
||||
|
||||
if (lp->snapshot) {
|
||||
/* Snapshot has to zero COW header */
|
||||
lp->zero = 1;
|
||||
lp->wipe_signatures = 0;
|
||||
} else if (!(lp->permission & LVM_WRITE)) {
|
||||
/* Must not zero/wipe read only volume */
|
||||
if (!(lp->permission & LVM_WRITE)) {
|
||||
lp->zero = 0;
|
||||
lp->wipe_signatures = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user