Commit 93d84b6d99f5ddb911b318990c759a0fefa0f7ea
Committed by
Frederic Weisbecker
1 parent
1977bb2ed8
Exists in
master
and in
7 other branches
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>
Showing 4 changed files with 19 additions and 14 deletions Side-by-side Diff
fs/ncpfs/dir.c
fs/ncpfs/file.c
fs/ncpfs/ioctl.c
... | ... | @@ -20,6 +20,7 @@ |
20 | 20 | #include <linux/smp_lock.h> |
21 | 21 | #include <linux/vmalloc.h> |
22 | 22 | #include <linux/sched.h> |
23 | +#include <linux/smp_lock.h> | |
23 | 24 | |
24 | 25 | #include <linux/ncp_fs.h> |
25 | 26 | |
26 | 27 | |
... | ... | @@ -261,9 +262,9 @@ |
261 | 262 | } |
262 | 263 | #endif /* CONFIG_NCPFS_NLS */ |
263 | 264 | |
264 | -static int __ncp_ioctl(struct inode *inode, struct file *filp, | |
265 | - unsigned int cmd, unsigned long arg) | |
265 | +static long __ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |
266 | 266 | { |
267 | + struct inode *inode = filp->f_dentry->d_inode; | |
267 | 268 | struct ncp_server *server = NCP_SERVER(inode); |
268 | 269 | int result; |
269 | 270 | struct ncp_ioctl_request request; |
270 | 271 | |
271 | 272 | |
... | ... | @@ -841,11 +842,11 @@ |
841 | 842 | } |
842 | 843 | } |
843 | 844 | |
844 | -int ncp_ioctl(struct inode *inode, struct file *filp, | |
845 | - unsigned int cmd, unsigned long arg) | |
845 | +long ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |
846 | 846 | { |
847 | - int ret; | |
847 | + long ret; | |
848 | 848 | |
849 | + lock_kernel(); | |
849 | 850 | if (ncp_ioctl_need_write(cmd)) { |
850 | 851 | /* |
851 | 852 | * inside the ioctl(), any failures which |
852 | 853 | |
853 | 854 | |
854 | 855 | |
855 | 856 | |
... | ... | @@ -853,24 +854,28 @@ |
853 | 854 | * -EACCESS, so it seems consistent to keep |
854 | 855 | * that here. |
855 | 856 | */ |
856 | - if (mnt_want_write(filp->f_path.mnt)) | |
857 | - return -EACCES; | |
857 | + if (mnt_want_write(filp->f_path.mnt)) { | |
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 | 863 | if (ncp_ioctl_need_write(cmd)) |
861 | 864 | mnt_drop_write(filp->f_path.mnt); |
865 | + | |
866 | +out: | |
867 | + unlock_kernel(); | |
862 | 868 | return ret; |
863 | 869 | } |
864 | 870 | |
865 | 871 | #ifdef CONFIG_COMPAT |
866 | 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; | |
869 | - int ret; | |
874 | + long ret; | |
870 | 875 | |
871 | 876 | lock_kernel(); |
872 | 877 | arg = (unsigned long) compat_ptr(arg); |
873 | - ret = ncp_ioctl(inode, file, cmd, arg); | |
878 | + ret = ncp_ioctl(file, cmd, arg); | |
874 | 879 | unlock_kernel(); |
875 | 880 | return ret; |
876 | 881 | } |
include/linux/ncp_fs.h
... | ... | @@ -210,7 +210,7 @@ |
210 | 210 | void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); |
211 | 211 | |
212 | 212 | /* linux/fs/ncpfs/ioctl.c */ |
213 | -int ncp_ioctl(struct inode *, struct file *, unsigned int, unsigned long); | |
213 | +long ncp_ioctl(struct file *, unsigned int, unsigned long); | |
214 | 214 | long ncp_compat_ioctl(struct file *, unsigned int, unsigned long); |
215 | 215 | |
216 | 216 | /* linux/fs/ncpfs/sock.c */ |