mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: lkml <linux-kernel@vger.kernel.org>
Cc: John Kacur <jkacur@redhat.com>, Arnd Bergmann <arnd@arndb.de>,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Petr Vandrovec <vandrove@vc.cvut.cz>
Subject: [PATCH 4/6] ncpfs: BKL ioctl pushdown
Date: Wed,  5 May 2010 15:15:37 +0200	[thread overview]
Message-ID: <1273065339-21669-5-git-send-email-jkacur@redhat.com> (raw)
In-Reply-To: <1273065339-21669-1-git-send-email-jkacur@redhat.com>

Convert ncp_ioctl to an unlocked_ioctl and push down the bkl into it.

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 fs/ncpfs/dir.c         |    2 +-
 fs/ncpfs/file.c        |    2 +-
 fs/ncpfs/ioctl.c       |   27 ++++++++++++++++-----------
 include/linux/ncp_fs.h |    2 +-
 4 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index 7edfcd4..92dde6f 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -51,7 +51,7 @@ const struct file_operations ncp_dir_operations =
 {
 	.read		= generic_read_dir,
 	.readdir	= ncp_readdir,
-	.ioctl		= ncp_ioctl,
+	.unlocked_ioctl	= ncp_ioctl,
 #ifdef CONFIG_COMPAT
 	.compat_ioctl	= ncp_compat_ioctl,
 #endif
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c
index 1daabb9..b938708 100644
--- a/fs/ncpfs/file.c
+++ b/fs/ncpfs/file.c
@@ -295,7 +295,7 @@ const struct file_operations ncp_file_operations =
 	.llseek 	= ncp_remote_llseek,
 	.read		= ncp_file_read,
 	.write		= ncp_file_write,
-	.ioctl		= ncp_ioctl,
+	.unlocked_ioctl	= ncp_ioctl,
 #ifdef CONFIG_COMPAT
 	.compat_ioctl	= ncp_compat_ioctl,
 #endif
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c
index 60a5e28..023c03d 100644
--- a/fs/ncpfs/ioctl.c
+++ b/fs/ncpfs/ioctl.c
@@ -20,6 +20,7 @@
 #include <linux/smp_lock.h>
 #include <linux/vmalloc.h>
 #include <linux/sched.h>
+#include <linux/smp_lock.h>
 
 #include <linux/ncp_fs.h>
 
@@ -261,9 +262,9 @@ ncp_get_charsets(struct ncp_server* server, struct ncp_nls_ioctl __user *arg)
 }
 #endif /* CONFIG_NCPFS_NLS */
 
-static int __ncp_ioctl(struct inode *inode, struct file *filp,
-	      unsigned int cmd, unsigned long arg)
+static long __ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
+	struct inode *inode = filp->f_dentry->d_inode;
 	struct ncp_server *server = NCP_SERVER(inode);
 	int result;
 	struct ncp_ioctl_request request;
@@ -841,11 +842,11 @@ static int ncp_ioctl_need_write(unsigned int cmd)
 	}
 }
 
-int ncp_ioctl(struct inode *inode, struct file *filp,
-	      unsigned int cmd, unsigned long arg)
+long ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-	int ret;
+	long ret;
 
+	lock_kernel();
 	if (ncp_ioctl_need_write(cmd)) {
 		/*
 		 * inside the ioctl(), any failures which
@@ -853,24 +854,28 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
 		 * -EACCESS, so it seems consistent to keep
 		 *  that here.
 		 */
-		if (mnt_want_write(filp->f_path.mnt))
-			return -EACCES;
+		if (mnt_want_write(filp->f_path.mnt)) {
+			ret = -EACCES;
+			goto out;
+		}
 	}
-	ret = __ncp_ioctl(inode, filp, cmd, arg);
+	ret = __ncp_ioctl(filp, cmd, arg);
 	if (ncp_ioctl_need_write(cmd))
 		mnt_drop_write(filp->f_path.mnt);
+
+out:
+	unlock_kernel();
 	return ret;
 }
 
 #ifdef CONFIG_COMPAT
 long ncp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-	struct inode *inode = file->f_path.dentry->d_inode;
-	int ret;
+	long ret;
 
 	lock_kernel();
 	arg = (unsigned long) compat_ptr(arg);
-	ret = ncp_ioctl(inode, file, cmd, arg);
+	ret = ncp_ioctl(file, cmd, arg);
 	unlock_kernel();
 	return ret;
 }
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index 30b06c8..4522aed 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -210,7 +210,7 @@ int ncp_date_dos2unix(__le16 time, __le16 date);
 void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
 
 /* linux/fs/ncpfs/ioctl.c */
-int ncp_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
+long ncp_ioctl(struct file *, unsigned int, unsigned long);
 long ncp_compat_ioctl(struct file *, unsigned int, unsigned long);
 
 /* linux/fs/ncpfs/sock.c */
-- 
1.6.6.1


  parent reply	other threads:[~2010-05-05 13:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-05 13:15 [PATCH 0/6] " John Kacur
2010-05-05 13:15 ` [PATCH 1/6] coda: " John Kacur
2010-05-17  2:10   ` Frederic Weisbecker
2010-05-05 13:15 ` [PATCH 2/6] coda: Clean-up whitespace problems in pioctl.c John Kacur
2010-05-17  2:13   ` Frederic Weisbecker
2010-05-05 13:15 ` [PATCH 3/6] fat: BKL ioctl pushdown John Kacur
2010-05-05 16:04   ` OGAWA Hirofumi
2010-05-05 17:34     ` John Kacur
2010-05-05 18:30       ` OGAWA Hirofumi
2010-05-05 19:55         ` [PATCH] fat: convert to unlocked_ioctl Arnd Bergmann
2010-05-05 21:06           ` OGAWA Hirofumi
2010-05-05 20:16         ` [PATCH 3/6] fat: BKL ioctl pushdown John Kacur
2010-05-05 13:15 ` John Kacur [this message]
2010-05-17  2:24   ` [PATCH 4/6] ncpfs: " Frederic Weisbecker
2010-05-05 13:15 ` [PATCH 5/6] smbfs: " John Kacur
2010-05-17  2:26   ` Frederic Weisbecker
2010-05-17  2:35   ` Frederic Weisbecker
2010-05-17 11:46     ` John Kacur
2010-05-05 13:15 ` [PATCH 6/6] udf: " John Kacur
2010-05-05 14:39   ` Jan Kara
2010-05-11  7:08 ` [PATCH 0/6] " Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1273065339-21669-5-git-send-email-jkacur@redhat.com \
    --to=jkacur@redhat.com \
    --cc=arnd@arndb.de \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=vandrove@vc.cvut.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®