From patchwork Mon Jun 30 15:49:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4451631 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 C6E859F358 for ; Mon, 30 Jun 2014 15:51:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DB1012021F for ; Mon, 30 Jun 2014 15:51:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 00E0320375 for ; Mon, 30 Jun 2014 15:51:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754385AbaF3Pvw (ORCPT ); Mon, 30 Jun 2014 11:51:52 -0400 Received: from mail-qa0-f50.google.com ([209.85.216.50]:47664 "EHLO mail-qa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754260AbaF3Pvw (ORCPT ); Mon, 30 Jun 2014 11:51:52 -0400 Received: by mail-qa0-f50.google.com with SMTP id m5so6667395qaj.9 for ; Mon, 30 Jun 2014 08:51:51 -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=gq08EMiUDLLPKoyBSCKlT/i7e/biyZvgiHsIFNDoB+k=; b=IYD1mT3AlIyrKq0wUnpOqxMKAduR561nFjjt9wioFo59qP/avJFdZvta/iLevV//jJ oSkERuJSN1wRAhr9B5P3h3HQU3NKBI2hkrlLIFtJddBS2Nfsq62xSq45FlvsR7z8ZFXI tOJwfO7YxRF2up9kbGJIJs0pdFga7VmtMROIT9EG1Cu5rICGvx43Y8qLOTla0dj+pT5y gAr8eRptaoR7Rc4t8Hz7PxfqJKbHDgtvCrj0c5TYcCFnHi6n/8NjP//GriA3PHaMLMhQ k7hvym6E+69a+noOMIxKPWF7zLfSSZrzh6lDBo/AU8lbgkkFu013G6Sr3qcCSTnaRR09 Wlwg== X-Gm-Message-State: ALoCoQmB3MjemXSVMglt2x2YARrPkn/g8JP5SBc90DOH/d3jg00PNYJ/WzWzgUwuRPDaNCIBnOHD X-Received: by 10.224.76.1 with SMTP id a1mr63224929qak.4.1404143511842; Mon, 30 Jun 2014 08:51:51 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id m1sm32584105qaz.27.2014.06.30.08.51.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jun 2014 08:51:51 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, Trond Myklebust Subject: [PATCH v3 056/114] nfsd: Migrate the stateid reference into nfs4_preprocess_seqid_op Date: Mon, 30 Jun 2014 11:49:25 -0400 Message-Id: <1404143423-24381-57-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1404143423-24381-1-git-send-email-jlayton@primarydata.com> References: <1404143423-24381-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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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_preprocess_seqid_op to take the stateid reference, instead of having all the callers do so. Signed-off-by: Trond Myklebust --- fs/nfsd/nfs4state.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index f2df0778448e..2b7ce084eb04 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -4341,8 +4341,11 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, nfsd4_cstate_assign_replay(cstate, stp->st_stateowner); status = nfs4_seqid_op_checks(cstate, stateid, seqid, stp); - if (!status) + if (!status) { + /* FIXME: move into find_stateid_by_type */ + atomic_inc(&stp->st_stid.sc_count); *stpp = stp; + } return status; } @@ -4351,16 +4354,18 @@ static __be32 nfs4_preprocess_confirmed_seqid_op(struct nfsd4_compound_state *cs { __be32 status; struct nfs4_openowner *oo; + struct nfs4_ol_stateid *stp; status = nfs4_preprocess_seqid_op(cstate, seqid, stateid, - NFS4_OPEN_STID, stpp, nn); + NFS4_OPEN_STID, &stp, nn); if (status) return status; - /* FIXME: move into nfs4_preprocess_seqid_op */ - atomic_inc(&(*stpp)->st_stid.sc_count); - oo = openowner((*stpp)->st_stateowner); - if (!(oo->oo_flags & NFS4_OO_CONFIRMED)) + oo = openowner(stp->st_stateowner); + if (!(oo->oo_flags & NFS4_OO_CONFIRMED)) { + put_generic_stateid(stp); return nfserr_bad_stateid; + } + *stpp = stp; return nfs_ok; } @@ -4387,8 +4392,6 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, NFS4_OPEN_STID, &stp, nn); if (status) goto out; - /* FIXME: move into nfs4_preprocess_seqid_op */ - atomic_inc(&stp->st_stid.sc_count); oo = openowner(stp->st_stateowner); status = nfserr_bad_stateid; if (oo->oo_flags & NFS4_OO_CONFIRMED) @@ -4536,8 +4539,6 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, nfsd4_bump_seqid(cstate, status); if (status) goto out; - /* FIXME: move into nfs4_preprocess_seqid_op */ - atomic_inc(&stp->st_stid.sc_count); update_stateid(&stp->st_stid.sc_stateid); memcpy(&close->cl_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t)); @@ -4887,9 +4888,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, lock->lk_old_lock_seqid, &lock->lk_old_lock_stateid, NFS4_LOCK_STID, &lock_stp, nn); - /* FIXME: move into nfs4_preprocess_seqid_op */ - if (!status) - atomic_inc(&lock_stp->st_stid.sc_count); } if (status) goto out; @@ -5112,8 +5110,6 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, &stp, nn); if (status) goto out; - /* FIXME: move into nfs4_preprocess_seqid_op */ - atomic_inc(&stp->st_stid.sc_count); filp = find_any_file(stp->st_stid.sc_file); if (!filp) { status = nfserr_lock_range;