]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs_scrub: always finish cleanup, even if reporting healthy state fails
authorDarrick J. Wong <djwong@kernel.org>
Wed, 10 Jun 2026 21:57:33 +0000 (14:57 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jun 2026 00:57:06 +0000 (17:57 -0700)
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" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
scrub/phase1.c

index 620a12393b3658e0431406eb628558db1923b884..f1c9247e68a0841035405b7fc781718189c6ee20 100644 (file)
@@ -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;