From patchwork Tue Jan 22 13:40:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 2018821 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A21C0DF2EB for ; Tue, 22 Jan 2013 13:58:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752737Ab3AVN6Z (ORCPT ); Tue, 22 Jan 2013 08:58:25 -0500 Received: from 183.141.211.66.inaddr.G4.NET ([66.211.141.183]:54629 "EHLO Dobby.4dicksons.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752078Ab3AVN6Z (ORCPT ); Tue, 22 Jan 2013 08:58:25 -0500 Received: from tophat.home.4dicksons.org ([192.168.62.20]) by Dobby.4dicksons.org with esmtp (Exim 4.63) (envelope-from ) id 1Txe62-0003H4-9H; Tue, 22 Jan 2013 08:41:02 -0500 From: Steve Dickson To: David Quigley , Trond Myklebust , "J. Bruce Fields" Cc: Linux NFS Mailing list Subject: [PATCH 14/14] lnfs: Do not sleep holding the inode spin lock. Date: Tue, 22 Jan 2013 08:40:42 -0500 Message-Id: <1358862042-27520-15-git-send-email-steved@redhat.com> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1358862042-27520-1-git-send-email-steved@redhat.com> References: <1358862042-27520-1-git-send-email-steved@redhat.com> X-Spam-Score: -2.9 (--) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 56cd542..e5b030a 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1295,6 +1295,10 @@ 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 (nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) { + if (label && !status) + nfs_setsecurity(inode, fattr, label); + } return status; } EXPORT_SYMBOL_GPL(nfs_refresh_inode); @@ -1334,6 +1338,11 @@ 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); @@ -1553,9 +1562,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;