[PATCH 7/7] smbfs: push down BKL into ioctl function

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Arnd Bergmann
Date: Tuesday, April 27, 2010 - 7:24 am

Converting from ->ioctl to ->unlocked_ioctl with explicit
lock_kernel lets us kill the ioctl operation.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/smbfs/dir.c   |    2 +-
 fs/smbfs/file.c  |    2 +-
 fs/smbfs/ioctl.c |    8 +++++---
 fs/smbfs/proto.h |    2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/fs/smbfs/dir.c b/fs/smbfs/dir.c
index 3e4803b..6c97842 100644
--- a/fs/smbfs/dir.c
+++ b/fs/smbfs/dir.c
@@ -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,
 };
 
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c
index dbf6548..84ecf0e 100644
--- a/fs/smbfs/file.c
+++ b/fs/smbfs/file.c
@@ -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,
diff --git a/fs/smbfs/ioctl.c b/fs/smbfs/ioctl.c
index 910215b..0721531 100644
--- a/fs/smbfs/ioctl.c
+++ b/fs/smbfs/ioctl.c
@@ -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>
@@ -22,14 +23,14 @@
 
 #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(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;
 }
diff --git a/fs/smbfs/proto.h b/fs/smbfs/proto.h
index 03f456c..05939a6 100644
--- a/fs/smbfs/proto.h
+++ b/fs/smbfs/proto.h
@@ -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);
-- 
1.6.3.3

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 08/10] v4l: always use unlocked_ioctl, John Kacur, (Tue Apr 27, 2:18 am)
Re: [PATCH 00/10] bkl: pushdowns from Arnd, and compile fixes, Frederic Weisbecker, (Tue Apr 27, 5:40 am)
Re: [PATCH 00/10] bkl: pushdowns from Arnd, and compile fixes, Frederic Weisbecker, (Tue Apr 27, 5:41 am)
Re: [PATCH 00/10] bkl: pushdowns from Arnd, and compile fixes, Geert Uytterhoeven, (Tue Apr 27, 5:51 am)
[PATCH 0/6] BKL pushdown into ioctl, continued, Arnd Bergmann, (Tue Apr 27, 7:24 am)
[PATCH 1/7] logfs: push down BKL into ioctl function, Arnd Bergmann, (Tue Apr 27, 7:24 am)
[PATCH 2/7] hfsplus: push down BKL into ioctl function, Arnd Bergmann, (Tue Apr 27, 7:24 am)
[PATCH 3/7] cris: push down BKL into some device drivers, Arnd Bergmann, (Tue Apr 27, 7:24 am)
[PATCH 4/7] sn_hwperf: kill BKL usage, Arnd Bergmann, (Tue Apr 27, 7:24 am)
[PATCH 5/7] um/mmapper: remove BKL usage, Arnd Bergmann, (Tue Apr 27, 7:24 am)
[PATCH 6/7] coda/psdev: remove BKL from ioctl function, Arnd Bergmann, (Tue Apr 27, 7:24 am)
[PATCH 7/7] smbfs: push down BKL into ioctl function, Arnd Bergmann, (Tue Apr 27, 7:24 am)
Re: [PATCH 1/7] logfs: push down BKL into ioctl function, Arnd Bergmann, (Tue Apr 27, 7:32 am)
Re: [PATCH 1/7] logfs: push down BKL into ioctl function, Arnd Bergmann, (Tue Apr 27, 8:05 am)
Re: [PATCH 1/7] logfs: push down BKL into ioctl function, Linus Torvalds, (Tue Apr 27, 8:36 am)
Re: [PATCH 1/7] logfs: push down BKL into ioctl function, Arnd Bergmann, (Tue Apr 27, 8:38 am)
Re: [PATCH 3/7] cris: push down BKL into some device drivers, Frederic Weisbecker, (Tue Apr 27, 10:22 am)
Re: [PATCH 1/7] logfs: push down BKL into ioctl function, Frederic Weisbecker, (Tue Apr 27, 12:59 pm)
Re: [PATCH 1/7] logfs: push down BKL into ioctl function, Frederic Weisbecker, (Tue Apr 27, 1:12 pm)
[PATCH] logfs: kill BKL, Arnd Bergmann, (Tue Apr 27, 1:30 pm)
Re: [PATCH 10/10] bkl: Fix-up compile problems as a result ..., Mauro Carvalho Chehab, (Wed Apr 28, 5:24 am)
Re: [PATCH 10/10] bkl: Fix-up compile problems as a result ..., Mauro Carvalho Chehab, (Wed Apr 28, 7:46 am)
Re: [PATCH 00/10] bkl: pushdowns from Arnd, and compile fixes, Frederic Weisbecker, (Wed Apr 28, 2:18 pm)
Re: [PATCH 10/10] bkl: Fix-up compile problems as a result ..., Frederic Weisbecker, (Wed Apr 28, 2:52 pm)
[PATCH 0/5] Pushdown bkl from v4l ioctls, Frederic Weisbecker, (Wed Apr 28, 8:42 pm)
[PATCH 1/5] v4l: Pushdown bkl into video_ioctl2, Frederic Weisbecker, (Wed Apr 28, 8:42 pm)
[PATCH 2/5] v4l: Use video_ioctl2_unlocked from drivers th ..., Frederic Weisbecker, (Wed Apr 28, 8:42 pm)
[PATCH 3/5] v4l: Change users of video_ioctl2 to use unloc ..., Frederic Weisbecker, (Wed Apr 28, 8:42 pm)
[PATCH 4/5] v4l: Pushdown bkl to drivers that implement th ..., Frederic Weisbecker, (Wed Apr 28, 8:42 pm)
[PATCH 5/5] v4l: Remove struct v4l2_file_operations::ioctl, Frederic Weisbecker, (Wed Apr 28, 8:42 pm)
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls, Hans Verkuil, (Wed Apr 28, 11:44 pm)
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls, Laurent Pinchart, (Thu Apr 29, 12:10 am)
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls, Arnd Bergmann, (Thu Apr 29, 12:38 am)
Re: [PATCH 3/7] cris: push down BKL into some device drivers, Jesper Nilsson, (Fri Apr 30, 12:53 am)
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls, Hans Verkuil, (Sat May 1, 2:55 am)
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls, Arnd Bergmann, (Sat May 1, 3:47 am)
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls, Alan Cox, (Sat May 1, 4:11 am)
Re: [PATCH 0/5] Pushdown bkl from v4l ioctls, Frederic Weisbecker, (Sat May 1, 7:58 am)
Re: [PATCH 3/7] cris: push down BKL into some device drivers, Frederic Weisbecker, (Sun May 16, 7:51 pm)
Re: [PATCH] logfs: kill BKL, Frederic Weisbecker, (Wed May 19, 5:51 am)