mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-29 06:50:38 +03:00
test: use direct I/O when injecting bad data into RAID images
When directly corrupting RAID images for the purpose of testing, we must use direct I/O (or a 'sync' after the 'dd') to ensure that the writes are not caught in the buffer cache in a way that is not reachable by the top-level RAID device.
This commit is contained in:
parent
0362169277
commit
4454a580df
@ -13,7 +13,10 @@
|
||||
|
||||
. lib/test
|
||||
|
||||
aux have_raid 1 5 0 || skip
|
||||
# Proper mismatch count 1.5.2+ upstream, 1.3.5 < x < 1.4.0 in RHEL6
|
||||
aux have_raid 1 3 5 &&
|
||||
! aux have_raid 1 4 0 ||
|
||||
aux have_raid 1 5 2 || skip
|
||||
aux prepare_vg 3
|
||||
|
||||
lvcreate -n $lv1 $vg -l1 --type raid1
|
||||
@ -22,16 +25,7 @@ START=$(get pv_field "$dev2" pe_start --units 1k)
|
||||
METASIZE=$(get lv_field $vg/${lv1}_rmeta_1 size -a --units 1k)
|
||||
SEEK=$((${START%\.00k} + ${METASIZE%\.00k}))
|
||||
# Overwrite some portion of _rimage_1
|
||||
dd if=/dev/urandom of="$dev2" bs=1K count=1 seek=$SEEK
|
||||
|
||||
lvchange --syncaction check $vg/$lv1
|
||||
|
||||
# hmmm it's still in 'dd' buffer and not on real disk ??
|
||||
# anyway skip over with 'should'
|
||||
should check lv_field $vg/$lv1 raid_mismatch_count "128"
|
||||
|
||||
# Ensure it's all on disk now
|
||||
sync
|
||||
dd if=/dev/urandom of="$dev2" bs=1K count=1 seek=$SEEK oflag=direct
|
||||
|
||||
lvchange --syncaction check $vg/$lv1
|
||||
check lv_field $vg/$lv1 raid_mismatch_count "128"
|
||||
|
Loading…
x
Reference in New Issue
Block a user