Message ID | 155259752927.31886.10173767197190539382.stgit@magnolia (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
Series | xfsprogs-5.0: fix various problems | expand |
On 3/14/19 4:05 PM, Darrick J. Wong wrote: > From: Darrick J. Wong <darrick.wong@oracle.com> > > 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 <darrick.wong@oracle.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> > --- > scrub/phase1.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > > diff --git a/scrub/phase1.c b/scrub/phase1.c > index 6b472147..04a5f4a9 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; >
diff --git a/scrub/phase1.c b/scrub/phase1.c index 6b472147..04a5f4a9 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;