From b9c81ead6d69e0b0ad91704c6813881891037d8d Mon Sep 17 00:00:00 2001 From: liuh Date: Mon, 3 Nov 2025 22:51:51 +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 | 6 ++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 0010-xfs_repair-don-t-leak-the-rootdir-inode-when-orphana.patch diff --git a/0010-xfs_repair-don-t-leak-the-rootdir-inode-when-orphana.patch b/0010-xfs_repair-don-t-leak-the-rootdir-inode-when-orphana.patch new file mode 100644 index 0000000..ef3521a --- /dev/null +++ b/0010-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 3870c5c..738a2d6 100644 +--- a/repair/phase6.c ++++ b/repair/phase6.c +@@ -906,8 +906,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 +@@ -999,6 +1001,7 @@ mk_orphanage(xfs_mount_t *mp) + ORPHANAGE, error); + } + libxfs_irele(ip); ++out_pip: + libxfs_irele(pip); + + return(ino); +-- +2.43.0 + diff --git a/xfsprogs.spec b/xfsprogs.spec index 520edc5..dd59906 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -1,6 +1,6 @@ Name: xfsprogs Version: 6.6.0 -Release: 10 +Release: 11 Summary: Administration and debugging tools for the XFS file system License: GPL+ and LGPLv2+ URL: https://xfs.wiki.kernel.org @@ -28,6 +28,7 @@ Patch6: 0006-xfs_io-fix-mread-with-length-1-mod-page-size.patch Patch7: 0007-xfs_scrub-don-t-call-phase_end-if-phase_rusage-was-n.patch Patch8: 0008-mkfs-fix-the-issue-of-maxpct-set-to-0-not-taking-eff.patch Patch9: 0009-xfs_repair-don-t-crash-in-get_inode_parent.patch +Patch10: 0010-xfs_repair-don-t-leak-the-rootdir-inode-when-orphana.patch %description xfsprogs are the userspace utilities that manage XFS filesystems. @@ -111,6 +112,9 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/ %changelog +* Mon Nov 3 2025 liuh - 6.6.0-11 +- xfs_repair: don't leak the rootdir inode when orphanage already exists + * Tue Oct 21 2025 liuh - 6.6.0-10 - xfs_repair: don't crash in get_inode_parent -- Gitee