ZTS: statx_dioalign.ksh update to stride_dd

The uutils 0.8.0 version of dd appears to diverge from GNU behavior
and does not fail when an unaligned write O_DIRECT write is issued.
Update the test case to use stride_dd which is provided by the ZTS
so the expected syscall behavior can be verified.

Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #18547
This commit is contained in:
Brian Behlendorf
2026-05-18 12:19:24 -07:00
parent c59d690e56
commit d64dcd2575
@@ -89,7 +89,8 @@ typeset -i PAGE_SIZE=$(getconf PAGE_SIZE)
# Set recordsize to 128K, and make a 64K file (so only one block) for the
# sizing tests below.
log_must zfs set recordsize=128K $TESTDS
log_must dd if=/dev/urandom of=$TESTFILE bs=64k count=1
log_must rm -f $TESTFILE
log_must stride_dd -i /dev/urandom -o $TESTFILE -b 65536 -c 1
log_must zpool sync
# when DIO is disabled via tunable, statx will not return the dioalign result
@@ -141,7 +142,7 @@ done
# Now we extend the file into its second block. This effectively locks in its
# block size, which will always be returned regardless of recordsize changes.
log_must zfs set recordsize=128K $TESTDS
log_must dd if=/dev/urandom of=$TESTFILE bs=192K count=1
log_must stride_dd -i /dev/urandom -o $TESTFILE -b 196608 -c 1
log_must zpool sync
# Confirm that no matter how we change the recordsize, the alignment remains at
@@ -167,14 +168,14 @@ log_must rm -f $TESTFILE
log_must touch $TESTFILE
log_must zpool sync
assert_dioalign $TESTFILE $PAGE_SIZE 16384
log_must dd if=/dev/urandom of=$TESTFILE bs=16384 count=16 oflag=direct
log_must stride_dd -i /dev/urandom -o $TESTFILE -b 16384 -c 16 -D
# same again, but writing with incorrect alignment, which should fail.
log_must rm -f $TESTFILE
log_must touch $TESTFILE
log_must zpool sync
assert_dioalign $TESTFILE $PAGE_SIZE 16384
log_mustnot dd if=/dev/urandom of=$TESTFILE bs=1024 count=256 oflag=direct
log_mustnot stride_dd -i /dev/urandom -o $TESTFILE -b 1024 -c 256 -D
# same again, but without strict, which should succeed.
log_must set_tunable32 DIO_STRICT 0
@@ -182,6 +183,6 @@ log_must rm -f $TESTFILE
log_must touch $TESTFILE
log_must zpool sync
assert_dioalign $TESTFILE $PAGE_SIZE 16384
log_must dd if=/dev/urandom of=$TESTFILE bs=1024 count=256 oflag=direct
log_must stride_dd -i /dev/urandom -o $TESTFILE -b 1024 -c 256 -D
log_pass $CLAIM