From patchwork Mon Mar 19 14:36:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Fields X-Patchwork-Id: 10292439 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 DA87C600F6 for ; Mon, 19 Mar 2018 14:37:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB629292EF for ; Mon, 19 Mar 2018 14:37:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADF9F29318; Mon, 19 Mar 2018 14:37:02 +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=unavailable 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 58CEF292EF for ; Mon, 19 Mar 2018 14:37:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755778AbeCSOgv (ORCPT ); Mon, 19 Mar 2018 10:36:51 -0400 Received: from fieldses.org ([173.255.197.46]:41676 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755752AbeCSOgp (ORCPT ); Mon, 19 Mar 2018 10:36:45 -0400 Received: by fieldses.org (Postfix, from userid 2815) id 5737F2613; Mon, 19 Mar 2018 10:36:45 -0400 (EDT) From: "J. Bruce Fields" To: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: "J. Bruce Fields" Subject: [PATCH 03/10] nfsd: simplify nfs4_put_deleg_lease calls Date: Mon, 19 Mar 2018 10:36:27 -0400 Message-Id: <1521470194-24840-4-git-send-email-bfields@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1521470194-24840-1-git-send-email-bfields@redhat.com> References: <1521470194-24840-1-git-send-email-bfields@redhat.com> 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 From: "J. Bruce Fields" Every single caller gets the file out of the delegation, so let's do that once in nfs4_put_deleg_lease. Plus we'll need it there for other reasons. Signed-off-by: J. Bruce Fields --- fs/nfsd/nfs4state.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 1a0b38fddde4..51f633c85776 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -845,9 +845,10 @@ nfs4_inc_and_copy_stateid(stateid_t *dst, struct nfs4_stid *stid) spin_unlock(&stid->sc_lock); } -static void nfs4_put_deleg_lease(struct nfs4_file *fp) +static void nfs4_put_deleg_lease(struct nfs4_delegation *dp) { struct file *filp = NULL; + struct nfs4_file *fp = dp->dl_stid.sc_file; WARN_ON_ONCE(!fp->fi_delegees); @@ -962,7 +963,7 @@ static void destroy_delegation(struct nfs4_delegation *dp) spin_unlock(&state_lock); if (unhashed) { put_clnt_odstate(dp->dl_clnt_odstate); - nfs4_put_deleg_lease(dp->dl_stid.sc_file); + nfs4_put_deleg_lease(dp); nfs4_put_stid(&dp->dl_stid); } } @@ -974,7 +975,7 @@ static void revoke_delegation(struct nfs4_delegation *dp) WARN_ON(!list_empty(&dp->dl_recall_lru)); put_clnt_odstate(dp->dl_clnt_odstate); - nfs4_put_deleg_lease(dp->dl_stid.sc_file); + nfs4_put_deleg_lease(dp); if (clp->cl_minorversion == 0) nfs4_put_stid(&dp->dl_stid); @@ -1885,7 +1886,7 @@ __destroy_client(struct nfs4_client *clp) dp = list_entry(reaplist.next, struct nfs4_delegation, dl_recall_lru); list_del_init(&dp->dl_recall_lru); put_clnt_odstate(dp->dl_clnt_odstate); - nfs4_put_deleg_lease(dp->dl_stid.sc_file); + nfs4_put_deleg_lease(dp); nfs4_put_stid(&dp->dl_stid); } while (!list_empty(&clp->cl_revoked)) { @@ -7226,7 +7227,7 @@ nfs4_state_shutdown_net(struct net *net) dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru); list_del_init(&dp->dl_recall_lru); put_clnt_odstate(dp->dl_clnt_odstate); - nfs4_put_deleg_lease(dp->dl_stid.sc_file); + nfs4_put_deleg_lease(dp); nfs4_put_stid(&dp->dl_stid); }