summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_mount.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-01 11:13:24 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-12-15 17:29:07 -0800
commit3890a2a122510b3bd9ac702eda855bb7e848b1a9 (patch)
tree2159256571033b1a094cfea573d90eb9f0b85b08 /fs/xfs/xfs_mount.c
parent9836ac471c49958bb2b58525395811b89d61c197 (diff)
xfs: load metadata directory root at mount time
Load the metadata directory root inode into memory at mount time and release it at unmount time. We also make sure that the obsolete inode pointers in the superblock are not logged or read from the superblock. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r--fs/xfs/xfs_mount.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index a53e6aa54675..66b85d14b80f 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -521,6 +521,16 @@ xfs_mountfs_imeta(
{
int error;
+ /* Load the metadata directory inode into memory. */
+ if (xfs_has_metadir(mp)) {
+ error = xfs_imeta_iget(mp, mp->m_sb.sb_metadirino,
+ XFS_DIR3_FT_DIR, &mp->m_metadirip);
+ if (error) {
+ xfs_warn(mp, "Failed metadir ino init: %d", error);
+ return error;
+ }
+ }
+
error = xfs_imeta_mount(mp);
if (error) {
xfs_warn(mp, "Failed to load metadata inode info, error %d",
@@ -827,7 +837,7 @@ xfs_mountfs(
/* Load the metadata directory tree. */
error = xfs_mountfs_imeta(mp);
if (error)
- goto out_log_dealloc;
+ goto out_free_metadir;
/*
* Get and sanity-check the root inode.
@@ -839,7 +849,7 @@ xfs_mountfs(
xfs_warn(mp,
"Failed to read root inode 0x%llx, error %d",
sbp->sb_rootino, -error);
- goto out_log_dealloc;
+ goto out_free_metadir;
}
ASSERT(rip != NULL);
@@ -1006,6 +1016,9 @@ xfs_mountfs(
xfs_irele(rip);
/* Clean out dquots that might be in memory after quotacheck. */
xfs_qm_unmount(mp);
+ out_free_metadir:
+ if (mp->m_metadirip)
+ xfs_imeta_irele(mp->m_metadirip);
/*
* Inactivate all inodes that might still be in memory after a log
@@ -1079,6 +1092,8 @@ xfs_unmountfs(
xfs_qm_unmount_quotas(mp);
xfs_rtunmount_inodes(mp);
xfs_irele(mp->m_rootip);
+ if (mp->m_metadirip)
+ xfs_imeta_irele(mp->m_metadirip);
xfs_unmount_flush_inodes(mp);