common: ext4 doesn't support O_DIRECT with encryption
PATCH 1/1 common: ext4 doesn't support O_DIRECT with encryption
Teach _require_odirect to skip the O_DIRECT tests if the ext4 mount option "test_dummy_encryption" is enabled, since O_DIRECT doesen't make sense when file system level encryption is enabled, and several tests which use O_DIRECT --- ext4/301, ext4/304, generic/250 and generic/252 --- fail when encryption is enabled.
--- common/rc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
common/rc +12 -6
@@ -1933,12 +1933,18 @@ _require_xfs_db_command() # check that kernel and filesystem support direct I/O _require_odirect() { - testfile=$TEST_DIR/$$.direct - $XFS_IO_PROG -F -f -d -c "pwrite 0 20k" $testfile > /dev/null 2>&1 - if [ $? -ne 0 ]; then - _notrun "O_DIRECT is not supported" - fi - rm -f $testfile 2>&1 > /dev/null + if [ $FSTYP = "ext4" ] ; then + if echo "$MOUNT_OPTIONS" | grep -q "test_dummy_encryption" + then + _notrun "ext4 encryption doesn't support O_DIRECT" + fi + fi + testfile=$TEST_DIR/$$.direct + $XFS_IO_PROG -F -f -d -c "pwrite 0 20k" $testfile > /dev/null 2>&1 + if [ $? -ne 0 ]; then + _notrun "O_DIRECT is not supported" + fi + rm -f $testfile 2>&1 > /dev/null } # Check that a fs has enough free space (in 1024b blocks)
Signature · 1 line
2.5.0
Quoted 18 lines · Theodore Ts'o
Teach
_require_odirectto skip theO_DIRECTtests if the ext4 mount option "test_dummy_encryption" is enabled, sinceO_DIRECTdoesen't make sense when file system level encryption is enabled, and several tests which useO_DIRECT--- ext4/301, ext4/304, generic/250 and generic/252 --- fail when encryption is enabled.Signed-off-by Theodore Ts'o <[email protected]>--- common/rc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)common/rc +0
-0@@ -1933,12 +1933,18 @@ _require_xfs_db_command() # check that kernel and filesystem support direct I/O _require_odirect()
common/rc _require_xfs_db_command() · line 1938
Quoted 10 lines
common/rc +3
-6{ - testfile=$TEST_DIR/$$.direct - $XFS_IO_PROG -F -f -d -c "pwrite 0 20k" $testfile > /dev/null 2>&1 - if [ $? -ne 0 ]; then - _notrun "O_DIRECT is not supported" - fi - rm -f $testfile 2>&1 > /dev/null + if [ $FSTYP = "ext4" ] ; then + if echo "$MOUNT_OPTIONS" | grep -q "test_dummy_encryption" + then
I moved 'then' to the end of above line (if ....; then) and queued it up
Quoted 19 lines
common/rc +9
-0+ _notrun "ext4 encryption doesn't support O_DIRECT" + fi + fi + testfile=$TEST_DIR/$$.direct + $XFS_IO_PROG -F -f -d -c "pwrite 0 20k" $testfile > /dev/null 2>&1 + if [ $? -ne 0 ]; then + _notrun "O_DIRECT is not supported" + fi + rm -f $testfile 2>&1 > /dev/null } # Check that a fs has enough free space (in 1024b blocks)Signature · 6 lines
2.5.0 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · Theodore Ts'o
Teach
_require_odirectto skip theO_DIRECTtests if the ext4 mount option "test_dummy_encryption" is enabled, sinceO_DIRECTdoesen't make sense when file system level encryption is enabled, and several tests which useO_DIRECT--- ext4/301, ext4/304, generic/250 and generic/252 --- fail when encryption is enabled.
Stupid question: why isn't ext4 simply falling back to buffered IO when encryption is enabled on a file? This seems kind of strange to have direct IO conditionally supported based on mkfs/mount parameters (or perhaps even per-file configurations)....
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]