diff options
author | John Kacur <jkacur@redhat.com> | 2010-05-05 09:15:37 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2010-05-16 23:27:42 -0400 |
commit | 93d84b6d99f5ddb911b318990c759a0fefa0f7ea (patch) | |
tree | 5fab098d57799d8889b0e419a5cd411d318a6b14 /fs/ncpfs | |
parent | 1977bb2ed8ffdd161fe1c9eef1f9fd283e41d4b5 (diff) |
ncpfs: BKL ioctl pushdown
Convert ncp_ioctl to an unlocked_ioctl and push down the bkl into it.
Signed-off-by: John Kacur <jkacur@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Petr Vandrovec <vandrove@vc.cvut.cz>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'fs/ncpfs')
-rw-r--r-- | fs/ncpfs/dir.c | 2 | ||||
-rw-r--r-- | fs/ncpfs/file.c | 2 | ||||
-rw-r--r-- | fs/ncpfs/ioctl.c | 27 |
3 files changed, 18 insertions, 13 deletions
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index 7edfcd4d5e52..92dde6f8d893 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c | |||
@@ -51,7 +51,7 @@ const struct file_operations ncp_dir_operations = | |||
51 | { | 51 | { |
52 | .read = generic_read_dir, | 52 | .read = generic_read_dir, |
53 | .readdir = ncp_readdir, | 53 | .readdir = ncp_readdir, |
54 | .ioctl = ncp_ioctl, | 54 | .unlocked_ioctl = ncp_ioctl, |
55 | #ifdef CONFIG_COMPAT | 55 | #ifdef CONFIG_COMPAT |
56 | .compat_ioctl = ncp_compat_ioctl, | 56 | .compat_ioctl = ncp_compat_ioctl, |
57 | #endif | 57 | #endif |
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c index 1daabb90e0a5..b93870892892 100644 --- a/fs/ncpfs/file.c +++ b/fs/ncpfs/file.c | |||
@@ -295,7 +295,7 @@ const struct file_operations ncp_file_operations = | |||
295 | .llseek = ncp_remote_llseek, | 295 | .llseek = ncp_remote_llseek, |
296 | .read = ncp_file_read, | 296 | .read = ncp_file_read, |
297 | .write = ncp_file_write, | 297 | .write = ncp_file_write, |
298 | .ioctl = ncp_ioctl, | 298 | .unlocked_ioctl = ncp_ioctl, |
299 | #ifdef CONFIG_COMPAT | 299 | #ifdef CONFIG_COMPAT |
300 | .compat_ioctl = ncp_compat_ioctl, | 300 | .compat_ioctl = ncp_compat_ioctl, |
301 | #endif | 301 | #endif |
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index 60a5e2864ea8..023c03d02070 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/smp_lock.h> | 20 | #include <linux/smp_lock.h> |
21 | #include <linux/vmalloc.h> | 21 | #include <linux/vmalloc.h> |
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/smp_lock.h> | ||
23 | 24 | ||
24 | #include <linux/ncp_fs.h> | 25 | #include <linux/ncp_fs.h> |
25 | 26 | ||
@@ -261,9 +262,9 @@ ncp_get_charsets(struct ncp_server* server, struct ncp_nls_ioctl __user *arg) | |||
261 | } | 262 | } |
262 | #endif /* CONFIG_NCPFS_NLS */ | 263 | #endif /* CONFIG_NCPFS_NLS */ |
263 | 264 | ||
264 | static int __ncp_ioctl(struct inode *inode, struct file *filp, | 265 | static long __ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
265 | unsigned int cmd, unsigned long arg) | ||
266 | { | 266 | { |
267 | struct inode *inode = filp->f_dentry->d_inode; | ||
267 | struct ncp_server *server = NCP_SERVER(inode); | 268 | struct ncp_server *server = NCP_SERVER(inode); |
268 | int result; | 269 | int result; |
269 | struct ncp_ioctl_request request; | 270 | struct ncp_ioctl_request request; |
@@ -841,11 +842,11 @@ static int ncp_ioctl_need_write(unsigned int cmd) | |||
841 | } | 842 | } |
842 | } | 843 | } |
843 | 844 | ||
844 | int ncp_ioctl(struct inode *inode, struct file *filp, | 845 | long ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
845 | unsigned int cmd, unsigned long arg) | ||
846 | { | 846 | { |
847 | int ret; | 847 | long ret; |
848 | 848 | ||
849 | lock_kernel(); | ||
849 | if (ncp_ioctl_need_write(cmd)) { | 850 | if (ncp_ioctl_need_write(cmd)) { |
850 | /* | 851 | /* |
851 | * inside the ioctl(), any failures which | 852 | * inside the ioctl(), any failures which |
@@ -853,24 +854,28 @@ int ncp_ioctl(struct inode *inode, struct file *filp, | |||
853 | * -EACCESS, so it seems consistent to keep | 854 | * -EACCESS, so it seems consistent to keep |
854 | * that here. | 855 | * that here. |
855 | */ | 856 | */ |
856 | if (mnt_want_write(filp->f_path.mnt)) | 857 | if (mnt_want_write(filp->f_path.mnt)) { |
857 | return -EACCES; | 858 | ret = -EACCES; |
859 | goto out; | ||
860 | } | ||
858 | } | 861 | } |
859 | ret = __ncp_ioctl(inode, filp, cmd, arg); | 862 | ret = __ncp_ioctl(filp, cmd, arg); |
860 | if (ncp_ioctl_need_write(cmd)) | 863 | if (ncp_ioctl_need_write(cmd)) |
861 | mnt_drop_write(filp->f_path.mnt); | 864 | mnt_drop_write(filp->f_path.mnt); |
865 | |||
866 | out: | ||
867 | unlock_kernel(); | ||
862 | return ret; | 868 | return ret; |
863 | } | 869 | } |
864 | 870 | ||
865 | #ifdef CONFIG_COMPAT | 871 | #ifdef CONFIG_COMPAT |
866 | long ncp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 872 | long ncp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
867 | { | 873 | { |
868 | struct inode *inode = file->f_path.dentry->d_inode; | 874 | long ret; |
869 | int ret; | ||
870 | 875 | ||
871 | lock_kernel(); | 876 | lock_kernel(); |
872 | arg = (unsigned long) compat_ptr(arg); | 877 | arg = (unsigned long) compat_ptr(arg); |
873 | ret = ncp_ioctl(inode, file, cmd, arg); | 878 | ret = ncp_ioctl(file, cmd, arg); |
874 | unlock_kernel(); | 879 | unlock_kernel(); |
875 | return ret; | 880 | return ret; |
876 | } | 881 | } |