diff mbox series

[05/11] generic/050: adapt for parent pointers

Message ID 168506060915.3732476.5106446538351117289.stgit@frogsfrogsfrogs (mailing list archive)
State New, archived
Headers show
Series [01/11] xfs/206: filter out the parent= status from mkfs | expand

Commit Message

Darrick J. Wong May 26, 2023, 2:03 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Fix this test when quotas and parent pointers are enabled.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/generic/050                    |   20 ++++++++++++++++++--
 tests/generic/050.cfg                |    1 +
 tests/generic/050.out.xfsquotaparent |   23 +++++++++++++++++++++++
 3 files changed, 42 insertions(+), 2 deletions(-)
 create mode 100644 tests/generic/050.out.xfsquotaparent
diff mbox series

Patch

diff --git a/tests/generic/050 b/tests/generic/050
index 0664f8c0e4..0edeeee10a 100755
--- a/tests/generic/050
+++ b/tests/generic/050
@@ -33,9 +33,25 @@  features=""
 if ! _has_metadata_journaling $SCRATCH_DEV >/dev/null; then
 	features="nojournal"
 elif [ "$FSTYP" = "xfs" ] && echo "$MOUNT_OPTIONS" | grep -q quota ; then
-	# Mounting with quota on XFS requires a writable fs, which means
-	# we expect to fail the ro blockdev test with with EPERM.
+	# *Trying* to mount with quota on XFS requires a writable fs, which
+	# means we expect to fail the ro blockdev test with with EPERM.  It
+	# doesn't matter if xfs_mount would ultimately decide that quota is not
+	# supported.
 	features="xfsquota"
+
+	if _xfs_has_feature $SCRATCH_DEV parent && \
+	   ! _xfs_has_feature $SCRATCH_DEV realtime; then
+		# If we have quotas and parent pointers enabled, the primary
+		# superblock will be written out with the quota flags set when
+		# the logged xattrs log_incompat feature is set.  Hence the
+		# ro-norecovery mount won't fail with EPERM because the ondisk
+		# super's qflags actually match the mount qflags.
+		#
+		# Quota is not supported with realtime; in that case, the
+		# ondisk super's qflags will be zero and hence not match the
+		# mount qflags.  Select 'xfsquota' in that case.
+		features="xfsquotaparent"
+	fi
 fi
 _link_out_file "$features"
 
diff --git a/tests/generic/050.cfg b/tests/generic/050.cfg
index 1d9d60bc69..85924d117d 100644
--- a/tests/generic/050.cfg
+++ b/tests/generic/050.cfg
@@ -1,2 +1,3 @@ 
 nojournal: nojournal
 xfsquota: xfsquota
+xfsquotaparent: xfsquotaparent
diff --git a/tests/generic/050.out.xfsquotaparent b/tests/generic/050.out.xfsquotaparent
new file mode 100644
index 0000000000..b341aca5be
--- /dev/null
+++ b/tests/generic/050.out.xfsquotaparent
@@ -0,0 +1,23 @@ 
+QA output created by 050
+setting device read-only
+mounting read-only block device:
+mount: SCRATCH_MNT: permission denied
+unmounting read-only filesystem
+umount: SCRATCH_DEV: not mounted
+setting device read-write
+mounting read-write block device:
+touch files
+going down:
+unmounting shutdown filesystem:
+setting device read-only
+mounting filesystem that needs recovery on a read-only device:
+mount: device write-protected, mounting read-only
+mount: cannot mount device read-only
+unmounting read-only filesystem
+umount: SCRATCH_DEV: not mounted
+mounting filesystem with -o norecovery on a read-only device:
+mount: device write-protected, mounting read-only
+unmounting read-only filesystem
+setting device read-write
+mounting filesystem that needs recovery with -o ro:
+*** done