From 00e300e1b682ea86fcb5216250722afd42686ab3 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 14 Sep 2010 23:00:34 +0200 Subject: BKL: Remove BKL from autofs4 autofs4 uses the BKL only to guard its ioctl operations. This can be trivially converted to use a mutex, as we have done with most device drivers before. Signed-off-by: Arnd Bergmann Cc: "H. Peter Anvin" Cc: Ian Kent --- fs/autofs4/root.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'fs/autofs4/root.c') diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index cb1bd38dc08..9dd29c29fd1 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include "autofs_i.h" @@ -978,15 +978,17 @@ static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp, } } +static DEFINE_MUTEX(autofs4_ioctl_mutex); + static long autofs4_root_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { long ret; struct inode *inode = filp->f_dentry->d_inode; - lock_kernel(); + mutex_lock(&autofs4_ioctl_mutex); ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); - unlock_kernel(); + mutex_unlock(&autofs4_ioctl_mutex); return ret; } @@ -998,13 +1000,13 @@ static long autofs4_root_compat_ioctl(struct file *filp, struct inode *inode = filp->f_path.dentry->d_inode; int ret; - lock_kernel(); + mutex_lock(&autofs4_ioctl_mutex); if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL) ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); else ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, (unsigned long)compat_ptr(arg)); - unlock_kernel(); + mutex_unlock(&autofs4_ioctl_mutex); return ret; } -- cgit v1.2.3 From 5a44a73b9015e89cfb280ba0534dfcbf1ef29d05 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Fri, 24 Sep 2010 15:22:23 +0200 Subject: autofs4: Only declare function when CONFIG_COMPAT is defined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The patch solves the following warnings message when CONFIG_COMPAT is not defined: fs/autofs4/root.c:31: warning: ‘autofs4_root_compat_ioctl’ declared ‘static’ but never defined Signed-off-by: Felipe Contreras Cc: Ian Kent Cc: "H. Peter Anvin" Cc: Arnd Bergmann Signed-off-by: Frederic Weisbecker Signed-off-by: Arnd Bergmann --- fs/autofs4/root.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fs/autofs4/root.c') diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index 9dd29c29fd1..d5c1401f003 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c @@ -28,7 +28,9 @@ static int autofs4_dir_unlink(struct inode *,struct dentry *); static int autofs4_dir_rmdir(struct inode *,struct dentry *); static int autofs4_dir_mkdir(struct inode *,struct dentry *,int); static long autofs4_root_ioctl(struct file *,unsigned int,unsigned long); +#ifdef CONFIG_COMPAT static long autofs4_root_compat_ioctl(struct file *,unsigned int,unsigned long); +#endif static int autofs4_dir_open(struct inode *inode, struct file *file); static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *); static void *autofs4_follow_link(struct dentry *, struct nameidata *); -- cgit v1.2.3