On 2/12/25 12:54 PM, Luis Chamberlain wrote:
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@xxxxxxxxxx>
---
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.
Thanks,
Bart.