linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Catherine Hoang <catherine.hoang@oracle.com>
To: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Cc: djwong@kernel.org, john.g.garry@oracle.com,
	ritesh.list@gmail.com, ojaswin@linux.ibm.com
Subject: [PATCH 5/5] common/atomicwrites: fix _require_scratch_write_atomic
Date: Mon,  2 Jun 2025 12:22:14 -0700	[thread overview]
Message-ID: <20250602192214.60090-6-catherine.hoang@oracle.com> (raw)
In-Reply-To: <20250602192214.60090-1-catherine.hoang@oracle.com>

From: "Darrick J. Wong" <djwong@kernel.org>

Fix this function to call _notrun whenever something fails.  If we can't
figure out the atomic write geometry, then we haven't satisfied the
preconditions for the test.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
---
 common/atomicwrites | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/common/atomicwrites b/common/atomicwrites
index 9ec1ca68..391bb6f6 100644
--- a/common/atomicwrites
+++ b/common/atomicwrites
@@ -28,21 +28,23 @@ _require_scratch_write_atomic()
 {
 	_require_scratch
 
-	awu_min_bdev=$(_get_atomic_write_unit_min $SCRATCH_DEV)
-	awu_max_bdev=$(_get_atomic_write_unit_max $SCRATCH_DEV)
+	local awu_min_bdev=$(_get_atomic_write_unit_min $SCRATCH_DEV)
+	local awu_max_bdev=$(_get_atomic_write_unit_max $SCRATCH_DEV)
 
 	if [ $awu_min_bdev -eq 0 ] && [ $awu_max_bdev -eq 0 ]; then
 		_notrun "write atomic not supported by this block device"
 	fi
 
-	_scratch_mkfs > /dev/null 2>&1
-	_scratch_mount
+	_scratch_mkfs > /dev/null 2>&1 || \
+		_notrun "cannot format scratch device for atomic write checks"
+	_try_scratch_mount || \
+		_notrun "cannot mount scratch device for atomic write checks"
 
-	testfile=$SCRATCH_MNT/testfile
+	local testfile=$SCRATCH_MNT/testfile
 	touch $testfile
 
-	awu_min_fs=$(_get_atomic_write_unit_min $testfile)
-	awu_max_fs=$(_get_atomic_write_unit_max $testfile)
+	local awu_min_fs=$(_get_atomic_write_unit_min $testfile)
+	local awu_max_fs=$(_get_atomic_write_unit_max $testfile)
 
 	_scratch_unmount
 
-- 
2.34.1


  parent reply	other threads:[~2025-06-02 19:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-02 19:22 [PATCH 0/5] atomic writes tests (part 1) Catherine Hoang
2025-06-02 19:22 ` [PATCH 1/5] generic/765: fix a few issues Catherine Hoang
2025-06-04 13:58   ` John Garry
2025-06-02 19:22 ` [PATCH 2/5] generic/765: adjust various things Catherine Hoang
2025-06-02 19:22 ` [PATCH 3/5] generic/765: move common atomic write code to a library file Catherine Hoang
2025-06-02 19:22 ` [PATCH 4/5] common/atomicwrites: adjust a few more things Catherine Hoang
2025-06-02 19:22 ` Catherine Hoang [this message]
2025-06-12  7:07   ` [PATCH 5/5] common/atomicwrites: fix _require_scratch_write_atomic Ojaswin Mujoo

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=20250602192214.60090-6-catherine.hoang@oracle.com \
    --to=catherine.hoang@oracle.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=john.g.garry@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    /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).