generic: check logical-sector sized O_DIRECT
PATCH 1/1 generic: check logical-sector sized O_DIRECT
If the physical sector size is 4096, but the logical sector size is 512, the 512b dio write/read should be allowed.
---
Hi,
This reproducer was written for xfs, I try to make it to be a generic test case for localfs. Current it test passed on xfs, extN and btrfs, the bug can be reproduced on old rhel-6.6 [1]. If it's not right for someone fs, please feel free to tell me.
Thanks,
Zorro
[1]
# ./check generic/888 FSTYP -- xfs (non-debug) PLATFORM -- Linux/x86_64 xxx-xxxxx-xxxxxx 2.6.32-504.el6.x86_64 MKFS_OPTIONS -- -f -bsize=4096 /dev/loop1 MOUNT_OPTIONS -- -o context=system_u:object_r:nfs_t:s0 /dev/loop1 /mnt/scratch
generic/888 - output mismatch (see /root/xfstests-dev/results//generic/888.out.bad)
--- tests/generic/888.out 2022-11-06 23:42:44.683040977 -0500
+++ /root/xfstests-dev/results//generic/888.out.bad 2022-11-06 23:48:33.986481844 -0500
@@ -4,3 +4,4 @@
512
mkfs and mount
DIO read/write 512 bytes
+pwrite64: Invalid argument
...
(Run 'diff -u tests/generic/888.out /root/xfstests-dev/results//generic/888.out.bad' to see the entire diff)Ran: generic/888
Failures: generic/888
Failed 1 of 1 tests
tests/generic/888 | 52 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/888.out | 6 +++++ 2 files changed, 58 insertions(+) create mode 100755 tests/generic/888 create mode 100644 tests/generic/888.out
tests/generic/888 new file +52 -0
@@ -0,0 +1,52 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 888 +# +# Make sure logical-sector sized O_DIRECT write is allowed +# +. ./common/preamble +_begin_fstest auto quick + +# Override the default cleanup function. +_cleanup() +{ + cd / + rm -r -f $tmp.* + [ -d "$SCSI_DEBUG_MNT" ] && $UMOUNT_PROG $SCSI_DEBUG_MNT 2>/dev/null + _put_scsi_debug_dev +} + +# Import common functions. +. ./common/scsi_debug + +# real QA test starts here +_supported_fs generic +_fixed_by_kernel_commit 7c71ee78031c "xfs: allow logical-sector sized O_DIRECT" +_require_scsi_debug +# If TEST_DEV is block device, make sure current fs is a localfs which can be +# written on scsi_debug device +_require_test +_require_block_device $TEST_DEV + +echo "Get a device with 4096 physical sector size and 512 logical sector size" +SCSI_DEBUG_DEV=`_get_scsi_debug_dev 4096 512 0 256` +blockdev --getpbsz --getss $SCSI_DEBUG_DEV + +echo "mkfs and mount" +_mkfs_dev $SCSI_DEBUG_DEV || _fail "Can't make $FSTYP on scsi_debug device" +SCSI_DEBUG_MNT="$TEST_DIR/scsi_debug_$seq" +rm -rf $SCSI_DEBUG_MNT +mkdir $SCSI_DEBUG_MNT +run_check _mount $SCSI_DEBUG_DEV $SCSI_DEBUG_MNT + +echo "DIO read/write 512 bytes" +# This dio write should succeed, even the physical sector size is 4096, but +# the logical sector size is 512 +$XFS_IO_PROG -d -f -c "pwrite 0 512" $SCSI_DEBUG_MNT/testfile >> $seqres.full +$XFS_IO_PROG -d -c "pread 0 512" $SCSI_DEBUG_MNT/testfile >> $seqres.full + +# success, all done +status=0 +exit
tests/generic/888.out new file +6 -0
@@ -0,0 +1,6 @@ +QA output created by 888 +Get a device with 4096 physical sector size and 512 logical sector size +4096 +512 +mkfs and mount +DIO read/write 512 bytes
Signature · 1 line
2.31.1
Quoted 5 lines · Zorro Lang
If the physical sector size is 4096, but the logical sector size is 512, the 512b dio write/read should be allowed.
Signed-off-by Zorro Lang <[email protected]>---
Looks good to me.
Signature · 1 line
- Andrey
Quoted 2 lines · Zorro Lang
If the physical sector size is 4096, but the logical sector size is 512, the 512b dio write/read should be allowed.
Huh, did we all completely forget to review this patch?
Quoted 67 lines
Signed-off-by Zorro Lang <[email protected]>---
Hi,
This reproducer was written for xfs, I try to make it to be a generic test case for localfs. Current it test passed on xfs, extN and btrfs, the bug can be reproduced on old rhel-6.6 [1]. If it's not right for someone fs, please feel free to tell me.
Thanks,
Zorro[1]
# ./check generic/888 FSTYP -- xfs (non-debug) PLATFORM -- Linux/x86_64 xxx-xxxxx-xxxxxx 2.6.32-504.el6.x86_64 MKFS_OPTIONS -- -f -bsize=4096 /dev/loop1 MOUNT_OPTIONS -- -o context=system_u:object_r:nfs_t:s0 /dev/loop1 /mnt/scratchgeneric/888 - output mismatch (see
/root/xfstests-dev/results//generic/888.out.bad)--- tests/generic/888.out 2022-11-06 23:42:44.683040977 -0500 +++ /root/xfstests-dev/results//generic/888.out.bad 2022-11-06 23:48:33.986481844 -0500 @@ -4,3 +4,4 @@ 512 mkfs and mount DIO read/write 512 bytes +pwrite64: Invalid argument ... (Run 'diff -u tests/generic/888.out /root/xfstests-dev/results//generic/888.out.bad' to see the entire diff)Ran: generic/888
Failures: generic/888
Failed 1 of 1 teststests/generic/888 | 52 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/888.out | 6 +++++ 2 files changed, 58 insertions(+) create mode 100755 tests/generic/888 create mode 100644 tests/generic/888.outtests/generic/888 new file +21
-0@@ -0,0 +1,52 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 888 +# +# Make sure logical-sector sized O_DIRECT write is allowed +# +. ./common/preamble +_begin_fstest auto quick + +# Override the default cleanup function. +_cleanup() +{ + cd / + rm -r -f $tmp.* + [ -d "$SCSI_DEBUG_MNT" ] && $UMOUNT_PROG $SCSI_DEBUG_MNT 2>/dev/null + _put_scsi_debug_dev +} + +# Import common functions.
tests/generic/888 line 31
Quoted 10 lines
tests/generic/888 new file +10
-0+. ./common/scsi_debug + +# real QA test starts here +_supported_fs generic +_fixed_by_kernel_commit 7c71ee78031c "xfs: allow logical-sector sized O_DIRECT" +_require_scsi_debug +# If TEST_DEV is block device, make sure current fs is a localfs which can be +# written on scsi_debug device +_require_test +_require_block_device $TEST_DEV
_require_odirect?
tests/generic/888 line 42
Quoted 11 lines
tests/generic/888 new file +11
-0+ +echo "Get a device with 4096 physical sector size and 512 logical sector size" +SCSI_DEBUG_DEV=`_get_scsi_debug_dev 4096 512 0 256` +blockdev --getpbsz --getss $SCSI_DEBUG_DEV + +echo "mkfs and mount" +_mkfs_dev $SCSI_DEBUG_DEV || _fail "Can't make $FSTYP on scsi_debug device" +SCSI_DEBUG_MNT="$TEST_DIR/scsi_debug_$seq" +rm -rf $SCSI_DEBUG_MNT +mkdir $SCSI_DEBUG_MNT +run_check _mount $SCSI_DEBUG_DEV $SCSI_DEBUG_MNT
/me wonders, should we try to use $MKFS_OPTIONS and $MOUNT_OPTIONS on the scsidebug device? To catch cases where the config actually matters for that kind of thing?
--D
Quoted 25 lines
tests/generic/888 new file +10
-0+ +echo "DIO read/write 512 bytes" +# This dio write should succeed, even the physical sector size is 4096, but +# the logical sector size is 512 +$XFS_IO_PROG -d -f -c "pwrite 0 512" $SCSI_DEBUG_MNT/testfile >> $seqres.full +$XFS_IO_PROG -d -c "pread 0 512" $SCSI_DEBUG_MNT/testfile >> $seqres.full + +# success, all done +status=0 +exittests/generic/888.out new file +6
-0@@ -0,0 +1,6 @@ +QA output created by 888 +Get a device with 4096 physical sector size and 512 logical sector size +4096 +512 +mkfs and mount +DIO read/write 512 bytesSignature · 1 line
2.31.1
Quoted 5 lines · Darrick J. Wong
Quoted 2 lines · Zorro Lang
If the physical sector size is 4096, but the logical sector size is 512, the 512b dio write/read should be allowed.
Huh, did we all completely forget to review this patch?
Looks like it. The test also is a bit overzealous as for copy on write file systems we can't do logical sector size aligned writes, e.g. btrfs or always_cow xfs. So we'll need to find a way to check for those cases.
Quoted 5 lines · Darrick J. Wong
Quoted 2 lines · Zorro Lang
If the physical sector size is 4096, but the logical sector size is 512, the 512b dio write/read should be allowed.
Huh, did we all completely forget to review this patch?
Hmm?? This patch has been reviewed and merged in 2022, refer to g/704. Why did it appear (be refreshed) at here suddenly ?
Quoted 81 lines
Quoted 68 lines
Signed-off-by Zorro Lang <[email protected]>---
Hi,
This reproducer was written for xfs, I try to make it to be a generic test case for localfs. Current it test passed on xfs, extN and btrfs, the bug can be reproduced on old rhel-6.6 [1]. If it's not right for someone fs, please feel free to tell me.
Thanks,
Zorro[1]
# ./check generic/888 FSTYP -- xfs (non-debug) PLATFORM -- Linux/x86_64 xxx-xxxxx-xxxxxx 2.6.32-504.el6.x86_64 MKFS_OPTIONS -- -f -bsize=4096 /dev/loop1 MOUNT_OPTIONS -- -o context=system_u:object_r:nfs_t:s0 /dev/loop1 /mnt/scratchgeneric/888 - output mismatch (see
/root/xfstests-dev/results//generic/888.out.bad)--- tests/generic/888.out 2022-11-06 23:42:44.683040977 -0500 +++ /root/xfstests-dev/results//generic/888.out.bad 2022-11-06 23:48:33.986481844 -0500 @@ -4,3 +4,4 @@ 512 mkfs and mount DIO read/write 512 bytes +pwrite64: Invalid argument ... (Run 'diff -u tests/generic/888.out /root/xfstests-dev/results//generic/888.out.bad' to see the entire diff)Ran: generic/888
Failures: generic/888
Failed 1 of 1 teststests/generic/888 | 52 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/888.out | 6 +++++ 2 files changed, 58 insertions(+) create mode 100755 tests/generic/888 create mode 100644 tests/generic/888.outtests/generic/888 new file +21
-0@@ -0,0 +1,52 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 888 +# +# Make sure logical-sector sized O_DIRECT write is allowed +# +. ./common/preamble +_begin_fstest auto quick + +# Override the default cleanup function. +_cleanup() +{ + cd / + rm -r -f $tmp.* + [ -d "$SCSI_DEBUG_MNT" ] && $UMOUNT_PROG $SCSI_DEBUG_MNT 2>/dev/null + _put_scsi_debug_dev +} + +# Import common functions.tests/generic/888 line 31
Quoted 10 lines
tests/generic/888 new file +10
-0+. ./common/scsi_debug + +# real QA test starts here +_supported_fs generic +_fixed_by_kernel_commit 7c71ee78031c "xfs: allow logical-sector sized O_DIRECT" +_require_scsi_debug +# If TEST_DEV is block device, make sure current fs is a localfs which can be +# written on scsi_debug device +_require_test +_require_block_device $TEST_DEV
_require_odirect?
Quoted 15 lines
tests/generic/888 line 42
Quoted 11 lines
tests/generic/888 new file +11
-0+ +echo "Get a device with 4096 physical sector size and 512 logical sector size" +SCSI_DEBUG_DEV=`_get_scsi_debug_dev 4096 512 0 256` +blockdev --getpbsz --getss $SCSI_DEBUG_DEV + +echo "mkfs and mount" +_mkfs_dev $SCSI_DEBUG_DEV || _fail "Can't make $FSTYP on scsi_debug device" +SCSI_DEBUG_MNT="$TEST_DIR/scsi_debug_$seq" +rm -rf $SCSI_DEBUG_MNT +mkdir $SCSI_DEBUG_MNT +run_check _mount $SCSI_DEBUG_DEV $SCSI_DEBUG_MNT/me wonders, should we try to use $MKFS_OPTIONS and $MOUNT_OPTIONS on the scsidebug device? To catch cases where the config actually matters for that kind of thing?
It's been merged, if we need to change something, better to send a new patch to change that :)
Thanks,
Zorro
Quoted 29 lines
--D
Quoted 25 lines
tests/generic/888 new file +10
-0+ +echo "DIO read/write 512 bytes" +# This dio write should succeed, even the physical sector size is 4096, but +# the logical sector size is 512 +$XFS_IO_PROG -d -f -c "pwrite 0 512" $SCSI_DEBUG_MNT/testfile >> $seqres.full +$XFS_IO_PROG -d -c "pread 0 512" $SCSI_DEBUG_MNT/testfile >> $seqres.full + +# success, all done +status=0 +exittests/generic/888.out new file +6
-0@@ -0,0 +1,6 @@ +QA output created by 888 +Get a device with 4096 physical sector size and 512 logical sector size +4096 +512 +mkfs and mount +DIO read/write 512 bytesSignature · 1 line
2.31.1
Quoted 9 lines · Zorro Lang
Quoted 5 lines · Darrick J. Wong
Quoted 2 lines · Zorro Lang
If the physical sector size is 4096, but the logical sector size is 512, the 512b dio write/read should be allowed.
Huh, did we all completely forget to review this patch?
Hmm?? This patch has been reviewed and merged in 2022, refer to g/704. Why did it appear (be refreshed) at here suddenly ?
Doh!
Sorry, I saw this patch sitting by itself with no replies or "Hey I merged this" messages and thought we'd forgotten it.
And if it's running without problems (I haven't seen any in generic/704) then I'll leave well enough alone.
--D
Quoted 133 lines
Quoted 81 lines
Quoted 68 lines
Signed-off-by Zorro Lang <[email protected]>---
Hi,
This reproducer was written for xfs, I try to make it to be a generic test case for localfs. Current it test passed on xfs, extN and btrfs, the bug can be reproduced on old rhel-6.6 [1]. If it's not right for someone fs, please feel free to tell me.
Thanks,
Zorro[1]
# ./check generic/888 FSTYP -- xfs (non-debug) PLATFORM -- Linux/x86_64 xxx-xxxxx-xxxxxx 2.6.32-504.el6.x86_64 MKFS_OPTIONS -- -f -bsize=4096 /dev/loop1 MOUNT_OPTIONS -- -o context=system_u:object_r:nfs_t:s0 /dev/loop1 /mnt/scratchgeneric/888 - output mismatch (see
/root/xfstests-dev/results//generic/888.out.bad)--- tests/generic/888.out 2022-11-06 23:42:44.683040977 -0500 +++ /root/xfstests-dev/results//generic/888.out.bad 2022-11-06 23:48:33.986481844 -0500 @@ -4,3 +4,4 @@ 512 mkfs and mount DIO read/write 512 bytes +pwrite64: Invalid argument ... (Run 'diff -u tests/generic/888.out /root/xfstests-dev/results//generic/888.out.bad' to see the entire diff)Ran: generic/888
Failures: generic/888
Failed 1 of 1 teststests/generic/888 | 52 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/888.out | 6 +++++ 2 files changed, 58 insertions(+) create mode 100755 tests/generic/888 create mode 100644 tests/generic/888.outtests/generic/888 new file +21
-0@@ -0,0 +1,52 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 888 +# +# Make sure logical-sector sized O_DIRECT write is allowed +# +. ./common/preamble +_begin_fstest auto quick + +# Override the default cleanup function. +_cleanup() +{ + cd / + rm -r -f $tmp.* + [ -d "$SCSI_DEBUG_MNT" ] && $UMOUNT_PROG $SCSI_DEBUG_MNT 2>/dev/null + _put_scsi_debug_dev +} + +# Import common functions.tests/generic/888 line 31
Quoted 10 lines
tests/generic/888 new file +10
-0+. ./common/scsi_debug + +# real QA test starts here +_supported_fs generic +_fixed_by_kernel_commit 7c71ee78031c "xfs: allow logical-sector sized O_DIRECT" +_require_scsi_debug +# If TEST_DEV is block device, make sure current fs is a localfs which can be +# written on scsi_debug device +_require_test +_require_block_device $TEST_DEV
_require_odirect?Quoted 15 lines
tests/generic/888 line 42
Quoted 11 lines
tests/generic/888 new file +11
-0+ +echo "Get a device with 4096 physical sector size and 512 logical sector size" +SCSI_DEBUG_DEV=`_get_scsi_debug_dev 4096 512 0 256` +blockdev --getpbsz --getss $SCSI_DEBUG_DEV + +echo "mkfs and mount" +_mkfs_dev $SCSI_DEBUG_DEV || _fail "Can't make $FSTYP on scsi_debug device" +SCSI_DEBUG_MNT="$TEST_DIR/scsi_debug_$seq" +rm -rf $SCSI_DEBUG_MNT +mkdir $SCSI_DEBUG_MNT +run_check _mount $SCSI_DEBUG_DEV $SCSI_DEBUG_MNT/me wonders, should we try to use $MKFS_OPTIONS and $MOUNT_OPTIONS on the scsidebug device? To catch cases where the config actually matters for that kind of thing?
It's been merged, if we need to change something, better to send a new patch to change that :)
Thanks,
ZorroQuoted 29 lines
--D
Quoted 25 lines
tests/generic/888 new file +10
-0+ +echo "DIO read/write 512 bytes" +# This dio write should succeed, even the physical sector size is 4096, but +# the logical sector size is 512 +$XFS_IO_PROG -d -f -c "pwrite 0 512" $SCSI_DEBUG_MNT/testfile >> $seqres.full +$XFS_IO_PROG -d -c "pread 0 512" $SCSI_DEBUG_MNT/testfile >> $seqres.full + +# success, all done +status=0 +exittests/generic/888.out new file +6
-0@@ -0,0 +1,6 @@ +QA output created by 888 +Get a device with 4096 physical sector size and 512 logical sector size +4096 +512 +mkfs and mount +DIO read/write 512 bytesSignature · 1 line
2.31.1
Quoted 8 lines · Darrick J. Wong
Quoted 7 lines · Zorro Lang
Quoted 5 lines · Darrick J. Wong
Quoted 2 lines · Zorro Lang
If the physical sector size is 4096, but the logical sector size is 512, the 512b dio write/read should be allowed.
Huh, did we all completely forget to review this patch?
Quoted 7 lines
Quoted 2 lines
Hmm?? This patch has been reviewed and merged in 2022, refer to g/704. Why did it appear (be refreshed) at here suddenly ?
Doh!
Sorry, I saw this patch sitting by itself with no replies or "Hey I merged this" messages and thought we'd forgotten it.
Thanks for taking care this test :)
There was a RVB for this patch:
https://lore.kernel.org/fstests/[email protected]/
This remind me that I still have some patches in my local branch, they were not merged by some reasons. I'll check if some of them are suitable for now :)
Thanks,
Zorro
Quoted 140 lines
And if it's running without problems (I haven't seen any in generic/704) then I'll leave well enough alone.
--D
Quoted 133 lines
Quoted 81 lines
Quoted 68 lines
Signed-off-by Zorro Lang <[email protected]>---
Hi,
This reproducer was written for xfs, I try to make it to be a generic test case for localfs. Current it test passed on xfs, extN and btrfs, the bug can be reproduced on old rhel-6.6 [1]. If it's not right for someone fs, please feel free to tell me.
Thanks,
Zorro[1]
# ./check generic/888 FSTYP -- xfs (non-debug) PLATFORM -- Linux/x86_64 xxx-xxxxx-xxxxxx 2.6.32-504.el6.x86_64 MKFS_OPTIONS -- -f -bsize=4096 /dev/loop1 MOUNT_OPTIONS -- -o context=system_u:object_r:nfs_t:s0 /dev/loop1 /mnt/scratchgeneric/888 - output mismatch (see
/root/xfstests-dev/results//generic/888.out.bad)--- tests/generic/888.out 2022-11-06 23:42:44.683040977 -0500 +++ /root/xfstests-dev/results//generic/888.out.bad 2022-11-06 23:48:33.986481844 -0500 @@ -4,3 +4,4 @@ 512 mkfs and mount DIO read/write 512 bytes +pwrite64: Invalid argument ... (Run 'diff -u tests/generic/888.out /root/xfstests-dev/results//generic/888.out.bad' to see the entire diff)Ran: generic/888
Failures: generic/888
Failed 1 of 1 teststests/generic/888 | 52 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/888.out | 6 +++++ 2 files changed, 58 insertions(+) create mode 100755 tests/generic/888 create mode 100644 tests/generic/888.outtests/generic/888 new file +21
-0@@ -0,0 +1,52 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 888 +# +# Make sure logical-sector sized O_DIRECT write is allowed +# +. ./common/preamble +_begin_fstest auto quick + +# Override the default cleanup function. +_cleanup() +{ + cd / + rm -r -f $tmp.* + [ -d "$SCSI_DEBUG_MNT" ] && $UMOUNT_PROG $SCSI_DEBUG_MNT 2>/dev/null + _put_scsi_debug_dev +} + +# Import common functions.tests/generic/888 line 31
Quoted 10 lines
tests/generic/888 new file +10
-0+. ./common/scsi_debug + +# real QA test starts here +_supported_fs generic +_fixed_by_kernel_commit 7c71ee78031c "xfs: allow logical-sector sized O_DIRECT" +_require_scsi_debug +# If TEST_DEV is block device, make sure current fs is a localfs which can be +# written on scsi_debug device +_require_test +_require_block_device $TEST_DEV
_require_odirect?Quoted 15 lines
tests/generic/888 line 42
Quoted 11 lines
tests/generic/888 new file +11
-0+ +echo "Get a device with 4096 physical sector size and 512 logical sector size" +SCSI_DEBUG_DEV=`_get_scsi_debug_dev 4096 512 0 256` +blockdev --getpbsz --getss $SCSI_DEBUG_DEV + +echo "mkfs and mount" +_mkfs_dev $SCSI_DEBUG_DEV || _fail "Can't make $FSTYP on scsi_debug device" +SCSI_DEBUG_MNT="$TEST_DIR/scsi_debug_$seq" +rm -rf $SCSI_DEBUG_MNT +mkdir $SCSI_DEBUG_MNT +run_check _mount $SCSI_DEBUG_DEV $SCSI_DEBUG_MNT/me wonders, should we try to use $MKFS_OPTIONS and $MOUNT_OPTIONS on the scsidebug device? To catch cases where the config actually matters for that kind of thing?
It's been merged, if we need to change something, better to send a new patch to change that :)
Thanks,
ZorroQuoted 29 lines
--D
Quoted 25 lines
tests/generic/888 new file +10
-0+ +echo "DIO read/write 512 bytes" +# This dio write should succeed, even the physical sector size is 4096, but +# the logical sector size is 512 +$XFS_IO_PROG -d -f -c "pwrite 0 512" $SCSI_DEBUG_MNT/testfile >> $seqres.full +$XFS_IO_PROG -d -c "pread 0 512" $SCSI_DEBUG_MNT/testfile >> $seqres.full + +# success, all done +status=0 +exittests/generic/888.out new file +6
-0@@ -0,0 +1,6 @@ +QA output created by 888 +Get a device with 4096 physical sector size and 512 logical sector size +4096 +512 +mkfs and mount +DIO read/write 512 bytesSignature · 1 line
2.31.1
Quoted 14 lines · Zorro Lang
Quoted 13 lines · Darrick J. Wong
Quoted 9 lines · Zorro Lang
Quoted 5 lines · Darrick J. Wong
Quoted 2 lines · Zorro Lang
If the physical sector size is 4096, but the logical sector size is 512, the 512b dio write/read should be allowed.
Huh, did we all completely forget to review this patch?
Hmm?? This patch has been reviewed and merged in 2022, refer to g/704. Why did it appear (be refreshed) at here suddenly ?
Doh!
Quoted 7 lines
Quoted 2 lines
Sorry, I saw this patch sitting by itself with no replies or "Hey I merged this" messages and thought we'd forgotten it.
Thanks for taking care this test :)
There was a RVB for this patch:
https://lore.kernel.org/fstests/[email protected]/
Sorry, it's probably because I somehow dropped CC to linux-xfs
Quoted 149 lines
This remind me that I still have some patches in my local branch, they were not merged by some reasons. I'll check if some of them are suitable for now :)
Thanks,
ZorroQuoted 140 lines
And if it's running without problems (I haven't seen any in generic/704) then I'll leave well enough alone.
--D
Quoted 133 lines
Quoted 81 lines
Quoted 68 lines
Signed-off-by Zorro Lang <[email protected]>---
Hi,
This reproducer was written for xfs, I try to make it to be a generic test case for localfs. Current it test passed on xfs, extN and btrfs, the bug can be reproduced on old rhel-6.6 [1]. If it's not right for someone fs, please feel free to tell me.
Thanks,
Zorro[1]
# ./check generic/888 FSTYP -- xfs (non-debug) PLATFORM -- Linux/x86_64 xxx-xxxxx-xxxxxx 2.6.32-504.el6.x86_64 MKFS_OPTIONS -- -f -bsize=4096 /dev/loop1 MOUNT_OPTIONS -- -o context=system_u:object_r:nfs_t:s0 /dev/loop1 /mnt/scratchgeneric/888 - output mismatch (see
/root/xfstests-dev/results//generic/888.out.bad)--- tests/generic/888.out 2022-11-06 23:42:44.683040977 -0500 +++ /root/xfstests-dev/results//generic/888.out.bad 2022-11-06 23:48:33.986481844 -0500 @@ -4,3 +4,4 @@ 512 mkfs and mount DIO read/write 512 bytes +pwrite64: Invalid argument ... (Run 'diff -u tests/generic/888.out /root/xfstests-dev/results//generic/888.out.bad' to see the entire diff)Ran: generic/888
Failures: generic/888
Failed 1 of 1 teststests/generic/888 | 52 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/888.out | 6 +++++ 2 files changed, 58 insertions(+) create mode 100755 tests/generic/888 create mode 100644 tests/generic/888.outtests/generic/888 new file +21
-0@@ -0,0 +1,52 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 888 +# +# Make sure logical-sector sized O_DIRECT write is allowed +# +. ./common/preamble +_begin_fstest auto quick + +# Override the default cleanup function. +_cleanup() +{ + cd / + rm -r -f $tmp.* + [ -d "$SCSI_DEBUG_MNT" ] && $UMOUNT_PROG $SCSI_DEBUG_MNT 2>/dev/null + _put_scsi_debug_dev +} + +# Import common functions.tests/generic/888 line 31
Quoted 10 lines
tests/generic/888 new file +10
-0+. ./common/scsi_debug + +# real QA test starts here +_supported_fs generic +_fixed_by_kernel_commit 7c71ee78031c "xfs: allow logical-sector sized O_DIRECT" +_require_scsi_debug +# If TEST_DEV is block device, make sure current fs is a localfs which can be +# written on scsi_debug device +_require_test +_require_block_device $TEST_DEV
_require_odirect?Quoted 15 lines
tests/generic/888 line 42
Quoted 11 lines
tests/generic/888 new file +11
-0+ +echo "Get a device with 4096 physical sector size and 512 logical sector size" +SCSI_DEBUG_DEV=`_get_scsi_debug_dev 4096 512 0 256` +blockdev --getpbsz --getss $SCSI_DEBUG_DEV + +echo "mkfs and mount" +_mkfs_dev $SCSI_DEBUG_DEV || _fail "Can't make $FSTYP on scsi_debug device" +SCSI_DEBUG_MNT="$TEST_DIR/scsi_debug_$seq" +rm -rf $SCSI_DEBUG_MNT +mkdir $SCSI_DEBUG_MNT +run_check _mount $SCSI_DEBUG_DEV $SCSI_DEBUG_MNT/me wonders, should we try to use $MKFS_OPTIONS and $MOUNT_OPTIONS on the scsidebug device? To catch cases where the config actually matters for that kind of thing?
It's been merged, if we need to change something, better to send a new patch to change that :)
Thanks,
ZorroQuoted 29 lines
--D
Quoted 25 lines
tests/generic/888 new file +10
-0+ +echo "DIO read/write 512 bytes" +# This dio write should succeed, even the physical sector size is 4096, but +# the logical sector size is 512 +$XFS_IO_PROG -d -f -c "pwrite 0 512" $SCSI_DEBUG_MNT/testfile >> $seqres.full +$XFS_IO_PROG -d -c "pread 0 512" $SCSI_DEBUG_MNT/testfile >> $seqres.full + +# success, all done +status=0 +exittests/generic/888.out new file +6
-0@@ -0,0 +1,6 @@ +QA output created by 888 +Get a device with 4096 physical sector size and 512 logical sector size +4096 +512 +mkfs and mount +DIO read/write 512 bytesSignature · 1 line
2.31.1
Signature · 1 line
- Andrey