smbfs: Push down BKL into ioctl function
authorArnd Bergmann <arnd@arndb.de>
Tue, 27 Apr 2010 14:24:25 +0000 (16:24 +0200)
committerFrederic Weisbecker <fweisbec@gmail.com>
Mon, 17 May 2010 03:27:04 +0000 (05:27 +0200)
Converting from ->ioctl to ->unlocked_ioctl with explicit
lock_kernel lets us kill the ioctl operation.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
[fixed inode reference in smb_ioctl]
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
fs/smbfs/dir.c
fs/smbfs/file.c
fs/smbfs/ioctl.c
fs/smbfs/proto.h

index 3e4803b4427e92e3fb4617ab278e4cc30902e52c..6c978428892d4de01c406a8abf3d7cc914fe8f5e 100644 (file)
@@ -39,7 +39,7 @@ const struct file_operations smb_dir_operations =
 {
        .read           = generic_read_dir,
        .readdir        = smb_readdir,
-       .ioctl          = smb_ioctl,
+       .unlocked_ioctl = smb_ioctl,
        .open           = smb_dir_open,
 };
 
index dbf6548bbf06b6bc761a38d05232d928ce61b866..84ecf0e43f91233d45c38cc07fbf2cbf07f3cfdb 100644 (file)
@@ -437,7 +437,7 @@ const struct file_operations smb_file_operations =
        .aio_read       = smb_file_aio_read,
        .write          = do_sync_write,
        .aio_write      = smb_file_aio_write,
-       .ioctl          = smb_ioctl,
+       .unlocked_ioctl = smb_ioctl,
        .mmap           = smb_file_mmap,
        .open           = smb_file_open,
        .release        = smb_file_release,
index dbae1f8ea26fad19d288e1093025d7b014cb0417..07215312ad397d8dbbf8bceadd4477676a99e929 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/time.h>
 #include <linux/mm.h>
 #include <linux/highuid.h>
+#include <linux/smp_lock.h>
 #include <linux/net.h>
 
 #include <linux/smb_fs.h>
 
 #include "proto.h"
 
-int
-smb_ioctl(struct inode *inode, struct file *filp,
-         unsigned int cmd, unsigned long arg)
+long
+smb_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-       struct smb_sb_info *server = server_from_inode(inode);
+       struct smb_sb_info *server = server_from_inode(filp->f_path.dentry->d_inode);
        struct smb_conn_opt opt;
        int result = -EINVAL;
 
+       lock_kernel();
        switch (cmd) {
                uid16_t uid16;
                uid_t uid32;
@@ -62,6 +63,7 @@ smb_ioctl(struct inode *inode, struct file *filp,
        default:
                break;
        }
+       unlock_kernel();
 
        return result;
 }
index 03f456c1b7d44cb6e5e7e9167fe9ece483ef2394..05939a6f43e625a28882d01b05a9e74135131de9 100644 (file)
@@ -67,7 +67,7 @@ extern const struct address_space_operations smb_file_aops;
 extern const struct file_operations smb_file_operations;
 extern const struct inode_operations smb_file_inode_operations;
 /* ioctl.c */
-extern int smb_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);
+extern long smb_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
 /* smbiod.c */
 extern void smbiod_wake_up(void);
 extern int smbiod_register_server(struct smb_sb_info *server);