From: Darrick J. Wong Date: Mon, 24 Feb 2025 18:21:42 +0000 (-0800) Subject: xfs_scrub: don't report data loss in unlinked inodes twice X-Git-Tag: v6.14.0~157 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cb3647bb33a3aba50de10db07b8b8ee3176237a5;p=thirdparty%2Fxfsprogs-dev.git xfs_scrub: don't report data loss in unlinked inodes twice If parent pointers are enabled, report_ioerr_fsmap will report lost file data and xattrs for all files, having used the parent pointer ioctls to generate the path of the lost file. For unlinked files, the path lookup will fail, but we'll report the inumber of the file that lost data. Therefore, we don't need to do a separate scan of the unlinked inodes in report_all_media_errors after doing the fsmap scan. Cc: # v6.10.0 Fixes: 9b5d1349ca5fb1 ("xfs_scrub: use parent pointers to report lost file data") Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- diff --git a/scrub/phase6.c b/scrub/phase6.c index fc63f5aa..503119bd 100644 --- a/scrub/phase6.c +++ b/scrub/phase6.c @@ -567,14 +567,16 @@ report_all_media_errors( /* * Scan the directory tree to get file paths if we didn't already use - * directory parent pointers to report the loss. + * directory parent pointers to report the loss. If parent pointers + * are enabled, report_ioerr_fsmap will have already reported file + * paths that have lost file data and xattrs. */ - if (!can_use_pptrs(ctx)) { - ret = scan_fs_tree(ctx, report_dir_loss, report_dirent_loss, - vs); - if (ret) - return ret; - } + if (can_use_pptrs(ctx)) + return 0; + + ret = scan_fs_tree(ctx, report_dir_loss, report_dirent_loss, vs); + if (ret) + return ret; /* Scan for unlinked files. */ return scrub_scan_all_inodes(ctx, report_inode_loss, 0, vs);