From patchwork Tue Jul 29 20:34:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4642551 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 59F0DC033A for ; Tue, 29 Jul 2014 20:35:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7C98520142 for ; Tue, 29 Jul 2014 20:35:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A6DBB2014A for ; Tue, 29 Jul 2014 20:35:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754395AbaG2UfA (ORCPT ); Tue, 29 Jul 2014 16:35:00 -0400 Received: from mail-qg0-f53.google.com ([209.85.192.53]:60194 "EHLO mail-qg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754396AbaG2Ue4 (ORCPT ); Tue, 29 Jul 2014 16:34:56 -0400 Received: by mail-qg0-f53.google.com with SMTP id q107so297085qgd.40 for ; Tue, 29 Jul 2014 13:34:56 -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=z7Z1gcfOpWYjnKSTrLCoZIOcVVpAQHfP+2nIN7k3JuY=; b=asKbeckYygBI6XLrZpua0qzTGTLbJCRic6i/CfFrswuZEDEjIb6aGQvagepZ6kitTG PuHzu9E9Ygg0waM5Djkrr/pK0XWS9CcbpY2W+dmynt2NyQmfGa2M9vBtHQtLAotPA90k 51/YBJ97WeLnpEm1orizNC+TkbQ+nnTjVgEu3WbWGvEKV9HekO781RVLGi39A1mC1O1j sCy7pXgIYehOIuu3EEwxYoKRW81hgiEv9qHn88EJfcEHaRSgLwPkK2wQuIT1RR6KwfRy 9gwa454s1VQPnguK4kYacQmedkkdAjGxGUDYqE+DjGfZlob7bJ7g4qMuHi15rWpuuV0F PeMw== X-Gm-Message-State: ALoCoQmG8/MhqeLyRd77+n+J6b8QYGjOlXhnhEW7tmBW0wKrV377uE2wPVXGd0p8hx1+MOG0Ulkq X-Received: by 10.224.64.201 with SMTP id f9mr7787062qai.64.1406666096319; Tue, 29 Jul 2014 13:34:56 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id 98sm74611qgh.5.2014.07.29.13.34.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jul 2014 13:34:55 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, hch@infradead.org, Trond Myklebust Subject: [PATCH v2 18/38] nfsd: Migrate the stateid reference into nfs4_preprocess_seqid_op Date: Tue, 29 Jul 2014 16:34:01 -0400 Message-Id: <1406666061-14175-19-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1406666061-14175-1-git-send-email-jlayton@primarydata.com> References: <1406666061-14175-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_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 7fa25be7ef2e..e348ab1bde40 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -4390,8 +4390,11 @@ 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) + if (!status) { + /* FIXME: move into find_stateid_by_type */ + atomic_inc(&stp->st_stid.sc_count); *stpp = stp; + } return status; } @@ -4400,16 +4403,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)) { + nfs4_put_stid(&stp->st_stid); return nfserr_bad_stateid; + } + *stpp = stp; return nfs_ok; } @@ -4436,8 +4441,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) @@ -4587,8 +4590,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)); @@ -4944,9 +4945,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; @@ -5175,8 +5173,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;