From d64dcd257513a9bff6368541e0c19cd6b3c986b1 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 18 May 2026 12:19:24 -0700 Subject: [PATCH] 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 Reviewed-by: George Melikov Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #18547 --- .../tests/functional/stat/statx_dioalign.ksh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/zfs-tests/tests/functional/stat/statx_dioalign.ksh b/tests/zfs-tests/tests/functional/stat/statx_dioalign.ksh index ab749b5f793..ea10e492503 100755 --- a/tests/zfs-tests/tests/functional/stat/statx_dioalign.ksh +++ b/tests/zfs-tests/tests/functional/stat/statx_dioalign.ksh @@ -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