aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/autofs4/root.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index cb1bd38dc08c..9dd29c29fd12 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
@@ -978,15 +978,17 @@ static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp,
978 } 978 }
979} 979}
980 980
981static DEFINE_MUTEX(autofs4_ioctl_mutex);
982
981static long autofs4_root_ioctl(struct file *filp, 983static long autofs4_root_ioctl(struct file *filp,
982 unsigned int cmd, unsigned long arg) 984 unsigned int cmd, unsigned long arg)
983{ 985{
984 long ret; 986 long ret;
985 struct inode *inode = filp->f_dentry->d_inode; 987 struct inode *inode = filp->f_dentry->d_inode;
986 988
987 lock_kernel(); 989 mutex_lock(&autofs4_ioctl_mutex);
988 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); 990 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
989 unlock_kernel(); 991 mutex_unlock(&autofs4_ioctl_mutex);
990 992
991 return ret; 993 return ret;
992} 994}
@@ -998,13 +1000,13 @@ static long autofs4_root_compat_ioctl(struct file *filp,
998 struct inode *inode = filp->f_path.dentry->d_inode; 1000 struct inode *inode = filp->f_path.dentry->d_inode;
999 int ret; 1001 int ret;
1000 1002
1001 lock_kernel(); 1003 mutex_lock(&autofs4_ioctl_mutex);
1002 if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL) 1004 if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL)
1003 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); 1005 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
1004 else 1006 else
1005 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, 1007 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd,
1006 (unsigned long)compat_ptr(arg)); 1008 (unsigned long)compat_ptr(arg));
1007 unlock_kernel(); 1009 mutex_unlock(&autofs4_ioctl_mutex);
1008 1010
1009 return ret; 1011 return ret;
1010} 1012}