From 325a551232cb714cebf167d327d512a64256bcd0 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Thu, 20 Feb 2020 11:11:51 -0500 Subject: 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 Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #10022 --- .../tests/functional/slog/slog_replay_fs_001.ksh | 34 +++++++++++++--------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'tests/zfs-tests') diff --git a/tests/zfs-tests/tests/functional/slog/slog_replay_fs_001.ksh b/tests/zfs-tests/tests/functional/slog/slog_replay_fs_001.ksh index 182033777..0b78a099f 100755 --- a/tests/zfs-tests/tests/functional/slog/slog_replay_fs_001.ksh +++ b/tests/zfs-tests/tests/functional/slog/slog_replay_fs_001.ksh @@ -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 -- cgit v1.2.3