From 469c9a2103a19ff63ea126d075319944eb45d15b Mon Sep 17 00:00:00 2001 From: liuh Date: Fri, 17 Oct 2025 15:20:12 +0800 Subject: [PATCH] xfs_repair: don't leak the rootdir inode when orphanage already exists --- ...-leak-the-rootdir-inode-when-orphana.patch | 44 +++++++++++++++++++ xfsprogs.spec | 7 ++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 0060-xfs_repair-don-t-leak-the-rootdir-inode-when-orphana.patch diff --git a/0060-xfs_repair-don-t-leak-the-rootdir-inode-when-orphana.patch b/0060-xfs_repair-don-t-leak-the-rootdir-inode-when-orphana.patch new file mode 100644 index 0000000..23589c1 --- /dev/null +++ b/0060-xfs_repair-don-t-leak-the-rootdir-inode-when-orphana.patch @@ -0,0 +1,44 @@ +From b67a805cf877525ce74031832a07f6359c04cc9b Mon Sep 17 00:00:00 2001 +From: "Darrick J. Wong" +Date: Mon, 29 Jul 2024 16:22:33 -0700 +Subject: xfs_repair: don't leak the rootdir inode when orphanage already + exists + +If repair calls mk_orphanage and the /lost+found directory already +exists, we need to irele the root directory before exiting the function. + +Fixes: 6c39a3cbda32 ("Don't trash lost+found in phase 4 Merge of master-melb:xfs-cmds:29144a by kenmcd.") +Signed-off-by: Darrick J. Wong +Reviewed-by: Christoph Hellwig +--- + repair/phase6.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/repair/phase6.c b/repair/phase6.c +index 5d64a75..3fabdc4 100644 +--- a/repair/phase6.c ++++ b/repair/phase6.c +@@ -909,8 +909,10 @@ mk_orphanage(xfs_mount_t *mp) + xname.len = strlen(ORPHANAGE); + xname.type = XFS_DIR3_FT_DIR; + +- if (libxfs_dir_lookup(NULL, pip, &xname, &ino, NULL) == 0) +- return ino; ++ /* If the lookup of /lost+found succeeds, return the inumber. */ ++ error = libxfs_dir_lookup(NULL, pip, &xname, &ino, NULL); ++ if (error == 0) ++ goto out_pip; + + /* + * could not be found, create it +@@ -1002,6 +1004,7 @@ mk_orphanage(xfs_mount_t *mp) + ORPHANAGE, error); + } + libxfs_irele(ip); ++out_pip: + libxfs_irele(pip); + + return(ino); +-- +2.33.0 + diff --git a/xfsprogs.spec b/xfsprogs.spec index 70b74f5..f63a2d1 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -1,6 +1,6 @@ Name: xfsprogs Version: 5.14.1 -Release: 18 +Release: 19 Summary: Administration and debugging tools for the XFS file system License: GPL+ and LGPLv2+ URL: https://xfs.wiki.kernel.org @@ -78,6 +78,7 @@ Patch56: 0056-mkfs-Ensure-extsize-aligned-to-stripe-unit-for-force.patch Patch57: 0057-xfs_io-Implement-lsattr-and-chattr-support-for-atomi.patch Patch58: 0058-xfs_scrub-fix-reporting-if-we-can-t-open-raw-block-d.patch Patch59: 0059-mkfs-fix-the-issue-of-maxpct-set-to-0-not-taking-eff.patch +Patch60: 0060-xfs_repair-don-t-leak-the-rootdir-inode-when-orphana.patch %description xfsprogs are the userspace utilities that manage XFS filesystems. @@ -161,6 +162,10 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/ %changelog +* Fri Oct 17 2025 liuh +- sync patch from community + xfs_repair: don't leak the rootdir inode when orphanage already exists + * Wed Sep 3 2025 liuh - 5.14.1-18 - sync patch from community mkfs: fix the issue of maxpct set to 0 not taking effect -- Gitee