From: "Darrick J. Wong" <djwong@kernel.org>
To: Carlos Maiolino <cem@kernel.org>
Cc: xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH] xfs_repair: don't leak the rootdir inode when orphanage already exists
Date: Tue, 18 Jun 2024 16:22:07 -0700 [thread overview]
Message-ID: <20240618232207.GG103034@frogsfrogsfrogs> (raw)
From: Darrick J. Wong <djwong@kernel.org>
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 <djwong@kernel.org>
---
repair/phase6.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/repair/phase6.c b/repair/phase6.c
index ae8935a26420..e6103f768988 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -919,8 +919,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
@@ -1012,6 +1014,7 @@ mk_orphanage(xfs_mount_t *mp)
ORPHANAGE, error);
}
libxfs_irele(ip);
+out_pip:
libxfs_irele(pip);
return(ino);
next reply other threads:[~2024-06-18 23:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-18 23:22 Darrick J. Wong [this message]
2024-06-19 5:26 ` [PATCH] xfs_repair: don't leak the rootdir inode when orphanage already exists Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240618232207.GG103034@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox