Commit b650c858 authored by David Howells's avatar David Howells Committed by Al Viro

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: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent ea5b778a
...@@ -207,7 +207,6 @@ extern const struct inode_operations autofs4_dir_inode_operations; ...@@ -207,7 +207,6 @@ extern const struct inode_operations autofs4_dir_inode_operations;
extern const struct file_operations autofs4_dir_operations; extern const struct file_operations autofs4_dir_operations;
extern const struct file_operations autofs4_root_operations; extern const struct file_operations autofs4_root_operations;
extern const struct dentry_operations autofs4_dentry_operations; extern const struct dentry_operations autofs4_dentry_operations;
extern const struct dentry_operations autofs4_mount_dentry_operations;
/* VFS automount flags management functions */ /* VFS automount flags management functions */
......
...@@ -276,6 +276,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) ...@@ -276,6 +276,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
s->s_blocksize_bits = 10; s->s_blocksize_bits = 10;
s->s_magic = AUTOFS_SUPER_MAGIC; s->s_magic = AUTOFS_SUPER_MAGIC;
s->s_op = &autofs4_sops; s->s_op = &autofs4_sops;
s->s_d_op = &autofs4_dentry_operations;
s->s_time_gran = 1; s->s_time_gran = 1;
/* /*
...@@ -293,7 +294,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) ...@@ -293,7 +294,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
goto fail_iput; goto fail_iput;
pipe = NULL; pipe = NULL;
d_set_d_op(root, &autofs4_dentry_operations);
root->d_fsdata = ino; root->d_fsdata = ino;
/* Can this call block? */ /* Can this call block? */
...@@ -304,10 +304,8 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) ...@@ -304,10 +304,8 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
goto fail_dput; goto fail_dput;
} }
if (autofs_type_trigger(sbi->type)) { if (autofs_type_trigger(sbi->type))
d_set_d_op(root, &autofs4_mount_dentry_operations);
__managed_dentry_set_managed(root); __managed_dentry_set_managed(root);
}
root_inode->i_fop = &autofs4_root_operations; root_inode->i_fop = &autofs4_root_operations;
root_inode->i_op = &autofs4_dir_inode_operations; root_inode->i_op = &autofs4_dir_inode_operations;
......
...@@ -66,13 +66,7 @@ const struct inode_operations autofs4_dir_inode_operations = { ...@@ -66,13 +66,7 @@ const struct inode_operations autofs4_dir_inode_operations = {
.rmdir = autofs4_dir_rmdir, .rmdir = autofs4_dir_rmdir,
}; };
/* For dentries that don't initiate mounting */
const struct dentry_operations autofs4_dentry_operations = { const struct dentry_operations autofs4_dentry_operations = {
.d_release = autofs4_dentry_release,
};
/* For dentries that do initiate mounting */
const struct dentry_operations autofs4_mount_dentry_operations = {
.d_automount = autofs4_d_automount, .d_automount = autofs4_d_automount,
.d_manage = autofs4_d_manage, .d_manage = autofs4_d_manage,
.d_release = autofs4_dentry_release, .d_release = autofs4_dentry_release,
...@@ -500,8 +494,6 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s ...@@ -500,8 +494,6 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
if (active) { if (active) {
return active; return active;
} else { } else {
d_set_d_op(dentry, &autofs4_dentry_operations);
/* /*
* A dentry that is not within the root can never trigger a * A dentry that is not within the root can never trigger a
* mount operation, unless the directory already exists, so we * 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,10 +504,8 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
return ERR_PTR(-ENOENT); return ERR_PTR(-ENOENT);
/* Mark entries in the root as mount triggers */ /* Mark entries in the root as mount triggers */
if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent)) { if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent))
d_set_d_op(dentry, &autofs4_mount_dentry_operations);
__managed_dentry_set_managed(dentry); __managed_dentry_set_managed(dentry);
}
ino = autofs4_init_ino(NULL, sbi, 0555); ino = autofs4_init_ino(NULL, sbi, 0555);
if (!ino) if (!ino)
...@@ -572,8 +562,6 @@ static int autofs4_dir_symlink(struct inode *dir, ...@@ -572,8 +562,6 @@ static int autofs4_dir_symlink(struct inode *dir,
} }
d_add(dentry, inode); d_add(dentry, inode);
d_set_d_op(dentry, &autofs4_dentry_operations);
dentry->d_fsdata = ino; dentry->d_fsdata = ino;
ino->dentry = dget(dentry); ino->dentry = dget(dentry);
atomic_inc(&ino->count); atomic_inc(&ino->count);
...@@ -848,8 +836,7 @@ static inline int autofs4_ask_umount(struct vfsmount *mnt, int __user *p) ...@@ -848,8 +836,7 @@ static inline int autofs4_ask_umount(struct vfsmount *mnt, int __user *p)
int is_autofs4_dentry(struct dentry *dentry) int is_autofs4_dentry(struct dentry *dentry)
{ {
return dentry && dentry->d_inode && return dentry && dentry->d_inode &&
(dentry->d_op == &autofs4_mount_dentry_operations || dentry->d_op == &autofs4_dentry_operations &&
dentry->d_op == &autofs4_dentry_operations) &&
dentry->d_fsdata != NULL; dentry->d_fsdata != NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment