Thread (16 messages) 16 messages, 3 authors, 2025-02-21

Re: [PATCH blktests v3 1/6] common/xfs: ignore first umount error on _xfs_mkfs_and_mount()

From: Luis Chamberlain <mcgrof@kernel.org>
Date: 2025-02-12 21:07:25
Also in: linux-patches

On Wed, Feb 12, 2025 at 12:58:36PM -0800, Bart Van Assche wrote:
On 2/12/25 12:54 PM, Luis Chamberlain wrote:
quoted
We want to help capture error messages with _xfs_mkfs_and_mount() on
$FULL, to do that we should avoid spamming error messages for things
which we know are not fatal. Such is the case of when we try to
mkfs a filesystem but before that try to umount the target path.
The first umount is just for sanity, so ignore the error messages from
it.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
  common/xfs | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/xfs b/common/xfs
index 569770fecd53..67a3b8a97391 100644
--- a/common/xfs
+++ b/common/xfs
@@ -15,7 +15,7 @@ _xfs_mkfs_and_mount() {
  	local mount_dir=$2
  	mkdir -p "${mount_dir}"
-	umount "${mount_dir}"
+	umount "${mount_dir}" >/dev/null 2>&1
  	mkfs.xfs -l size=64m -f "${bdev}" || return $?
  	mount "${bdev}" "${mount_dir}"
  }
Shouldn't ">/dev/null 2>&1" be added to the _xfs_mkfs_and_mount()
caller rather than inside the _xfs_mkfs_and_mount() implementation?
The above patch makes it impossible for any caller to capture the
stdout output of umount.
That is the point. In this case the umount *can* fail, we do it for
sanity purposes. We don't care if umount failed.

  Luis
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help