From patchwork Fri Sep 17 12:38:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 65070 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1593BB70AE for ; Fri, 17 Sep 2010 22:38:25 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753344Ab0IQMiR (ORCPT ); Fri, 17 Sep 2010 08:38:17 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:64405 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751809Ab0IQMiQ (ORCPT ); Fri, 17 Sep 2010 08:38:16 -0400 Received: from klappe2.localnet (deibp9eh1--blueice3n2.emea.ibm.com [195.212.29.180]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0Lz0c4-1OjR660ShM-014Ied; Fri, 17 Sep 2010 14:38:07 +0200 From: Arnd Bergmann To: netdev@vger.kernel.org Subject: sunrpc: remove the big kernel lock Date: Fri, 17 Sep 2010 14:38:02 +0200 User-Agent: KMail/1.12.2 (Linux/2.6.35-16-generic; KDE/4.3.2; x86_64; ; ) Cc: Trond Myklebust , linux-nfs@vger.kernel.org, "J. Bruce Fields" , Neil Brown , linux-nfs@vger.kernel.org, David Miller MIME-Version: 1.0 Message-Id: <201009171438.02313.arnd@arndb.de> X-Provags-ID: V02:K0:e48lT4oZOJ6HrtgEml/LBJMaVi+0DLgFNv/UjZq0578 asGl8tBAIJj5h5ewIa4/rQvq3hPlug5EiW0PIpyK6nPWYtxKHx M+Hph9Utr8Yjstr2yp61M9JKamRGyDPJV0OTk6Qibl5jxGxqX+ DIJu+Fi6nywMMVCEQS/ksFRjjQWIXh1Ro4+wSbq8BopZH1+CU8 dvo7vTbibTNVPfdiCTR4A== Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The sunrpc cache_ioctl function does not need the big kernel lock because it uses its own queue_lock already. rpc_pipe_ioctl apparently should be using i_lock like the other operations on the pipe file descriptor do. Signed-off-by: Arnd Bergmann --- I missed this one because I considered the use of the BKL to be part of nfs/nfsd, but in this is really an unrelated usage. Please apply to an appropriate tree. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 5b7b56f..9e4827c 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -1426,15 +1425,10 @@ static unsigned int cache_poll_procfs(struct file *filp, poll_table *wait) static long cache_ioctl_procfs(struct file *filp, unsigned int cmd, unsigned long arg) { - long ret; struct inode *inode = filp->f_path.dentry->d_inode; struct cache_detail *cd = PDE(inode)->data; - lock_kernel(); - ret = cache_ioctl(inode, filp, cmd, arg, cd); - unlock_kernel(); - - return ret; + return cache_ioctl(inode, filp, cmd, arg, cd); } static int cache_open_procfs(struct inode *inode, struct file *filp) @@ -1634,13 +1628,8 @@ static long cache_ioctl_pipefs(struct file *filp, { struct inode *inode = filp->f_dentry->d_inode; struct cache_detail *cd = RPC_I(inode)->private; - long ret; - lock_kernel(); - ret = cache_ioctl(inode, filp, cmd, arg, cd); - unlock_kernel(); - - return ret; + return cache_ioctl(inode, filp, cmd, arg, cd); } static int cache_open_pipefs(struct inode *inode, struct file *filp) diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 8c8eef2..28bcd52 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c @@ -27,7 +27,6 @@ #include #include #include -#include static struct vfsmount *rpc_mount __read_mostly; static int rpc_mount_count; @@ -309,40 +308,33 @@ rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait) return mask; } -static int -rpc_pipe_ioctl_unlocked(struct file *filp, unsigned int cmd, unsigned long arg) +static long +rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { - struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode); + struct inode *inode = filp->f_path.dentry->d_inode; + struct rpc_inode *rpci = RPC_I(inode); int len; switch (cmd) { case FIONREAD: - if (rpci->ops == NULL) + spin_lock(&inode->i_lock); + if (rpci->ops == NULL) { + spin_unlock(&inode->i_lock); return -EPIPE; + } len = rpci->pipelen; if (filp->private_data) { struct rpc_pipe_msg *msg; msg = (struct rpc_pipe_msg *)filp->private_data; len += msg->len - msg->copied; } + spin_unlock(&inode->i_lock); return put_user(len, (int __user *)arg); default: return -EINVAL; } } -static long -rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) -{ - long ret; - - lock_kernel(); - ret = rpc_pipe_ioctl_unlocked(filp, cmd, arg); - unlock_kernel(); - - return ret; -} - static const struct file_operations rpc_pipe_fops = { .owner = THIS_MODULE, .llseek = no_llseek,