generic: Check the stx_attributes settable by chattr

Check the stx_attributes that can be set by calling chattr.

The script probes the filesystem with chattr to find out which of
+a, +c, +d and +i are supported before testing combinations of
attrs.  Note that if a filesystem supports chattr with these, but
doesn't paste the flag values into stx_attributes, the test will
fail as there's no way to distinguish cleared from unset.

Certain chattr flags are reflected in specific stx_attributes flags:

	chattr flag	stx_attributes flag
	+a		STATX_ATTR_APPEND
	+c		STATX_ATTR_COMPRESSED
	+d		STATX_ATTR_NODUMP
	+i		STATX_ATTR_IMMUTABLE

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
David Howells
2017-04-10 14:33:12 +01:00
committed by Eryu Guan
parent b22a8fe0c7
commit c3ff9ee3fe
5 changed files with 250 additions and 1 deletions
+21 -1
View File
@@ -12,7 +12,11 @@ they have. This is done with _require_<xxx> macros, which may take parameters.
_require_test_program <name>
_require_xfs_io_command <name> [<switch>]
(2) System call requirements.
(2) Filesystem capability requirements.
_require_chattr <letters>
(3) System call requirements.
_require_statx
@@ -67,6 +71,22 @@ _require_xfs_io_command <name> [<switch>]
the +x and -x arguments (DAX attribute).
==================================
FILESYSTEM CAPABILITY REQUIREMENTS
==================================
_require_chattr <letters>
The test requires that the filesystem attribute set by the chattr command
with +<letters> as an argument be available and supported by the $TEST_DEV
filesystem. No check is made of the scratch filesystem. For example:
_require_chattr ai
tests to see if setting the append-only and immutable attributes on a file
(chattr +a +i) is supported.
========================
SYSTEM CALL REQUIREMENTS
========================