From: Lukas Czerner <lczerner@redhat.com>
To: fstests@vger.kernel.org
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH] ext4/053: Test remount without changing mount options
Date: Thu, 20 Jan 2022 11:20:25 +0100 [thread overview]
Message-ID: <20220120102025.42735-1-lczerner@redhat.com> (raw)
With the recent ext4 mount api change we discovered a bugs that weren't
caught by this test. It was triggered by remounting the file system
either with the same mount options, or without specifying any mount
options at all. In this case we would expect the original mount options
to remain the same, however this was either not the case, or the remount
failed.
Add a remount test after a regular mount. Remount once with specifying
the original mount option and remount second time without specifying
anything. Test the active options after each test.
Additionally include all the combinations of data= options in the
remount test for the sake of completeness.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
tests/ext4/053 | 57 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
diff --git a/tests/ext4/053 b/tests/ext4/053
index eaa02508..e1e79592 100755
--- a/tests/ext4/053
+++ b/tests/ext4/053
@@ -77,6 +77,10 @@ kernel_gte 5.12 || _notrun "This test is only relevant for kernel versions 5.12
IGNORED="remount,defaults,ignored,removed"
CHECK_MINFO="lazytime,noatime,nodiratime,noexec,nosuid,ro"
+
+# List of options that can't be used for remount even if the argument
+# is not changed
+CANT_REMOUNT="defaults,remount,abort,journal_path,journal_dev,usrjquota,grpjquota,jqfmt"
ERR=0
test_mnt() {
@@ -170,6 +174,54 @@ do_mnt() {
print_log "(failed mount)"
fi
+ if [ $ret -ne 0 ] || [ -z "$1" ]; then
+ return $ret
+ fi
+
+ # Skip options that can't be remounted even if the argument
+ # is not changed
+ (
+ IFS=','
+ for option in $1; do
+ opt=${option%=*}
+ if echo $CANT_REMOUNT | grep -w $opt; then
+ exit 1
+ fi
+ # Skip the remount if we have data=journal on ext3 because
+ # it will set nodioread_nolock which is not supported on ext3
+ # hence remount will fail. Yes it is broken.
+ if [[ $fstype == "ext3" ]] && [[ $option == "data=journal" ]]; then
+ exit 1
+ fi
+ done
+ ) > /dev/null 2>&1
+ [ $? -eq 1 ] && return 0
+ print_log "(going to remount options $1)"
+
+ # Just remount with original mnt options, don't add anything at all
+ simple_mount -o remount,$1 $SCRATCH_MNT
+ ret=$?
+ if [ $ret -eq 0 ]; then
+ test_mnt $1 $2
+ ret=$?
+ [ $ret -ne 0 ] && print_log "(not found after remount)"
+ else
+ print_log "(failed remount)"
+ fi
+
+ [ $ret -ne 0 ] && return $ret
+
+ # Plain remount without specifying any mount options
+ simple_mount -o remount $SCRATCH_MNT
+ ret=$?
+ if [ $ret -eq 0 ]; then
+ test_mnt $1 $2
+ ret=$?
+ [ $ret -ne 0 ] && print_log "(not found after plain remount)"
+ else
+ print_log "(failed plain remount)"
+ fi
+
return $ret
}
@@ -556,8 +608,11 @@ for fstype in ext2 ext3 ext4; do
if [[ $fstype != "ext2" ]]; then
remount noload data=journal norecovery
- not_remount data=ordered data=journal
+ not_remount data=journal data=ordered
not_remount data=journal data=writeback
+ not_remount data=ordered data=journal
+ not_remount data=ordered data=writeback
+ not_remount data=writeback data=journal
not_remount data=writeback data=ordered
fi
--
2.31.1
reply other threads:[~2022-01-20 10:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220120102025.42735-1-lczerner@redhat.com \
--to=lczerner@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).