From patchwork Fri Feb 8 12:39:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 2115651 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7EFD63FCA4 for ; Fri, 8 Feb 2013 12:39:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946503Ab3BHMjx (ORCPT ); Fri, 8 Feb 2013 07:39:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:31072 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1946469Ab3BHMji (ORCPT ); Fri, 8 Feb 2013 07:39:38 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r18Cdbk4008092 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 8 Feb 2013 07:39:37 -0500 Received: from bighat.boston.devel.redhat.com (bighat.boston.devel.redhat.com [10.16.60.55]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r18CdPOg006599; Fri, 8 Feb 2013 07:39:36 -0500 From: Steve Dickson To: Trond Myklebust , "J. Bruce Fields" , "David P. Quigley" Cc: Linux NFS list , Linux FS devel list , Linux Security List , SELinux List Subject: [PATCH 12/15] lnfs: Do not sleep holding the inode spin lock Date: Fri, 8 Feb 2013 07:39:20 -0500 Message-Id: <1360327163-20360-13-git-send-email-SteveD@redhat.com> In-Reply-To: <1360327163-20360-1-git-send-email-SteveD@redhat.com> References: <1360327163-20360-1-git-send-email-SteveD@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Dave Quigley The nfs_setsecurity code can sleep while allocating memory so the inode spin lock can not be held while during this call. Signed-off-by: Steve Dickson --- fs/nfs/inode.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 0d412c4..65bf9ca 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1285,6 +1285,9 @@ int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr, struct nfs4_ status = nfs_refresh_inode_locked(inode, fattr, label); spin_unlock(&inode->i_lock); + if (label && !status) + nfs_setsecurity(inode, fattr, label); + return status; } EXPORT_SYMBOL_GPL(nfs_refresh_inode); @@ -1324,6 +1327,10 @@ int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr, struc spin_lock(&inode->i_lock); status = nfs_post_op_update_inode_locked(inode, fattr, label); spin_unlock(&inode->i_lock); + if (nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) { + if (label && !status) + nfs_setsecurity(inode, fattr, label); + } return status; } EXPORT_SYMBOL_GPL(nfs_post_op_update_inode); @@ -1543,9 +1550,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr, struct | NFS_INO_INVALID_ACL | NFS_INO_REVAL_FORCED); - if (label && (server->caps & NFS_CAP_SECURITY_LABEL)) - nfs_setsecurity(inode, fattr, label); - if (fattr->valid & NFS_ATTR_FATTR_NLINK) { if (inode->i_nlink != fattr->nlink) { invalid |= NFS_INO_INVALID_ATTR;