From b5b801779d59165c4ecf1009009109545bd1f642 Mon Sep 17 00:00:00 2001 From: Ian Kent Date: Fri, 14 Jan 2011 18:46:03 +0000 Subject: autofs4: Add d_manage() dentry operation This patch required a previous patch to add the ->d_automount() dentry operation. Add a function to use the newly defined ->d_manage() dentry operation for blocking during mount and expire. Whether the VFS calls the dentry operations d_automount() and d_manage() is controled by the DMANAGED_AUTOMOUNT and DMANAGED_TRANSIT flags. autofs uses the d_automount() operation to callback to user space to request mount operations and the d_manage() operation to block walks into mounts that are under construction or destruction. In order to prevent these functions from being called unnecessarily the DMANAGED_* flags are cleared for cases which would cause this. In the common case the DMANAGED_AUTOMOUNT and DMANAGED_TRANSIT flags are both set for dentrys waiting to be mounted. The DMANAGED_TRANSIT flag is cleared upon successful mount request completion and set during expire runs, both during the dentry expire check, and if selected for expire, is left set until a subsequent successful mount request completes. The exception to this is the so-called rootless multi-mount which has no actual mount at its base. In this case the DMANAGED_AUTOMOUNT flag is cleared upon successful mount request completion as well and set again after a successful expire. Signed-off-by: Ian Kent Signed-off-by: David Howells Signed-off-by: Al Viro --- fs/autofs4/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fs/autofs4/inode.c') diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index d0aa38cac302..75c1ed8e2fb9 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c @@ -253,6 +253,7 @@ static struct autofs_info *autofs4_mkroot(struct autofs_sb_info *sbi) static const struct dentry_operations autofs4_sb_dentry_operations = { .d_automount = autofs4_d_automount, + .d_manage = autofs4_d_manage, .d_release = autofs4_dentry_release, }; @@ -322,7 +323,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) } if (autofs_type_trigger(sbi->type)) - __managed_dentry_set_automount(root); + __managed_dentry_set_managed(root); root_inode->i_fop = &autofs4_root_operations; root_inode->i_op = autofs_type_trigger(sbi->type) ? -- cgit