linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 3/4] btrfs-progs: tests/misc/046: fix false alerts on write detection
Date: Wed,  9 Aug 2023 06:40:43 +0800	[thread overview]
Message-ID: <e227ed8b74af486392cc1f2607a505577f79fa4c.1691533896.git.wqu@suse.com> (raw)
In-Reply-To: <cover.1691533896.git.wqu@suse.com>

[BUG]
Test case misc/046-seed-multi-mount would always fail with the following
error:

    [TEST]   misc-tests.sh
    [TEST/misc]   046-seed-multi-mount
unexpected success: writable file despite read-only mount
test failed for case 046-seed-multi-mount

[CAUSE]
Although mounting seed device is indeed read-only, sprouting it with a
new device would always make it read-write by itself.

The behavior is already there for a long time, thus expecting a new
behavior (not changing the read-only flag) is a little weird.

[FIX]
Instead of doing the write check after the sprout, do it before the
sprout.

This looks more correct, and would not rely on the kernel behavior
change (if we determine to go that path).

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 tests/misc-tests/046-seed-multi-mount/test.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/misc-tests/046-seed-multi-mount/test.sh b/tests/misc-tests/046-seed-multi-mount/test.sh
index 83f7a91effdd..95654fd904ff 100755
--- a/tests/misc-tests/046-seed-multi-mount/test.sh
+++ b/tests/misc-tests/046-seed-multi-mount/test.sh
@@ -42,9 +42,11 @@ nextdevice() {
 	run_check mkdir -p "$mnt"
 	TEST_MNT="$mnt"
 	run_check_mount_test_dev
-	run_check $SUDO_HELPER "$TOP/btrfs" device add ${loopdevs[$nextdev]} "$TEST_MNT"
 	run_mustfail "writable file despite read-only mount" \
 		$SUDO_HELPER dd if=/dev/zero of="$TEST_MNT/file$nextdevice" bs=1M count=1 status=none
+	run_check $SUDO_HELPER "$TOP/btrfs" device add ${loopdevs[$nextdev]} "$TEST_MNT"
+	# Although seed sprout would make the fs RW, explicitly remount it RW
+	# just in case of future behavior change.
 	run_check $SUDO_HELPER mount -o remount,rw "$TEST_MNT"
 	# Rewrite the file
 	md5sum=$(run_check_stdout md5sum "$TEST_MNT/file$nextdev" | awk '{print $1}')
-- 
2.41.0


  parent reply	other threads:[~2023-08-08 22:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-08 22:40 [PATCH 0/4] btrfs-progs: tests false alerts fixes Qu Wenruo
2023-08-08 22:40 ` [PATCH 1/4] btrfs-progs: tests/mkfs/005: use udevadm settle to avoid false alerts Qu Wenruo
2023-08-08 22:40 ` [PATCH 2/4] btrfs-progs: tests/misc/030: do not require v1 cache for the test case Qu Wenruo
2023-08-08 22:40 ` Qu Wenruo [this message]
2023-08-08 22:40 ` [PATCH 4/4] btrfs-progs: tests/misc/058: reduce the space requirement and speed up the test Qu Wenruo
2023-08-11 14:53 ` [PATCH 0/4] btrfs-progs: tests false alerts fixes David Sterba

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=e227ed8b74af486392cc1f2607a505577f79fa4c.1691533896.git.wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@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).