From aa26c33ced2d85e02c130882061228f18440b83f Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Thu, 28 Mar 2019 18:05:01 -0500 Subject: [PATCH] xfs_scrub: don't close mnt_fd when mnt_fd open fails If we fail to open the mountpoint during phase 1 of scrub, don't bother trying to close the file descriptor since it's silly to spray error messages about that. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- scrub/phase1.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scrub/phase1.c b/scrub/phase1.c index 6b472147f..04a5f4a92 100644 --- a/scrub/phase1.c +++ b/scrub/phase1.c @@ -59,9 +59,11 @@ xfs_cleanup_fs( if (ctx->datadev) disk_close(ctx->datadev); fshandle_destroy(); - error = close(ctx->mnt_fd); - if (error) - str_errno(ctx, _("closing mountpoint fd")); + if (ctx->mnt_fd >= 0) { + error = close(ctx->mnt_fd); + if (error) + str_errno(ctx, _("closing mountpoint fd")); + } fs_table_destroy(); return true; -- 2.47.2