From patchwork Wed Nov 8 00:57:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew W Elble X-Patchwork-Id: 10047493 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8499560247 for ; Wed, 8 Nov 2017 00:57:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 784882A2C5 for ; Wed, 8 Nov 2017 00:57:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B2752A2BC; Wed, 8 Nov 2017 00:57:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB6B82A2BC for ; Wed, 8 Nov 2017 00:57:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752823AbdKHA5c (ORCPT ); Tue, 7 Nov 2017 19:57:32 -0500 Received: from discipline.rit.edu ([129.21.6.207]:60705 "HELO discipline.rit.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752384AbdKHA5b (ORCPT ); Tue, 7 Nov 2017 19:57:31 -0500 Received: (qmail 44393 invoked by uid 501); 8 Nov 2017 00:57:31 -0000 From: Andrew Elble To: linux-nfs@vger.kernel.org, bfields@fieldses.org Cc: Andrew Elble Subject: [PATCH v2] nfsd: fix locking validator warning on nfs4_ol_stateid->st_mutex class Date: Tue, 7 Nov 2017 19:57:26 -0500 Message-Id: <20171108005726.35092-1-aweits@rit.edu> X-Mailer: git-send-email 2.10.1 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The use of the st_mutex has been confusing the validator. Use the proper nested notation so as to not produce warnings. Signed-off-by: Andrew Elble --- v2: added mutex_lock_nested to init_lock_stateid() for consistency fs/nfsd/nfs4state.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 0d98d73bd84e..62909f3947b2 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -3548,7 +3548,7 @@ static void nfs4_free_openowner(struct nfs4_stateowner *so) { __be32 ret; - mutex_lock(&stp->st_mutex); + mutex_lock_nested(&stp->st_mutex, 1); ret = nfsd4_verify_open_stid(&stp->st_stid); if (ret != nfs_ok) mutex_unlock(&stp->st_mutex); @@ -3612,7 +3612,7 @@ static void nfs4_free_openowner(struct nfs4_stateowner *so) stp = open->op_stp; /* We are moving these outside of the spinlocks to avoid the warnings */ mutex_init(&stp->st_mutex); - mutex_lock(&stp->st_mutex); + mutex_lock_nested(&stp->st_mutex, 0); retry: spin_lock(&oo->oo_owner.so_client->cl_lock); @@ -5692,7 +5692,7 @@ static void nfs4_free_lockowner(struct nfs4_stateowner *sop) struct nfs4_ol_stateid *retstp; mutex_init(&stp->st_mutex); - mutex_lock(&stp->st_mutex); + mutex_lock_nested(&stp->st_mutex, 0); retry: spin_lock(&clp->cl_lock); spin_lock(&fp->fi_lock);