cifs: timeout dfs automounts +little fix.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Igor Mammedov 2008-04-24 12:56:07 +04:00 committed by Al Viro
parent b69d3987f4
commit 78d31a3a87
3 changed files with 23 additions and 17 deletions

View File

@ -25,14 +25,26 @@
static LIST_HEAD(cifs_dfs_automount_list); static LIST_HEAD(cifs_dfs_automount_list);
/* static void cifs_dfs_expire_automounts(struct work_struct *work);
* DFS functions static DECLARE_DELAYED_WORK(cifs_dfs_automount_task,
*/ cifs_dfs_expire_automounts);
static int cifs_dfs_mountpoint_expiry_timeout = 500 * HZ;
void dfs_shrink_umount_helper(struct vfsmount *vfsmnt) static void cifs_dfs_expire_automounts(struct work_struct *work)
{ {
mark_mounts_for_expiry(&cifs_dfs_automount_list); struct list_head *list = &cifs_dfs_automount_list;
mark_mounts_for_expiry(&cifs_dfs_automount_list);
mark_mounts_for_expiry(list);
if (!list_empty(list))
schedule_delayed_work(&cifs_dfs_automount_task,
cifs_dfs_mountpoint_expiry_timeout);
}
void cifs_dfs_release_automount_timer(void)
{
BUG_ON(!list_empty(&cifs_dfs_automount_list));
cancel_delayed_work(&cifs_dfs_automount_task);
flush_scheduled_work();
} }
/** /**
@ -261,10 +273,11 @@ static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
err = do_add_mount(newmnt, nd, nd->path.mnt->mnt_flags, mntlist); err = do_add_mount(newmnt, nd, nd->path.mnt->mnt_flags, mntlist);
switch (err) { switch (err) {
case 0: case 0:
dput(nd->path.dentry); path_put(&nd->path);
mntput(nd->path.mnt);
nd->path.mnt = newmnt; nd->path.mnt = newmnt;
nd->path.dentry = dget(newmnt->mnt_root); nd->path.dentry = dget(newmnt->mnt_root);
schedule_delayed_work(&cifs_dfs_automount_task,
cifs_dfs_mountpoint_expiry_timeout);
break; break;
case -EBUSY: case -EBUSY:
/* someone else made a mount here whilst we were busy */ /* someone else made a mount here whilst we were busy */

View File

@ -471,8 +471,6 @@ static void cifs_umount_begin(struct vfsmount *vfsmnt, int flags)
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *tcon; struct cifsTconInfo *tcon;
dfs_shrink_umount_helper(vfsmnt);
if (!(flags & MNT_FORCE)) if (!(flags & MNT_FORCE))
return; return;
cifs_sb = CIFS_SB(vfsmnt->mnt_sb); cifs_sb = CIFS_SB(vfsmnt->mnt_sb);
@ -1100,6 +1098,7 @@ exit_cifs(void)
cFYI(DBG2, ("exit_cifs")); cFYI(DBG2, ("exit_cifs"));
cifs_proc_clean(); cifs_proc_clean();
#ifdef CONFIG_CIFS_DFS_UPCALL #ifdef CONFIG_CIFS_DFS_UPCALL
cifs_dfs_release_automount_timer();
unregister_key_type(&key_type_dns_resolver); unregister_key_type(&key_type_dns_resolver);
#endif #endif
#ifdef CONFIG_CIFS_UPCALL #ifdef CONFIG_CIFS_UPCALL

View File

@ -104,13 +104,7 @@ extern int mode_to_acl(struct inode *inode, const char *path, __u64);
extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *, extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *,
const char *); const char *);
extern int cifs_umount(struct super_block *, struct cifs_sb_info *); extern int cifs_umount(struct super_block *, struct cifs_sb_info *);
#ifdef CONFIG_CIFS_DFS_UPCALL extern void cifs_dfs_release_automount_timer(void);
extern void dfs_shrink_umount_helper(struct vfsmount *vfsmnt);
#else
static inline void dfs_shrink_umount_helper(struct vfsmount *vfsmnt)
{
}
#endif /* DFS_UPCALL */
void cifs_proc_init(void); void cifs_proc_init(void);
void cifs_proc_clean(void); void cifs_proc_clean(void);