ZTS: Fix faulty slog_replay_fs_001 test

This test is supposed to verify zil operations. For TX_WRITE, writes
must be synchronous in order to be entered in the zil. Linux seems to
be doing sync writes even when they are not asked for, but on FreeBSD
the test does not do what is intended.

Use dd oflag=sync for the parts of this test that are supposed to
result in TX_WRITE zil entries.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #10022
This commit is contained in:
Ryan Moeller 2020-02-20 11:11:51 -05:00 committed by GitHub
parent 65635c3403
commit 325a551232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -108,12 +108,15 @@ log_must rmdir /$TESTPOOL/$TESTFS/dir_to_delete
# Create a simple validation payload
log_must mkdir -p $TESTDIR
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/payload bs=1k count=8
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/payload \
oflag=sync bs=1k count=8
typeset checksum=$(sha256digest /$TESTPOOL/$TESTFS/payload)
# TX_WRITE (small file with ordering)
log_must mkfile 1k /$TESTPOOL/$TESTFS/small_file
log_must mkfile 512b /$TESTPOOL/$TESTFS/small_file
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/small_file \
oflag=sync bs=1k count=1
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/small_file \
oflag=sync bs=512 count=1
# TX_CREATE, TX_MKDIR, TX_REMOVE, TX_RMDIR
log_must cp -R /usr/share/dict /$TESTPOOL/$TESTFS
@ -135,18 +138,23 @@ log_must truncate -s 0 /$TESTPOOL/$TESTFS/truncated_file
# TX_WRITE (large file)
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/large \
bs=128k count=64 oflag=sync
oflag=sync bs=128k count=64
# Write zeros, which compress to holes, in the middle of a file
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/holes.1 bs=128k count=8
log_must dd if=/dev/zero of=/$TESTPOOL/$TESTFS/holes.1 bs=128k count=2
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/holes.1 \
oflag=sync bs=128k count=8
log_must dd if=/dev/zero of=/$TESTPOOL/$TESTFS/holes.1 \
oflag=sync bs=128k count=2
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/holes.2 bs=128k count=8
log_must dd if=/dev/zero of=/$TESTPOOL/$TESTFS/holes.2 bs=128k count=2 seek=2
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/holes.2 \
oflag=sync bs=128k count=8
log_must dd if=/dev/zero of=/$TESTPOOL/$TESTFS/holes.2 \
oflag=sync bs=128k count=2 seek=2
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/holes.3 bs=128k count=8
log_must dd if=/dev/zero of=/$TESTPOOL/$TESTFS/holes.3 bs=128k count=2 \
seek=2 conv=notrunc
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/holes.3 \
oflag=sync bs=128k count=8
log_must dd if=/dev/zero of=/$TESTPOOL/$TESTFS/holes.3 \
oflag=sync bs=128k count=2 seek=2 conv=notrunc
# TX_MKXATTR
log_must mkdir /$TESTPOOL/$TESTFS/xattr.dir
@ -161,8 +169,8 @@ log_must rm_xattr tmpattr /$TESTPOOL/$TESTFS/xattr.file
# TX_WRITE, TX_LINK, TX_REMOVE
# Make sure TX_REMOVE won't affect TX_WRITE if file is not destroyed
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/link_and_unlink bs=128k \
count=8
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/link_and_unlink \
oflag=sync bs=128k count=8
log_must ln /$TESTPOOL/$TESTFS/link_and_unlink \
/$TESTPOOL/$TESTFS/link_and_unlink.link
log_must rm /$TESTPOOL/$TESTFS/link_and_unlink.link