Skip to contentSkip to conversation

Making xfstests work with the in-kernel AFS filesystem

PATCH New David Howells 1 participant 2 messages Jun 14, 2020

lore
Share & tools
lore
#0 lore raw

Hi,

I've been working on making it possible to use xfstests with the in-kernel AFS filesystem. With a few kernel patches, I've got it down to 17 failing tests from -g quick.

Most of the remaining tests fall into a couple of classes and I wonder what the best way to handle them is:

(1) Features that AFS doesn't support - such as ctime, device files and fifos. I have managed to emulate ctime in the fs driver, but that leaves mknod and mkfifo.

I've tried to modify generic/294 along the lines of generic/050 so that it can have different comparison data depending on whether mknod exists or not, but I can't get it to work. I've supplied a cfg file and an alternate verified output file, but now it just says "no qualified output" and does nothing. I can't see how it's meant to work, and README and the stuff in doc/ doesn't help.

Should I split tests into two where, say, one part does things on regular files, dirs and symlinks and the other does things on more exotic types, such as fifos. generic/423 is a prime example of this.

(2) Differences in security model. Access to AFS is governed primarily by the kerberos ticket in your keyring and is evaluated on the server (which gives you a permissions mask that you can cache) - and not by what your process uid/gid/grouplist say compared to the uid/gid on the file and most of the mode bits are ignored as well.

Any thoughts on this? Should I add more _require_xxx macros for all of these things?

Also, would there be interest in patches to automate some of this from the fsinfo() syscall I've proposed which allows the filesystem indicate its capabilities?

David

#1 lore raw

PATCH 1/1 Add support for AFS

Add AFS support.

---
 build/rpm/xfstests.spec.in   |    4 +-
 check                        |    2 +
 common/config                |   12 ++++++-
 common/rc                    |   71 +++++++++++++++++++++++++++++++++++++++----
 doc/requirement-checking.txt |   24 ++++++++++++++
 tests/generic/294            |   11 +++++-
 tests/generic/294.cfg        |    1 
 tests/generic/294.out.mknod  |    6 +++
 tests/generic/314            |    1 
 tests/generic/317            |    1 
 10 files changed, 123 insertions(+), 10 deletions(-)
build/rpm/xfstests.spec.in +2 -2
index 338e8839..5a35fbf8 100644
@@ -17,8 +17,8 @@ Group: System Environment/Base
 
 %description
 The XFS regression test suite.  Also includes some support for
-acl, attr, dmapi, udf, and nfs testing.  Contains around 200 specific tests
-for userspace & kernelspace.
+acl, attr, dmapi, udf, nfs and afs testing.  Contains around 200 specific
+tests for userspace & kernelspace.
 
 %prep
 if [ -f .census ] ; then
check +2 -0
index 2e148e57..8aba8345 100755
@@ -53,6 +53,7 @@ usage()
 
 check options
     -nfs		test NFS
+    -afs		test AFS
     -glusterfs		test GlusterFS
     -cifs		test CIFS
     -9p			test 9p
@@ -266,6 +267,7 @@ while [ $# -gt 0 ]; do
 	-\? | -h | --help) usage ;;
 
 	-nfs)		FSTYP=nfs ;;
+	-afs)		FSTYP=afs ;;
 	-glusterfs)	FSTYP=glusterfs ;;
 	-cifs)		FSTYP=cifs ;;
 	-9p)		FSTYP=9p ;;
common/config +11 -1
index 8023273d..bc998af7 100644
@@ -255,6 +255,7 @@ case "$HOSTOS" in
 	export BTRFS_TUNE_PROG=$(type -P btrfstune)
 	export XFS_FSR_PROG=$(type -P xfs_fsr)
 	export MKFS_NFS_PROG="false"
+	export MKFS_AFS_PROG="false"
 	export MKFS_CIFS_PROG="false"
 	export MKFS_OVERLAY_PROG="false"
 	export MKFS_REISER4_PROG=$(type -P mkfs.reiser4)
@@ -306,6 +307,9 @@ _mount_opts()
 	nfs)
 		export MOUNT_OPTIONS=$NFS_MOUNT_OPTIONS
 		;;
+	afs)
+		export MOUNT_OPTIONS=$AFS_MOUNT_OPTIONS
+		;;
 	cifs)
 		export MOUNT_OPTIONS=$CIFS_MOUNT_OPTIONS
 		;;
@@ -364,6 +368,9 @@ _test_mount_opts()
 	nfs)
 		export TEST_FS_MOUNT_OPTS=$NFS_MOUNT_OPTIONS
 		;;
+	afs)
+		export TEST_FS_MOUNT_OPTS=$AFS_MOUNT_OPTIONS
+		;;
 	glusterfs)
 		export TEST_FS_MOUNT_OPTS=$GLUSTERFS_MOUNT_OPTIONS
 		;;
@@ -390,6 +397,9 @@ _mkfs_opts()
 	nfs)
 		export MKFS_OPTIONS=$NFS_MKFS_OPTIONS
 		;;
+	afs)
+		export MKFS_OPTIONS=$AFS_MKFS_OPTIONS
+		;;
 	cifs)
 		export MKFS_OPTIONS=$CIFS_MKFS_OPTIONS
 		;;
@@ -487,7 +497,7 @@ _check_device()
 	fi
 
 	case "$FSTYP" in
-	9p|tmpfs|virtiofs)
+	9p|afs|tmpfs|virtiofs)
 		# 9p and virtiofs mount tags are just plain strings, so anything is allowed
 		# tmpfs doesn't use mount source, ignore
 		;;
common/rc +66 -5

149 lines not on this page · raw message

doc/requirement-checking.txt +24 -0
index 45d2756b..c945e16a 100644
@@ -16,6 +16,10 @@ they have.  This is done with _require_<xxx> macros, which may take parameters.
 
 	_require_chattr <letters>
 	_require_exportfs
+	_require_mknod
+	_has_mknod
+	_require_sgid_inheritance
+	_require_use_local_uidgid
 
  (3) System call requirements.
 
@@ -97,6 +101,26 @@ _require_exportfs
      The test also requires the use of the open_by_handle_at() system call and
      will be skipped if it isn't available in the kernel.
 
+_require_mknod
+_has_mknod
+
+     The test requires that the $TEST_DEV filesystem supports mknod(2).
+     _require_mknod will cause the test to be skipped; _has_mknod returns 0 if
+     mknod is supported and 1 otherwise.
+
+_require_sgid_inheritance
+
+     The test required that the $TEST_DEV filesystem supports the inheritance
+     of the SGID bit and the GID from a marked directory.  The test will be
+     skipped if not supported.
+
+_require_use_local_uidgid
+
+     The test requires that the $TEST_DEV filesystem sets the uid and gid of a
+     newly created file to the creating process's fsuid and fsgid.  Remote
+     filesystems, for example, may choose other settings or not even have these
+     concepts available.  The test will be skipped if not supported.
+
 
 ========================
 SYSTEM CALL REQUIREMENTS
tests/generic/294 +9 -2
index 32c89b03..71f861de 100755
@@ -8,6 +8,7 @@
 # we ask to create an already-existing entity on an RO filesystem
 #
 seq=`basename $0`
+seqfull=$0
 seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
 
@@ -34,8 +35,13 @@ _supported_os Linux
 _require_scratch
 _require_symlinks
 
-rm -f $seqres.full
-_scratch_mkfs > $seqres.full 2>&1 || _fail "Could not mkfs scratch device"
+features=""
+if ! _has_mknod; then
+	features="nomknod"
+fi
+_link_out_file "$features"
+
+_scratch_mkfs 2>&1 || _fail "Could not mkfs scratch device"
 
 THIS_TEST_DIR=$SCRATCH_MNT/$seq.test
 
@@ -57,5 +63,6 @@ _try_scratch_mount -o remount,ro || _fail "Could not remount scratch readonly"
 _create_files 2>&1 | _filter_scratch
 
 # success, all done
+rm -f $seqres.full
 status=0
 exit
tests/generic/294.cfg new file +1 -0
new file mode 100644
index 00000000..c0466cde
@@ -0,0 +1 @@
+nomknod: nomknod
tests/generic/294.out.mknod new file +6 -0
new file mode 100644
index 00000000..4aea9d82
@@ -0,0 +1,6 @@
+QA output created by 294
+mknod: SCRATCH_MNT/294.test/testnode: Operation not permitted
+mknod: SCRATCH_MNT/294.test/testnode: Read-only file system
+mkdir: cannot create directory 'SCRATCH_MNT/294.test/testdir': File exists
+touch: cannot touch 'SCRATCH_MNT/294.test/testtarget': Read-only file system
+ln: creating symbolic link 'SCRATCH_MNT/294.test/testlink': File exists
tests/generic/314 +1 -0
index 03df81ce..13fdfc31 100755
@@ -29,6 +29,7 @@ _cleanup()
 _supported_fs generic
 _require_test
 _require_user
+_require_sgid_inheritance
 
 rm -rf $TEST_DIR/$seq-dir
 
tests/generic/317 +1 -0
index 8ea9d81c..45e47a91 100755
@@ -46,6 +46,7 @@ _require_scratch
 _require_user
 _require_ugid_map
 _require_userns
+_require_use_local_uidgid
 qa_user_id=`id -u $qa_user`
 
 _filter_output()