From patchwork Wed Jul 30 01:34:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4644141 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 658FBC0338 for ; Wed, 30 Jul 2014 01:35:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7C8242012B for ; Wed, 30 Jul 2014 01:35:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 530C220149 for ; Wed, 30 Jul 2014 01:35:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754733AbaG3BfR (ORCPT ); Tue, 29 Jul 2014 21:35:17 -0400 Received: from mail-qa0-f47.google.com ([209.85.216.47]:53104 "EHLO mail-qa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754725AbaG3BfP (ORCPT ); Tue, 29 Jul 2014 21:35:15 -0400 Received: by mail-qa0-f47.google.com with SMTP id i13so592175qae.20 for ; Tue, 29 Jul 2014 18:35:14 -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=BGF54aCCLR6/CHD+bOdkYFxSmQQBJiYkLca4DR4gv5U=; b=kHZJOuIO/1mnikSW5EyJKmW8seQ3F6ABcynAWE+HlRqtyNG0jzq20pgvJiOyvy71LF 5RkeH1mT14fu/JF944uQB2N0GNlIuOslVhOmGd194DsY/WyklPsYVNRCMAO+X7vkV5WH jY2x5R7ztZ5kykVSzaMsv25o+X1+dMnIitZrsAQqWM0Mku3vvPGC6iR/XE24X7l+I6HI 9I04k5qiO+JFLGunzVynihm8NHZb/Xwj7w4roLVh/TRGsbhuaSKCMNM/IJ2B5S7zXEG/ 6ZOeNZW/wYxH9X+LCTbaq8l2V8MklHj2hQIJQ9OBLG565pJjRSygItLHVv8WVQtYUTO/ kAbQ== X-Gm-Message-State: ALoCoQnhV5k4kpiaJue5lTLwShuEOQ6Z56LFYLAZtK5Qw56x472IuH998ypIrPg/c/RqZKW9cy60 X-Received: by 10.140.80.74 with SMTP id b68mr1111376qgd.21.1406684114299; Tue, 29 Jul 2014 18:35:14 -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.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jul 2014 18:35:12 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, hch@infradead.org, Trond Myklebust Subject: [PATCH v3 16/38] nfsd: nfsd4_open_confirm() must reference the open stateid Date: Tue, 29 Jul 2014 21:34:21 -0400 Message-Id: <1406684083-19736-17-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 Ensure that nfsd4_open_confirm() keeps a reference to the open stateid until it is done working with it. Necessary step toward client_mutex removal. Signed-off-by: Trond Myklebust --- fs/nfsd/nfs4state.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 4e50f14f5bc1..8e18ca49555f 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -4434,10 +4434,12 @@ 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) - goto out; + goto put_stateid; oo->oo_flags |= NFS4_OO_CONFIRMED; update_stateid(&stp->st_stid.sc_stateid); memcpy(&oc->oc_resp_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t)); @@ -4446,6 +4448,8 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, nfsd4_client_record_create(oo->oo_owner.so_client); status = nfs_ok; +put_stateid: + nfs4_put_stid(&stp->st_stid); out: nfsd4_bump_seqid(cstate, status); if (!cstate->replay_owner)