mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-04 09:18:36 +03:00
snapshot: correct previous snapshot commit
Condition was swapped - however since it's been based on 'random' memory content it's been missed as attribute has not been set. So now we have quite a few possible results when testing. We have old status without separate metadata and we have kernels with fixed snapshot leak bug. (in-release update)
This commit is contained in:
parent
1769eddde7
commit
d00fc1de78
@ -46,9 +46,9 @@ static uint64_t _cow_extra_chunks(struct cmd_context *cmd, uint64_t n_chunks)
|
|||||||
segtype->ops->target_present &&
|
segtype->ops->target_present &&
|
||||||
segtype->ops->target_present(cmd, NULL, &attrs) &&
|
segtype->ops->target_present(cmd, NULL, &attrs) &&
|
||||||
(attrs & SNAPSHOT_FEATURE_FIXED_LEAK))
|
(attrs & SNAPSHOT_FEATURE_FIXED_LEAK))
|
||||||
return (n_chunks + 63) / 64;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
return (n_chunks + 63) / 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t _cow_max_size(struct cmd_context *cmd, uint64_t origin_size, uint32_t chunk_size)
|
static uint64_t _cow_max_size(struct cmd_context *cmd, uint64_t origin_size, uint32_t chunk_size)
|
||||||
|
@ -165,6 +165,9 @@ static int _snap_target_present(struct cmd_context *cmd,
|
|||||||
log_very_verbose("Target snapshot may leak metadata.");
|
log_very_verbose("Target snapshot may leak metadata.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (attributes)
|
||||||
|
*attributes = _snap_attrs;
|
||||||
|
|
||||||
/* TODO: test everything at once */
|
/* TODO: test everything at once */
|
||||||
if (seg && (seg->status & MERGING)) {
|
if (seg && (seg->status & MERGING)) {
|
||||||
if (!_snap_merge_checked) {
|
if (!_snap_merge_checked) {
|
||||||
|
@ -33,6 +33,25 @@ vgcreate -s 4M $vg $(cat DEVICES)
|
|||||||
TSIZE=15P
|
TSIZE=15P
|
||||||
aux can_use_16T || TSIZE=15T
|
aux can_use_16T || TSIZE=15T
|
||||||
|
|
||||||
|
# With different snapshot target driver we may obtain different results.
|
||||||
|
# Older targets have metadata leak bug which needs extra compenstion.
|
||||||
|
# Ancient targets do not even provide separate info for metadata.
|
||||||
|
EXPECT1="16.00k"
|
||||||
|
EXPECT2="512.00k"
|
||||||
|
EXPECT3="32.00k"
|
||||||
|
EXPECT4="66.67"
|
||||||
|
if aux target_at_least dm-snapshot 1 10 0 ; then
|
||||||
|
# Extra metadata size
|
||||||
|
EXPECT4="0.00"
|
||||||
|
|
||||||
|
if aux target_at_least dm-snapshot 1 12 0 ; then
|
||||||
|
# When fixed leak, expect smaller sizes
|
||||||
|
EXPECT1="12.00k"
|
||||||
|
EXPECT2="384.00k"
|
||||||
|
EXPECT3="28.00k"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
lvcreate -s -l 100%FREE -n $lv $vg --virtualsize $TSIZE
|
lvcreate -s -l 100%FREE -n $lv $vg --virtualsize $TSIZE
|
||||||
|
|
||||||
aux extend_filter_LVMTEST
|
aux extend_filter_LVMTEST
|
||||||
@ -86,12 +105,12 @@ lvcreate -an -Zn -l1 -n $lv1 $vg1
|
|||||||
not lvcreate -s -l1 $vg1/$lv1
|
not lvcreate -s -l1 $vg1/$lv1
|
||||||
not lvcreate -s -l3 $vg1/$lv1
|
not lvcreate -s -l3 $vg1/$lv1
|
||||||
lvcreate -s -l30 -n $lv2 $vg1/$lv1
|
lvcreate -s -l30 -n $lv2 $vg1/$lv1
|
||||||
check lv_field $vg1/$lv2 size "12.00k"
|
check lv_field $vg1/$lv2 size "$EXPECT1"
|
||||||
|
|
||||||
not lvcreate -s -c512 -l512 $vg1/$lv1
|
not lvcreate -s -c512 -l512 $vg1/$lv1
|
||||||
lvcreate -s -c128 -l1700 -n $lv3 $vg1/$lv1
|
lvcreate -s -c128 -l1700 -n $lv3 $vg1/$lv1
|
||||||
# 3 * 128
|
# 3 * 128
|
||||||
check lv_field $vg1/$lv3 size "384.00k"
|
check lv_field $vg1/$lv3 size "$EXPECT2"
|
||||||
lvremove -ff $vg1
|
lvremove -ff $vg1
|
||||||
|
|
||||||
lvcreate -aey -l20 $vg1
|
lvcreate -aey -l20 $vg1
|
||||||
@ -110,7 +129,7 @@ lvextend --use-policies $vg1/lvol1
|
|||||||
check lv_field $vg1/lvol1 size "18.00k"
|
check lv_field $vg1/lvol1 size "18.00k"
|
||||||
|
|
||||||
lvextend -l+33 $vg1/lvol1
|
lvextend -l+33 $vg1/lvol1
|
||||||
check lv_field $vg1/lvol1 size "32.00k"
|
check lv_field $vg1/lvol1 size "$EXPECT3"
|
||||||
|
|
||||||
fill 20K
|
fill 20K
|
||||||
lvremove -f $vg1
|
lvremove -f $vg1
|
||||||
@ -138,14 +157,12 @@ fsck -n "$DM_DEV_DIR/$vg1/snap"
|
|||||||
# This test would trigger read of weird percentage for undeleted header
|
# This test would trigger read of weird percentage for undeleted header
|
||||||
# And since older snapshot target counts with metadata sectors
|
# And since older snapshot target counts with metadata sectors
|
||||||
# we have 2 valid results (unsure about correct version number)
|
# we have 2 valid results (unsure about correct version number)
|
||||||
EXPECT="0.00"
|
check lv_field $vg1/snap data_percent "$EXPECT4"
|
||||||
aux target_at_least dm-snapshot 1 10 0 || EXPECT="66.67"
|
|
||||||
check lv_field $vg1/snap data_percent "$EXPECT"
|
|
||||||
|
|
||||||
vgremove -ff $vg1
|
vgremove -ff $vg1
|
||||||
|
|
||||||
# Can't test >= 16T devices on 32bit
|
# Can't test >= 16T devices on 32bit
|
||||||
if test "$TSIZE" -eq 15P ; then
|
if test "$TSIZE" = 15P ; then
|
||||||
|
|
||||||
# Check usability with largest extent size
|
# Check usability with largest extent size
|
||||||
pvcreate "$DM_DEV_DIR/$vg/$lv"
|
pvcreate "$DM_DEV_DIR/$vg/$lv"
|
||||||
|
Loading…
Reference in New Issue
Block a user