aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/autofs4/inode.c')
-rw-r--r--fs/autofs4/inode.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index a7bdb9dcac84..9e1a9dad23e1 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -45,7 +45,6 @@ struct autofs_info *autofs4_init_ino(struct autofs_info *ino,
45 45
46 if (!reinit) { 46 if (!reinit) {
47 ino->flags = 0; 47 ino->flags = 0;
48 ino->inode = NULL;
49 ino->dentry = NULL; 48 ino->dentry = NULL;
50 ino->size = 0; 49 ino->size = 0;
51 INIT_LIST_HEAD(&ino->active); 50 INIT_LIST_HEAD(&ino->active);
@@ -76,19 +75,8 @@ struct autofs_info *autofs4_init_ino(struct autofs_info *ino,
76 75
77void autofs4_free_ino(struct autofs_info *ino) 76void autofs4_free_ino(struct autofs_info *ino)
78{ 77{
79 struct autofs_info *p_ino;
80
81 if (ino->dentry) { 78 if (ino->dentry) {
82 ino->dentry->d_fsdata = NULL; 79 ino->dentry->d_fsdata = NULL;
83 if (ino->dentry->d_inode) {
84 struct dentry *parent = ino->dentry->d_parent;
85 if (atomic_dec_and_test(&ino->count)) {
86 p_ino = autofs4_dentry_ino(parent);
87 if (p_ino && parent != ino->dentry)
88 atomic_dec(&p_ino->count);
89 }
90 dput(ino->dentry);
91 }
92 ino->dentry = NULL; 80 ino->dentry = NULL;
93 } 81 }
94 if (ino->free) 82 if (ino->free)
@@ -251,10 +239,6 @@ static struct autofs_info *autofs4_mkroot(struct autofs_sb_info *sbi)
251 return ino; 239 return ino;
252} 240}
253 241
254static const struct dentry_operations autofs4_sb_dentry_operations = {
255 .d_release = autofs4_dentry_release,
256};
257
258int autofs4_fill_super(struct super_block *s, void *data, int silent) 242int autofs4_fill_super(struct super_block *s, void *data, int silent)
259{ 243{
260 struct inode * root_inode; 244 struct inode * root_inode;
@@ -292,6 +276,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
292 s->s_blocksize_bits = 10; 276 s->s_blocksize_bits = 10;
293 s->s_magic = AUTOFS_SUPER_MAGIC; 277 s->s_magic = AUTOFS_SUPER_MAGIC;
294 s->s_op = &autofs4_sops; 278 s->s_op = &autofs4_sops;
279 s->s_d_op = &autofs4_dentry_operations;
295 s->s_time_gran = 1; 280 s->s_time_gran = 1;
296 281
297 /* 282 /*
@@ -309,7 +294,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
309 goto fail_iput; 294 goto fail_iput;
310 pipe = NULL; 295 pipe = NULL;
311 296
312 d_set_d_op(root, &autofs4_sb_dentry_operations);
313 root->d_fsdata = ino; 297 root->d_fsdata = ino;
314 298
315 /* Can this call block? */ 299 /* Can this call block? */
@@ -320,10 +304,11 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
320 goto fail_dput; 304 goto fail_dput;
321 } 305 }
322 306
307 if (autofs_type_trigger(sbi->type))
308 __managed_dentry_set_managed(root);
309
323 root_inode->i_fop = &autofs4_root_operations; 310 root_inode->i_fop = &autofs4_root_operations;
324 root_inode->i_op = autofs_type_trigger(sbi->type) ? 311 root_inode->i_op = &autofs4_dir_inode_operations;
325 &autofs4_direct_root_inode_operations :
326 &autofs4_indirect_root_inode_operations;
327 312
328 /* Couldn't this be tested earlier? */ 313 /* Couldn't this be tested earlier? */
329 if (sbi->max_proto < AUTOFS_MIN_PROTO_VERSION || 314 if (sbi->max_proto < AUTOFS_MIN_PROTO_VERSION ||
@@ -391,7 +376,6 @@ struct inode *autofs4_get_inode(struct super_block *sb,
391 if (inode == NULL) 376 if (inode == NULL)
392 return NULL; 377 return NULL;
393 378
394 inf->inode = inode;
395 inode->i_mode = inf->mode; 379 inode->i_mode = inf->mode;
396 if (sb->s_root) { 380 if (sb->s_root) {
397 inode->i_uid = sb->s_root->d_inode->i_uid; 381 inode->i_uid = sb->s_root->d_inode->i_uid;