public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] common/rc: Check 'tPnE' flags on a directory instead of a regilar file
@ 2020-09-14  5:13 Xiao Yang
  2020-09-14  5:14 ` [PATCH v2 2/2] common/rc: Add extra check for xfs_io -c "chattr" on XFS Xiao Yang
  2020-09-14  7:26 ` [PATCH v2 1/2] common/rc: Check 'tPnE' flags on a directory instead of a regilar file Christoph Hellwig
  0 siblings, 2 replies; 4+ messages in thread
From: Xiao Yang @ 2020-09-14  5:13 UTC (permalink / raw)
  To: fstests; +Cc: darrick.wong, david, ira.weiny, linux-xfs, guan, Xiao Yang

'tPnE' flags are only valid for a directory so check them on a directory.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 common/rc | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/common/rc b/common/rc
index aa5a7409..6487b9f2 100644
--- a/common/rc
+++ b/common/rc
@@ -2163,14 +2163,23 @@ _require_xfs_io_command()
 	local testio
 	case $command in
 	"chattr")
+		local testdir=$TEST_DIR/$$.attr_dir
+		mkdir $TEST_DIR/$$.attr_dir
 		if [ -z "$param" ]; then
 			param=s
 		fi
 		# Test xfs_io chattr support AND
 		# filesystem FS_IOC_FSSETXATTR support
-		testio=`$XFS_IO_PROG -F -f -c "chattr +$param" $testfile 2>&1`
-		$XFS_IO_PROG -F -f -r -c "chattr -$param" $testfile 2>&1
+		# 'tPnE' flags are only valid for a directory so check them on a directory.
+		if echo "$param" | egrep -q 't|P|n|E'; then
+			testio=`$XFS_IO_PROG -F -c "chattr +$param" $testdir 2>&1`
+			$XFS_IO_PROG -F -r -c "chattr -$param" $testdir 2>&1
+		else
+			testio=`$XFS_IO_PROG -F -f -c "chattr +$param" $testfile 2>&1`
+			$XFS_IO_PROG -F -r -c "chattr -$param" $testfile 2>&1
+		fi
 		param_checked="+$param"
+		rm -rf $testdir 2>&1 > /dev/null
 		;;
 	"chproj")
 		testio=`$XFS_IO_PROG -F -f -c "chproj 0" $testfile 2>&1`
-- 
2.21.0




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-17  4:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-14  5:13 [PATCH v2 1/2] common/rc: Check 'tPnE' flags on a directory instead of a regilar file Xiao Yang
2020-09-14  5:14 ` [PATCH v2 2/2] common/rc: Add extra check for xfs_io -c "chattr" on XFS Xiao Yang
2020-09-14  7:26 ` [PATCH v2 1/2] common/rc: Check 'tPnE' flags on a directory instead of a regilar file Christoph Hellwig
2020-09-17  4:05   ` Xiao Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox