diff options
Diffstat (limited to 'fs/nfs/getroot.c')
-rw-r--r-- | fs/nfs/getroot.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c index fae97196daad..b7c9b2df1f29 100644 --- a/fs/nfs/getroot.c +++ b/fs/nfs/getroot.c | |||
@@ -107,11 +107,10 @@ struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh) | |||
107 | * if the dentry tree reaches them; however if the dentry already | 107 | * if the dentry tree reaches them; however if the dentry already |
108 | * exists, we'll pick it up at this point and use it as the root | 108 | * exists, we'll pick it up at this point and use it as the root |
109 | */ | 109 | */ |
110 | mntroot = d_alloc_anon(inode); | 110 | mntroot = d_obtain_alias(inode); |
111 | if (!mntroot) { | 111 | if (IS_ERR(mntroot)) { |
112 | iput(inode); | ||
113 | dprintk("nfs_get_root: get root dentry failed\n"); | 112 | dprintk("nfs_get_root: get root dentry failed\n"); |
114 | return ERR_PTR(-ENOMEM); | 113 | return mntroot; |
115 | } | 114 | } |
116 | 115 | ||
117 | security_d_instantiate(mntroot, inode); | 116 | security_d_instantiate(mntroot, inode); |
@@ -277,11 +276,10 @@ struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh) | |||
277 | * if the dentry tree reaches them; however if the dentry already | 276 | * if the dentry tree reaches them; however if the dentry already |
278 | * exists, we'll pick it up at this point and use it as the root | 277 | * exists, we'll pick it up at this point and use it as the root |
279 | */ | 278 | */ |
280 | mntroot = d_alloc_anon(inode); | 279 | mntroot = d_obtain_alias(inode); |
281 | if (!mntroot) { | 280 | if (IS_ERR(mntroot)) { |
282 | iput(inode); | ||
283 | dprintk("nfs_get_root: get root dentry failed\n"); | 281 | dprintk("nfs_get_root: get root dentry failed\n"); |
284 | return ERR_PTR(-ENOMEM); | 282 | return mntroot; |
285 | } | 283 | } |
286 | 284 | ||
287 | security_d_instantiate(mntroot, inode); | 285 | security_d_instantiate(mntroot, inode); |