diff mbox series

[v1,1/3] xfs/539: Skip noattr2 remount option on v5 filesystems

Message ID 8704e5bd46d9f8dc37cec2781104704fa7213aa3.1739363803.git.nirjhar.roy.lists@gmail.com (mailing list archive)
State New
Headers show
Series Add mount and remount related tests | expand

Commit Message

Nirjhar Roy (IBM) Feb. 12, 2025, 12:39 p.m. UTC
This test is to verify that repeated warnings are not printed
for default options (attr2, noikeep) and warnings are
printed for non default options (noattr2, ikeep). Remount
with noattr2 fails on a v5 filesystem, so skip the mount option.

Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
---
 tests/xfs/539 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Dave Chinner Feb. 12, 2025, 9:01 p.m. UTC | #1
On Wed, Feb 12, 2025 at 12:39:56PM +0000, Nirjhar Roy (IBM) wrote:
> This test is to verify that repeated warnings are not printed
> for default options (attr2, noikeep) and warnings are
> printed for non default options (noattr2, ikeep). Remount
> with noattr2 fails on a v5 filesystem, so skip the mount option.

Why do we care if remount succeeds or fails? That's not what the
test is exercising.

i.e. We are testing to see if the appropriate deprecation warning
for a deprecated mount option has been issued or not, and that
should happen regardless of whether the mount option is valid or not
for the given filesysetm format....

Hence I don't see any reason for changing the test to exclude
noattr2 testing on v5 filesystems...

-Dave.
Darrick J. Wong Feb. 12, 2025, 9:06 p.m. UTC | #2
On Wed, Feb 12, 2025 at 12:39:56PM +0000, Nirjhar Roy (IBM) wrote:
> This test is to verify that repeated warnings are not printed
> for default options (attr2, noikeep) and warnings are
> printed for non default options (noattr2, ikeep). Remount
> with noattr2 fails on a v5 filesystem, so skip the mount option.
> 
> Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
> ---
>  tests/xfs/539 | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/xfs/539 b/tests/xfs/539
> index b9bb7cc1..58eead67 100755
> --- a/tests/xfs/539
> +++ b/tests/xfs/539
> @@ -42,7 +42,8 @@ echo "Silence is golden."
>  
>  # Skip old kernels that did not print the warning yet
>  log_tag
> -_scratch_mkfs > $seqres.full 2>&1
> +is_v5=true
> +_scratch_mkfs |& grep -q "crc=0" && is_v5=false >> $seqres.full 2>&1

Usually we do this with something more like:

_scratch_mkfs | _filter_mkfs >>$seqres.full 2>$tmp.mkfs
. $tmp.mkfs

if [ $_fs_has_crcs -eq 1 ]; then
	# v5 stuff
else
	# v4 stuff
endif

>  _scratch_mount -o attr2
>  _scratch_unmount
>  check_dmesg_for_since_tag "XFS: attr2 mount option is deprecated" || \
> @@ -60,8 +61,13 @@ for VAR in {attr2,noikeep}; do
>  		echo "Should not be able to find deprecation warning for $VAR"
>  done
>  for VAR in {noattr2,ikeep}; do
> +	if [[ "$VAR" == "noattr2" ]] && $is_v5; then
> +		echo "remount with noattr2 will fail in v5 filesystem. Skip" \
> +			>> $seqres.full
> +		continue

/me wonders if it'd be cleaner to do:

VARS=(ikeep)
test $_fs_has_crcs -eq 0 && VARS+=(noattr2)

for VAR in "${VARS[@]}"; do
	...
done

> +	fi
>  	log_tag
> -	_scratch_remount $VAR
> +    _scratch_remount $VAR >> $seqres.full 2>&1

Nit: Indentation.

--D

>  	check_dmesg_for_since_tag "XFS: $VAR mount option is deprecated" || \
>  		echo "Could not find deprecation warning for $VAR"
>  done
> -- 
> 2.34.1
> 
>
Nirjhar Roy (IBM) Feb. 13, 2025, 10:08 a.m. UTC | #3
On 2/13/25 02:31, Dave Chinner wrote:
> On Wed, Feb 12, 2025 at 12:39:56PM +0000, Nirjhar Roy (IBM) wrote:
>> This test is to verify that repeated warnings are not printed
>> for default options (attr2, noikeep) and warnings are
>> printed for non default options (noattr2, ikeep). Remount
>> with noattr2 fails on a v5 filesystem, so skip the mount option.
> Why do we care if remount succeeds or fails? That's not what the
> test is exercising.
>
> i.e. We are testing to see if the appropriate deprecation warning
> for a deprecated mount option has been issued or not, and that
> should happen regardless of whether the mount option is valid or not
> for the given filesysetm format....

Okay, thank you for the clarification. Also, based on your response on 
patch 3/3, remount with noattr2(or any other invalid remount options), 
should be silently ignored, so this patch won't be necessary. However, 
we have observed failure of the test xfs/539 because remount with 
noattr2 was failing with CONFIG_XFS_SUPPORT_V4=n on v5 xfs and this 
failure looks like a kernel bug. More on this on my reply[1] to your 
comments on patch 3/3.

[1] 
https://lore.kernel.org/all/b43e4cd9-d8aa-4cc0-a5ff-35f2e0553682@gmail.com/

>
> Hence I don't see any reason for changing the test to exclude
> noattr2 testing on v5 filesystems...
>
> -Dave.
diff mbox series

Patch

diff --git a/tests/xfs/539 b/tests/xfs/539
index b9bb7cc1..58eead67 100755
--- a/tests/xfs/539
+++ b/tests/xfs/539
@@ -42,7 +42,8 @@  echo "Silence is golden."
 
 # Skip old kernels that did not print the warning yet
 log_tag
-_scratch_mkfs > $seqres.full 2>&1
+is_v5=true
+_scratch_mkfs |& grep -q "crc=0" && is_v5=false >> $seqres.full 2>&1
 _scratch_mount -o attr2
 _scratch_unmount
 check_dmesg_for_since_tag "XFS: attr2 mount option is deprecated" || \
@@ -60,8 +61,13 @@  for VAR in {attr2,noikeep}; do
 		echo "Should not be able to find deprecation warning for $VAR"
 done
 for VAR in {noattr2,ikeep}; do
+	if [[ "$VAR" == "noattr2" ]] && $is_v5; then
+		echo "remount with noattr2 will fail in v5 filesystem. Skip" \
+			>> $seqres.full
+		continue
+	fi
 	log_tag
-	_scratch_remount $VAR
+    _scratch_remount $VAR >> $seqres.full 2>&1
 	check_dmesg_for_since_tag "XFS: $VAR mount option is deprecated" || \
 		echo "Could not find deprecation warning for $VAR"
 done