Skip to contentSkip to conversation

xfs/528: Add test for printing deprec. mount options

PATCH Superseded Pavel Reichl 2 participants 3 messages Mar 10, 2021 – Mar 18, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs/528: Add test for printing deprec. mount options

Verify that warnings about deprecated mount options are properly printed.

Verify that no excessive warnings are printed during remounts.

---
 tests/xfs/528     | 85 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/528.out |  2 ++
 tests/xfs/group   |  1 +
 3 files changed, 88 insertions(+)
 create mode 100755 tests/xfs/528
 create mode 100644 tests/xfs/528.out
tests/xfs/528 new file +85 -0
new file mode 100755
index 00000000..148f6304
@@ -0,0 +1,85 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Red Hat, Inc.. All Rights Reserved.
+#
+# FS QA Test 528
+#
+# Verify that warnings about deprecated mount options are properly printed.
+#
+# Verify that no excessive warnings are printed during remounts.
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+_require_check_dmesg
+_supported_fs xfs
+_require_scratch
+
+log_tag()
+{
+	echo "fstests $seqnum [tag]" > /dev/kmsg
+}
+
+dmesg_since_test_tag()
+{
+	dmesg | tac | sed -ne "0,\#fstests $seqnum \[tag\]#p" | \
+		tac
+}
+
+check_dmesg_for_since_tag()
+{
+	dmesg_since_test_tag | egrep -q "$1"
+}
+
+echo "Silence is golden."
+
+
+# Skip old kernels that did not print the warning yet
+log_tag
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount -o attr2
+umount $SCRATCH_MNT
+check_dmesg_for_since_tag "XFS: attr2 mount option is deprecated" || \
+	_notrun "Deprecation warning are not printed at all."
+
+# Test mount with default options (attr2 and noikeep) and remount with
+# 2 groups of options
+# 1) the defaults (attr2, noikeep)
+# 2) non defaults (noattr2, ikeep)
+_scratch_mount
+for VAR in {attr2,noikeep}; do
+	log_tag
+	mount -o $VAR,remount $SCRATCH_MNT
+	check_dmesg_for_since_tag "XFS: $VAR mount option is deprecated." && \
+		echo "Should not be able to find deprecation warning for $VAR"
+done
+for VAR in {noattr2,ikeep}; do
+	log_tag
+	mount -o $VAR,remount $SCRATCH_MNT
+	check_dmesg_for_since_tag "XFS: $VAR mount option is deprecated" || \
+		echo "Could not find deprecation warning for $VAR"
+done
+umount $SCRATCH_MNT
+
+# success, all done
+status=0
+exit
tests/xfs/528.out new file +2 -0
new file mode 100644
index 00000000..762dccc0
@@ -0,0 +1,2 @@
+QA output created by 528
+Silence is golden.
tests/xfs/group +1 -0
index e861cec9..ad3bd223 100644
@@ -525,3 +525,4 @@
 525 auto quick mkfs
 526 auto quick mkfs
 527 auto quick quota
+528 auto quick mount
Signature · 1 line
2.29.2
#1 lore raw
Quoted 20 lines · Pavel Reichl

Verify that warnings about deprecated mount options are properly printed.

Verify that no excessive warnings are printed during remounts.

---
 tests/xfs/528     | 85 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/528.out |  2 ++
 tests/xfs/group   |  1 +
 3 files changed, 88 insertions(+)
 create mode 100755 tests/xfs/528
 create mode 100644 tests/xfs/528.out
tests/xfs/528 new file +0 -0
new file mode 100755
index 00000000..148f6304

tests/xfs/528 line 9

Quoted 9 lines
tests/xfs/528 new file +9 -0
@@ -0,0 +1,85 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Red Hat, Inc.. All Rights Reserved.
+#
+# FS QA Test 528
+#
+# Verify that warnings about deprecated mount options are properly printed.
+#
+# Verify that no excessive warnings are printed during remounts.

Better to interpret which bug/commit are you testing for.

Quoted 16 lines
tests/xfs/528 new file +16 -0
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}

tests/xfs/528 line 35

Quoted 10 lines
tests/xfs/528 new file +10 -0
+
+# get standard environment, filters and checks
+. ./common/rc
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+_require_check_dmesg
+_supported_fs xfs
+_require_scratch

Use _require_check_dmesg to make sure /dev/kmsg is writable.

Quoted 15 lines
tests/xfs/528 new file +15 -0
+
+log_tag()
+{
+	echo "fstests $seqnum [tag]" > /dev/kmsg
+}
+
+dmesg_since_test_tag()
+{
+	dmesg | tac | sed -ne "0,\#fstests $seqnum \[tag\]#p" | \
+		tac
+}
+
+check_dmesg_for_since_tag()
+{
+	dmesg_since_test_tag | egrep -q "$1"

tests/xfs/528 line 60

Quoted 10 lines
tests/xfs/528 new file +10 -0
+}
+
+echo "Silence is golden."
+
+
+# Skip old kernels that did not print the warning yet
+log_tag
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount -o attr2
+umount $SCRATCH_MNT

^^ _scratch_unmount

Quoted 11 lines
tests/xfs/528 new file +11 -0
+check_dmesg_for_since_tag "XFS: attr2 mount option is deprecated" || \
+	_notrun "Deprecation warning are not printed at all."
+
+# Test mount with default options (attr2 and noikeep) and remount with
+# 2 groups of options
+# 1) the defaults (attr2, noikeep)
+# 2) non defaults (noattr2, ikeep)
+_scratch_mount
+for VAR in {attr2,noikeep}; do
+	log_tag
+	mount -o $VAR,remount $SCRATCH_MNT

tests/xfs/528 line 81

Quoted 10 lines
tests/xfs/528 new file +10 -0
+	check_dmesg_for_since_tag "XFS: $VAR mount option is deprecated." && \
+		echo "Should not be able to find deprecation warning for $VAR"
+done
+for VAR in {noattr2,ikeep}; do
+	log_tag
+	mount -o $VAR,remount $SCRATCH_MNT
+	check_dmesg_for_since_tag "XFS: $VAR mount option is deprecated" || \
+		echo "Could not find deprecation warning for $VAR"
+done
+umount $SCRATCH_MNT

^^ _scratch_unmount

Just for making sure, looks like You test if remount print "deprecation warning" properly. What about mount? Should mount has "proper deprecation warning" output?

Actually, you'd better to describe what's the "proper" behavior, what's not, or what issue are you trying to cover in a test case.

Quoted 24 lines
tests/xfs/528 new file +4 -0
+
+# success, all done
+status=0
+exit
tests/xfs/528.out new file +2 -0
new file mode 100644
index 00000000..762dccc0
@@ -0,0 +1,2 @@
+QA output created by 528
+Silence is golden.
tests/xfs/group +1 -0
index e861cec9..ad3bd223 100644
@@ -525,3 +525,4 @@
 525 auto quick mkfs
 526 auto quick mkfs
 527 auto quick quota
+528 auto quick mount
Signature · 1 line
2.29.2
#2 lore raw
Quoted 18 lines
Quoted 18 lines
tests/xfs/528 new file +18 -0
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+
Quoted 8 lines

tests/xfs/528 line 35

Quoted 6 lines
tests/xfs/528 new file +6 -0
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+_require_check_dmesg
+_supported_fs xfs
+_require_scratch

Use _require_check_dmesg to make sure /dev/kmsg is writable.

Ugh...I think I do that 2 lines above, right?

Quoted 53 lines
Quoted 16 lines
tests/xfs/528 new file +15 -0
+
+log_tag()
+{
+	echo "fstests $seqnum [tag]" > /dev/kmsg
+}
+
+dmesg_since_test_tag()
+{
+	dmesg | tac | sed -ne "0,\#fstests $seqnum \[tag\]#p" | \
+		tac
+}
+
+check_dmesg_for_since_tag()
+{
+	dmesg_since_test_tag | egrep -q "$1"

tests/xfs/528 line 60

Quoted 10 lines
tests/xfs/528 new file +10 -0
+}
+
+echo "Silence is golden."
+
+
+# Skip old kernels that did not print the warning yet
+log_tag
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount -o attr2
+umount $SCRATCH_MNT

^^ _scratch_unmount

Quoted 11 lines
tests/xfs/528 new file +11 -0
+check_dmesg_for_since_tag "XFS: attr2 mount option is deprecated" || \
+	_notrun "Deprecation warning are not printed at all."
+
+# Test mount with default options (attr2 and noikeep) and remount with
+# 2 groups of options
+# 1) the defaults (attr2, noikeep)
+# 2) non defaults (noattr2, ikeep)
+_scratch_mount
+for VAR in {attr2,noikeep}; do
+	log_tag
+	mount -o $VAR,remount $SCRATCH_MNT

tests/xfs/528 line 81

Quoted 10 lines
tests/xfs/528 new file +10 -0
+	check_dmesg_for_since_tag "XFS: $VAR mount option is deprecated." && \
+		echo "Should not be able to find deprecation warning for $VAR"
+done
+for VAR in {noattr2,ikeep}; do
+	log_tag
+	mount -o $VAR,remount $SCRATCH_MNT
+	check_dmesg_for_since_tag "XFS: $VAR mount option is deprecated" || \
+		echo "Could not find deprecation warning for $VAR"
+done
+umount $SCRATCH_MNT

^^ _scratch_unmount

Quoted 5 lines

Just for making sure, looks like You test if remount print "deprecation warning" properly. What about mount? Should mount has "proper deprecation warning" output?

Actually, you'd better to describe what's the "proper" behavior, what's not, or what issue are you trying to cover in a test case.

Recent patch: "c23c393eaab5d xfs: remove deprecated mount options", added warning about deprecated options being passed as mount options. These warnings are currently printed *both during mount and remount* of the FS.

However some users find the repetitive printing of warnings *during remount* as an inconvenience (https://bugzilla.kernel.org/show_bug.cgi?id=211605 - Re-mount XFS causes "attr2 mount option is deprecated" warning).

To address this a patch that stops printing the warning on *remount* (if the option has the same value as during the mount) was proposed https://lore.kernel.org/linux-xfs/[email protected]/

Is it clear now?

Thanks for the comments.