summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2022-06-03 11:54:13 +1000
committerZorro Lang <zlang@kernel.org>2022-06-03 13:18:15 +0800
commit568ac9fffeb6afec03e5d6c9936617232fd7fc6d (patch)
tree5b002a859ee79701ca352284937859c237ab3243
parent01dc3329bcc08fc60c2970015c6524e76011c782 (diff)
xfs/189: systemd monitoring of /etc/fstab sucksv2022.06.05
On a recently upgraded system, xfs/189 still works just fine, but every test run after it now gets spammed from mount/systemd like so: xfs/189 [not run] noattr2 mount option not supported on /dev/vdc xfs/190 1s ... mount: (hint) your fstab has been modified, but systemd still uses the old version; use 'systemctl daemon-reload' to reload. 1s xfs/192 3s ... mount: (hint) your fstab has been modified, but systemd still uses the old version; use 'systemctl daemon-reload' to reload. 2s xfs/193 2s ... mount: (hint) your fstab has been modified, but systemd still uses the old version; use 'systemctl daemon-reload' to reload. 2s xfs/194 1s ... mount: (hint) your fstab has been modified, but systemd still uses the old version; use 'systemctl daemon-reload' to reload. This is because xfs/189 modifies /etc/fstab during the test, then restores it to it's original condition so there's nothing to update. However, systemd is sees that the mtime of /etc/fstab has changed, and assumes they sky has fallen and so everything must be reloaded from scratch to silence the unnecessary "hint". We can avoid this clumsiness by capturing the mtime of /etc/fstab before we modify it, and restore it afterwards and that means systemd doesn't even notice that we've being playing around with /etc/fstab. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
-rwxr-xr-xtests/xfs/18926
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/xfs/189 b/tests/xfs/189
index e601881a..bc7ccca5 100755
--- a/tests/xfs/189
+++ b/tests/xfs/189
@@ -32,6 +32,23 @@
#
# <---- Normal programming is resumed ---->
#
+# <---- Bbbzzzzzzztttt ---->
+#
+# < systemd enters the chat >
+#
+# xfs/189 [not run] noattr2 mount option not supported on /dev/vdc
+# xfs/190 1s ... mount: (hint) your fstab has been modified, but systemd still uses
+# the old version; use 'systemctl daemon-reload' to reload.
+# 1s
+# xfs/192 3s ... mount: (hint) your fstab has been modified, but systemd still uses
+# the old version; use 'systemctl daemon-reload' to reload.
+#
+# mount/systemd sees that /etc/fstab has changed (because mtime changed)
+# and so it whines that systemd needs updating on every mount from this point
+# onwards. Yes, that's totally obnoxious behaviour from mount/systemd but we
+# have to work around it.
+#
+# < systemd leaves the chat >
#
. ./common/preamble
_begin_fstest mount auto quick
@@ -190,6 +207,10 @@ ENDL
# Example fstab entry
# /dev/sdb2 /mnt/scratch1 xfs defaults 0 0
#
+# Note that to avoid mnt/systemd whining about /etc/fstab being modified, we
+# need to ensure that it reloads it's state once we restore the fstab to
+# original.
+#
_add_scratch_fstab()
{
# comment out any existing SCRATCH_DEV
@@ -201,7 +222,7 @@ _add_scratch_fstab()
_modify_scratch_fstab()
{
- opts=$1
+ local opts=$1
# modify our fstab entry that we added
# modify opts by looking for last word which has non-space chars
@@ -215,6 +236,9 @@ _putback_scratch_fstab()
# remove the one we added at the end
$SED_PROG -i "/# $tag/d" /etc/fstab
+
+ # stop mount/systemd whining that /etcfstab was changed.
+ command -v systemctl > /dev/null 2>&1 && systemctl daemon-reload
}
# Import common functions.