From patchwork Wed Jul 30 01:34:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4644161 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 11A549F36A for ; Wed, 30 Jul 2014 01:35:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 395CE2012D for ; Wed, 30 Jul 2014 01:35:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6332320145 for ; Wed, 30 Jul 2014 01:35:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754737AbaG3BfV (ORCPT ); Tue, 29 Jul 2014 21:35:21 -0400 Received: from mail-qg0-f46.google.com ([209.85.192.46]:48671 "EHLO mail-qg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754734AbaG3BfT (ORCPT ); Tue, 29 Jul 2014 21:35:19 -0400 Received: by mail-qg0-f46.google.com with SMTP id z60so660863qgd.19 for ; Tue, 29 Jul 2014 18:35:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ScBj2f+65Qir2LPA5jFGB0MfbEEkwOBPpTYCxuiaVns=; b=ZuesxO8Ccjak1jiWurRhJVZYm0n34vo378bmWLjfyBI4Uy1LU2r8Gw2trH4w+DBb2B UcR1emAOhuZwrNvA4VbW9smJGRb6zXEgxVesXtGPjfZNS8C/g3f2D9uTAx+xMMeR5hUf lnh6ikCqTFchIPmMgjIFcOad7HAZy4p2T+oeBfE+ryjyZBQkYUOPAnwN6H+g7fTB2rDy PZiriTYTJWvaSHIDLtxtrOwd54LizEXuvBtk579XNTYmL62tSao5ZFIEe+XuxtQxA9hU yn0ekKdnSjhCCT8YO81IO7TVzRIYVfjAlBgK/TSfMm+Msu9n/NMomtJ8wt0W+9WeDW00 /+ow== X-Gm-Message-State: ALoCoQnN0lDhUZqFVFpY4H5Gve1/yrgdnpD0yyeZca60n0adskDkwyid1g5eFPPKqt60XdTWj1xA X-Received: by 10.224.22.134 with SMTP id n6mr1192762qab.27.1406684118622; Tue, 29 Jul 2014 18:35:18 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id 81sm860946qgw.21.2014.07.29.18.35.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jul 2014 18:35:17 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, hch@infradead.org, Trond Myklebust Subject: [PATCH v3 19/38] nfsd: Migrate the stateid reference into nfs4_lookup_stateid() Date: Tue, 29 Jul 2014 21:34:24 -0400 Message-Id: <1406684083-19736-20-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1406684083-19736-1-git-send-email-jlayton@primarydata.com> References: <1406684083-19736-1-git-send-email-jlayton@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Trond Myklebust Allow nfs4_lookup_stateid to take the stateid reference, instead of having all the callers do so. Signed-off-by: Trond Myklebust --- fs/nfsd/nfs4state.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index b0c0f4cdf503..a4a49a3b464c 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -4170,6 +4170,8 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate, *s = find_stateid_by_type(cstate->clp, stateid, typemask); if (!*s) return nfserr_bad_stateid; + /* FIXME: move into find_stateid_by_type */ + atomic_inc(&(*s)->sc_count); return nfs_ok; } @@ -4204,7 +4206,7 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate, NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID, &s, nn); if (status) - goto out; + goto unlock_state; status = check_stateid_generation(stateid, &s->sc_stateid, nfsd4_has_session(cstate)); if (status) goto out; @@ -4253,6 +4255,8 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate, if (file) *filpp = file; out: + nfs4_put_stid(s); +unlock_state: nfs4_unlock_state(); return status; } @@ -4390,11 +4394,10 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, cstate->replay_owner = stp->st_stateowner; status = nfs4_seqid_op_checks(cstate, stateid, seqid, stp); - if (!status) { - /* FIXME: move into find_stateid_by_type */ - atomic_inc(&stp->st_stid.sc_count); + if (!status) *stpp = stp; - } + else + nfs4_put_stid(&stp->st_stid); return status; } @@ -4623,9 +4626,11 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, dp = delegstateid(s); status = check_stateid_generation(stateid, &dp->dl_stid.sc_stateid, nfsd4_has_session(cstate)); if (status) - goto out; + goto put_stateid; destroy_delegation(dp); +put_stateid: + nfs4_put_stid(&dp->dl_stid); out: nfs4_unlock_state();