Skip to content

Commit

Permalink
BKL: Remove BKL from autofs4
Browse files Browse the repository at this point in the history
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 <arnd@arndb.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ian Kent <raven@themaw.net>
  • Loading branch information
Arnd Bergmann committed Oct 4, 2010
1 parent 4f819a7 commit 00e300e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions fs/autofs4/root.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <linux/param.h>
#include <linux/time.h>
#include <linux/compat.h>
#include <linux/smp_lock.h>
#include <linux/mutex.h>

#include "autofs_i.h"

Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 00e300e

Please sign in to comment.