aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2011-01-15 05:51:57 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2011-01-15 20:07:49 -0500
commitb650c858c26bd9ba29ebc82d30f09355845a294a (patch)
treecd3749a722a81425263e3a2b1d82898586665acf /fs/autofs4
parentea5b778a8b98c85a87d66bf844904f9c3802b869 (diff)
autofs4: Merge the remaining dentry ops tables
Merge the remaining autofs4 dentry ops tables. It doesn't matter if d_automount and d_manage are present on something that's not mountable or holdable as these ops are only used if the appropriate flags are set in dentry->d_flags. [AV] switch to ->s_d_op, since now _everything_ on autofs4 is using the same dentry_operations. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/autofs4')
-rw-r--r--fs/autofs4/autofs_i.h1
-rw-r--r--fs/autofs4/inode.c6
-rw-r--r--fs/autofs4/root.c17
3 files changed, 4 insertions, 20 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index c28085cb82a..1f016bfb42d 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -207,7 +207,6 @@ extern const struct inode_operations autofs4_dir_inode_operations;
207extern const struct file_operations autofs4_dir_operations; 207extern const struct file_operations autofs4_dir_operations;
208extern const struct file_operations autofs4_root_operations; 208extern const struct file_operations autofs4_root_operations;
209extern const struct dentry_operations autofs4_dentry_operations; 209extern const struct dentry_operations autofs4_dentry_operations;
210extern const struct dentry_operations autofs4_mount_dentry_operations;
211 210
212/* VFS automount flags management functions */ 211/* VFS automount flags management functions */
213 212
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 3ecd2e2bcdb..9e1a9dad23e 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -276,6 +276,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
276 s->s_blocksize_bits = 10; 276 s->s_blocksize_bits = 10;
277 s->s_magic = AUTOFS_SUPER_MAGIC; 277 s->s_magic = AUTOFS_SUPER_MAGIC;
278 s->s_op = &autofs4_sops; 278 s->s_op = &autofs4_sops;
279 s->s_d_op = &autofs4_dentry_operations;
279 s->s_time_gran = 1; 280 s->s_time_gran = 1;
280 281
281 /* 282 /*
@@ -293,7 +294,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
293 goto fail_iput; 294 goto fail_iput;
294 pipe = NULL; 295 pipe = NULL;
295 296
296 d_set_d_op(root, &autofs4_dentry_operations);
297 root->d_fsdata = ino; 297 root->d_fsdata = ino;
298 298
299 /* Can this call block? */ 299 /* Can this call block? */
@@ -304,10 +304,8 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
304 goto fail_dput; 304 goto fail_dput;
305 } 305 }
306 306
307 if (autofs_type_trigger(sbi->type)) { 307 if (autofs_type_trigger(sbi->type))
308 d_set_d_op(root, &autofs4_mount_dentry_operations);
309 __managed_dentry_set_managed(root); 308 __managed_dentry_set_managed(root);
310 }
311 309
312 root_inode->i_fop = &autofs4_root_operations; 310 root_inode->i_fop = &autofs4_root_operations;
313 root_inode->i_op = &autofs4_dir_inode_operations; 311 root_inode->i_op = &autofs4_dir_inode_operations;
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index dbd95512808..1dba035fc37 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -66,13 +66,7 @@ const struct inode_operations autofs4_dir_inode_operations = {
66 .rmdir = autofs4_dir_rmdir, 66 .rmdir = autofs4_dir_rmdir,
67}; 67};
68 68
69/* For dentries that don't initiate mounting */
70const struct dentry_operations autofs4_dentry_operations = { 69const struct dentry_operations autofs4_dentry_operations = {
71 .d_release = autofs4_dentry_release,
72};
73
74/* For dentries that do initiate mounting */
75const struct dentry_operations autofs4_mount_dentry_operations = {
76 .d_automount = autofs4_d_automount, 70 .d_automount = autofs4_d_automount,
77 .d_manage = autofs4_d_manage, 71 .d_manage = autofs4_d_manage,
78 .d_release = autofs4_dentry_release, 72 .d_release = autofs4_dentry_release,
@@ -500,8 +494,6 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
500 if (active) { 494 if (active) {
501 return active; 495 return active;
502 } else { 496 } else {
503 d_set_d_op(dentry, &autofs4_dentry_operations);
504
505 /* 497 /*
506 * A dentry that is not within the root can never trigger a 498 * A dentry that is not within the root can never trigger a
507 * mount operation, unless the directory already exists, so we 499 * mount operation, unless the directory already exists, so we
@@ -512,10 +504,8 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
512 return ERR_PTR(-ENOENT); 504 return ERR_PTR(-ENOENT);
513 505
514 /* Mark entries in the root as mount triggers */ 506 /* Mark entries in the root as mount triggers */
515 if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent)) { 507 if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent))
516 d_set_d_op(dentry, &autofs4_mount_dentry_operations);
517 __managed_dentry_set_managed(dentry); 508 __managed_dentry_set_managed(dentry);
518 }
519 509
520 ino = autofs4_init_ino(NULL, sbi, 0555); 510 ino = autofs4_init_ino(NULL, sbi, 0555);
521 if (!ino) 511 if (!ino)
@@ -572,8 +562,6 @@ static int autofs4_dir_symlink(struct inode *dir,
572 } 562 }
573 d_add(dentry, inode); 563 d_add(dentry, inode);
574 564
575 d_set_d_op(dentry, &autofs4_dentry_operations);
576
577 dentry->d_fsdata = ino; 565 dentry->d_fsdata = ino;
578 ino->dentry = dget(dentry); 566 ino->dentry = dget(dentry);
579 atomic_inc(&ino->count); 567 atomic_inc(&ino->count);
@@ -848,8 +836,7 @@ static inline int autofs4_ask_umount(struct vfsmount *mnt, int __user *p)
848int is_autofs4_dentry(struct dentry *dentry) 836int is_autofs4_dentry(struct dentry *dentry)
849{ 837{
850 return dentry && dentry->d_inode && 838 return dentry && dentry->d_inode &&
851 (dentry->d_op == &autofs4_mount_dentry_operations || 839 dentry->d_op == &autofs4_dentry_operations &&
852 dentry->d_op == &autofs4_dentry_operations) &&
853 dentry->d_fsdata != NULL; 840 dentry->d_fsdata != NULL;
854} 841}
855 842