aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/ops_export.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c
index 9cda8536530c..bbb8c36403a9 100644
--- a/fs/gfs2/ops_export.c
+++ b/fs/gfs2/ops_export.c
@@ -130,28 +130,17 @@ static int gfs2_get_name(struct dentry *parent, char *name,
130static struct dentry *gfs2_get_parent(struct dentry *child) 130static struct dentry *gfs2_get_parent(struct dentry *child)
131{ 131{
132 struct qstr dotdot; 132 struct qstr dotdot;
133 struct inode *inode;
134 struct dentry *dentry; 133 struct dentry *dentry;
135 134
136 gfs2_str2qstr(&dotdot, "..");
137 inode = gfs2_lookupi(child->d_inode, &dotdot, 1);
138
139 if (!inode)
140 return ERR_PTR(-ENOENT);
141 /* 135 /*
142 * In case of an error, @inode carries the error value, and we 136 * XXX(hch): it would be a good idea to keep this around as a
143 * have to return that as a(n invalid) pointer to dentry. 137 * static variable.
144 */ 138 */
145 if (IS_ERR(inode)) 139 gfs2_str2qstr(&dotdot, "..");
146 return ERR_CAST(inode);
147
148 dentry = d_alloc_anon(inode);
149 if (!dentry) {
150 iput(inode);
151 return ERR_PTR(-ENOMEM);
152 }
153 140
154 dentry->d_op = &gfs2_dops; 141 dentry = d_obtain_alias(gfs2_lookupi(child->d_inode, &dotdot, 1));
142 if (!IS_ERR(dentry))
143 dentry->d_op = &gfs2_dops;
155 return dentry; 144 return dentry;
156} 145}
157 146
@@ -233,13 +222,9 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb,
233 gfs2_glock_dq_uninit(&i_gh); 222 gfs2_glock_dq_uninit(&i_gh);
234 223
235out_inode: 224out_inode:
236 dentry = d_alloc_anon(inode); 225 dentry = d_obtain_alias(inode);
237 if (!dentry) { 226 if (!IS_ERR(dentry))
238 iput(inode); 227 dentry->d_op = &gfs2_dops;
239 return ERR_PTR(-ENOMEM);
240 }
241
242 dentry->d_op = &gfs2_dops;
243 return dentry; 228 return dentry;
244 229
245fail_rgd: 230fail_rgd: