提交 f3dcc13f 编写于 作者: C Christoph Hellwig 提交者: Lachlan McIlroy

[XFS] cleanup root inode handling in xfs_fs_fill_super

- rename rootvp to root for clarify
- remove useless vn_to_inode call
- check is_bad_inode before calling d_alloc_root
- use iput instead of VN_RELE in the error case

SGI-PV: 976035
SGI-Modid: xfs-linux-melb:xfs-kern:30708a
Signed-off-by: NChristoph Hellwig <hch@infradead.org>
Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
上级 59a33f9f
...@@ -1307,7 +1307,7 @@ xfs_fs_fill_super( ...@@ -1307,7 +1307,7 @@ xfs_fs_fill_super(
void *data, void *data,
int silent) int silent)
{ {
struct inode *rootvp; struct inode *root;
struct xfs_mount *mp = NULL; struct xfs_mount *mp = NULL;
struct xfs_mount_args *args = xfs_args_allocate(sb, silent); struct xfs_mount_args *args = xfs_args_allocate(sb, silent);
int error; int error;
...@@ -1345,19 +1345,18 @@ xfs_fs_fill_super( ...@@ -1345,19 +1345,18 @@ xfs_fs_fill_super(
sb->s_time_gran = 1; sb->s_time_gran = 1;
set_posix_acl_flag(sb); set_posix_acl_flag(sb);
rootvp = igrab(mp->m_rootip->i_vnode); root = igrab(mp->m_rootip->i_vnode);
if (!rootvp) { if (!root) {
error = ENOENT; error = ENOENT;
goto fail_unmount; goto fail_unmount;
} }
if (is_bad_inode(root)) {
sb->s_root = d_alloc_root(vn_to_inode(rootvp)); error = EINVAL;
if (!sb->s_root) {
error = ENOMEM;
goto fail_vnrele; goto fail_vnrele;
} }
if (is_bad_inode(sb->s_root->d_inode)) { sb->s_root = d_alloc_root(root);
error = EINVAL; if (!sb->s_root) {
error = ENOMEM;
goto fail_vnrele; goto fail_vnrele;
} }
...@@ -1379,7 +1378,7 @@ xfs_fs_fill_super( ...@@ -1379,7 +1378,7 @@ xfs_fs_fill_super(
dput(sb->s_root); dput(sb->s_root);
sb->s_root = NULL; sb->s_root = NULL;
} else { } else {
VN_RELE(rootvp); iput(root);
} }
fail_unmount: fail_unmount:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册