From: Darrick J. Wong Date: Wed, 10 Jun 2026 21:57:33 +0000 (-0700) Subject: xfs_scrub: always finish cleanup, even if reporting healthy state fails X-Git-Tag: v7.1.0~20 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f75bb3f2d598b621c89da0894e5bd0a5e0d2c8f0;p=xfsprogs-dev.git xfs_scrub: always finish cleanup, even if reporting healthy state fails Codex points out here that we should always release resources used by the program, even if reporting healthy state to the kernel itself fails. We're exiting soon anyway so this probably doesn't make much of a difference. Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- diff --git a/scrub/phase1.c b/scrub/phase1.c index 620a1239..f1c9247e 100644 --- a/scrub/phase1.c +++ b/scrub/phase1.c @@ -86,11 +86,9 @@ int scrub_cleanup( struct scrub_ctx *ctx) { - int error; + int error, error2; error = report_to_kernel(ctx); - if (error) - return error; action_list_free(&ctx->file_repair_list); action_list_free(&ctx->fs_repair_list); @@ -105,9 +103,12 @@ scrub_cleanup( ctx->verify_disks[XFS_DEV_RT] != ctx->verify_disks[XFS_DEV_DATA]) disk_close(ctx->verify_disks[XFS_DEV_RT]); fshandle_destroy(); - error = -xfd_close(&ctx->mnt); - if (error) + error2 = -xfd_close(&ctx->mnt); + if (error2) { + if (!error) + error = error2; str_liberror(ctx, error, _("closing mountpoint fd")); + } fs_table_destroy(); return error;