aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4
diff options
context:
space:
mode:
Diffstat (limited to 'fs/autofs4')
-rw-r--r--fs/autofs4/root.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index cb1bd38dc08c..d5c1401f0031 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -19,7 +19,7 @@
19#include <linux/param.h> 19#include <linux/param.h>
20#include <linux/time.h> 20#include <linux/time.h>
21#include <linux/compat.h> 21#include <linux/compat.h>
22#include <linux/smp_lock.h> 22#include <linux/mutex.h>
23 23
24#include "autofs_i.h" 24#include "autofs_i.h"
25 25
@@ -28,7 +28,9 @@ static int autofs4_dir_unlink(struct inode *,struct dentry *);
28static int autofs4_dir_rmdir(struct inode *,struct dentry *); 28static int autofs4_dir_rmdir(struct inode *,struct dentry *);
29static int autofs4_dir_mkdir(struct inode *,struct dentry *,int); 29static int autofs4_dir_mkdir(struct inode *,struct dentry *,int);
30static long autofs4_root_ioctl(struct file *,unsigned int,unsigned long); 30static long autofs4_root_ioctl(struct file *,unsigned int,unsigned long);
31#ifdef CONFIG_COMPAT
31static long autofs4_root_compat_ioctl(struct file *,unsigned int,unsigned long); 32static long autofs4_root_compat_ioctl(struct file *,unsigned int,unsigned long);
33#endif
32static int autofs4_dir_open(struct inode *inode, struct file *file); 34static int autofs4_dir_open(struct inode *inode, struct file *file);
33static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *); 35static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *);
34static void *autofs4_follow_link(struct dentry *, struct nameidata *); 36static void *autofs4_follow_link(struct dentry *, struct nameidata *);
@@ -978,15 +980,17 @@ static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp,
978 } 980 }
979} 981}
980 982
983static DEFINE_MUTEX(autofs4_ioctl_mutex);
984
981static long autofs4_root_ioctl(struct file *filp, 985static long autofs4_root_ioctl(struct file *filp,
982 unsigned int cmd, unsigned long arg) 986 unsigned int cmd, unsigned long arg)
983{ 987{
984 long ret; 988 long ret;
985 struct inode *inode = filp->f_dentry->d_inode; 989 struct inode *inode = filp->f_dentry->d_inode;
986 990
987 lock_kernel(); 991 mutex_lock(&autofs4_ioctl_mutex);
988 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); 992 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
989 unlock_kernel(); 993 mutex_unlock(&autofs4_ioctl_mutex);
990 994
991 return ret; 995 return ret;
992} 996}
@@ -998,13 +1002,13 @@ static long autofs4_root_compat_ioctl(struct file *filp,
998 struct inode *inode = filp->f_path.dentry->d_inode; 1002 struct inode *inode = filp->f_path.dentry->d_inode;
999 int ret; 1003 int ret;
1000 1004
1001 lock_kernel(); 1005 mutex_lock(&autofs4_ioctl_mutex);
1002 if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL) 1006 if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL)
1003 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); 1007 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
1004 else 1008 else
1005 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, 1009 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd,
1006 (unsigned long)compat_ptr(arg)); 1010 (unsigned long)compat_ptr(arg));
1007 unlock_kernel(); 1011 mutex_unlock(&autofs4_ioctl_mutex);
1008 1012
1009 return ret; 1013 return ret;
1010} 1014}