]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: don't fail while reporting media scan errors
authorDarrick J. Wong <djwong@kernel.org>
Mon, 15 Apr 2024 23:07:46 +0000 (16:07 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 17 Apr 2024 21:06:27 +0000 (14:06 -0700)
If we can't open a file to report that it has media errors, just log
that fact and move on.  In this case we want to keep going with phase 6
so we report as many errors as possible.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
scrub/phase6.c

index 393d9eaa83d85332ccbbdfc8e6bfc37a72f99bff..193d3b4e90834f9467960ffacc76d24d50b62ff5 100644 (file)
@@ -21,6 +21,7 @@
 #include "read_verify.h"
 #include "spacemap.h"
 #include "vfs.h"
+#include "common.h"
 
 /*
  * Phase 6: Verify data file integrity.
@@ -291,13 +292,14 @@ report_inode_loss(
        /* Try to open the inode. */
        fd = scrub_open_handle(handle);
        if (fd < 0) {
-               error = errno;
-               if (error == ESTALE)
-                       return error;
+               /* Handle is stale, try again. */
+               if (errno == ESTALE)
+                       return ESTALE;
 
-               str_info(ctx, descr,
-_("Disappeared during read error reporting."));
-               return error;
+               str_error(ctx, descr,
+ _("Could not open to report read errors: %s."),
+                               strerror(errno));
+               return 0;
        }
 
        /* Go find the badness. */
@@ -353,10 +355,18 @@ report_dirent_loss(
        fd = openat(dir_fd, dirent->d_name,
                        O_RDONLY | O_NOATIME | O_NOFOLLOW | O_NOCTTY);
        if (fd < 0) {
+               char            descr[PATH_MAX + 1];
+
                if (errno == ENOENT)
                        return 0;
-               str_errno(ctx, path);
-               return errno;
+
+               snprintf(descr, PATH_MAX, "%s/%s", path, dirent->d_name);
+               descr[PATH_MAX] = 0;
+
+               str_error(ctx, descr,
+ _("Could not open to report read errors: %s."),
+                               strerror(errno));
+               return 0;
        }
 
        /* Go find the badness. */