generic/607: don't break on filesystems that don't support FSGETXATTR on dirs
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 15 Sep 2020 01:43:15 +0000 (18:43 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 20 Sep 2020 16:40:04 +0000 (00:40 +0800)
This test requires that the filesystem support calling FSGETXATTR on
regular files and directories to make sure the FS_XFLAG_DAX flag works.
The _require_xfs_io_command tests a regular file but doesn't check
directories, so generic/607 should do that itself.  Also fix some typos.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/rc
tests/generic/607

index 807a1f6ca225c5b5fbbde1af7a62f4e1f55ff929..4bee0c8859f7b27a04a8cf3684153750b74260c2 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -2163,6 +2163,12 @@ _require_xfs_io_command()
        local testfile=$TEST_DIR/$$.xfs_io
        local testio
        case $command in
+       "lsattr")
+               # Test xfs_io lsattr support and filesystem FS_IOC_FSSETXATTR
+               # support.
+               testio=`$XFS_IO_PROG -F -f -c "lsattr $param" $testfile 2>&1`
+               param_checked="$param"
+               ;;
        "chattr")
                local testdir=$TEST_DIR/$$.attr_dir
                mkdir $TEST_DIR/$$.attr_dir
@@ -3230,7 +3236,7 @@ _check_s_dax()
        if [ $exp_s_dax -eq 0 ]; then
                (( attributes & 0x2000 )) && echo "$target has unexpected S_DAX flag"
        else
-               (( attributes & 0x2000 )) || echo "$target doen't have expected S_DAX flag"
+               (( attributes & 0x2000 )) || echo "$target doesn't have expected S_DAX flag"
        fi
 }
 
@@ -3242,7 +3248,7 @@ _check_xflag()
        if [ $exp_xflag -eq 0 ]; then
                _test_inode_flag dax $target && echo "$target has unexpected FS_XFLAG_DAX flag"
        else
-               _test_inode_flag dax $target || echo "$target doen't have expected FS_XFLAG_DAX flag"
+               _test_inode_flag dax $target || echo "$target doesn't have expected FS_XFLAG_DAX flag"
        fi
 }
 
index b15085eab32a99e72fc0a0670bb653a37e2beb52..14d2c05f8365ff74d30d639d430ed54737a6f8e9 100755 (executable)
@@ -38,6 +38,11 @@ _require_scratch
 _require_dax_iflag
 _require_xfs_io_command "lsattr" "-v"
 
+# Make sure we can call FSGETXATTR on a directory...
+output="$($XFS_IO_PROG -c "lsattr -v" $TEST_DIR 2>&1)"
+echo "$output" | grep -q "Inappropriate ioctl for device" && \
+       _notrun "$FSTYP: FSGETXATTR not supported on directories."
+
 # If a/ is +x, check that a's new children
 # inherit +x from a/.
 test_xflag_inheritance1()