From patchwork Thu Jun 26 19:12:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4430681 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 A02A3BEEAA for ; Thu, 26 Jun 2014 19:15:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B94C4202FF for ; Thu, 26 Jun 2014 19:15:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B4B1B202D1 for ; Thu, 26 Jun 2014 19:15:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751511AbaFZTPH (ORCPT ); Thu, 26 Jun 2014 15:15:07 -0400 Received: from mail-qa0-f44.google.com ([209.85.216.44]:59177 "EHLO mail-qa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751808AbaFZTPF (ORCPT ); Thu, 26 Jun 2014 15:15:05 -0400 Received: by mail-qa0-f44.google.com with SMTP id hw13so3196646qab.3 for ; Thu, 26 Jun 2014 12:15:04 -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=mkf0hAythWxK3zEGtWPfxUa2bNgdRxH3j7uFC24rR8I=; b=VB3xivjzx+Q3V78t44hQ+P+JrLlWsQ/nH790uvxn+527H0Uga9bl2DRWKgHGeEq6Bf YOIpefLBTrt7HNaMoA5fylwKzjz7jp0mN9+hgFIhGfwYoSe0ZhNvTGi2yanRNtwVWQdi bxcYWAfrS+kGxno3WBbK41wNai4p5le99GrUi9YcwwLfD4wrew6ese9V4r1Fl75+26j9 2x2pEUuS/vT5BP7L2waXog1tY8FfZtS5YAauyi7vpypuJwtB+/16G7FlVEOK4wr5AAix VpJmM2l/j+vVxud8a+iXiFUCLsQ1CiCiODOqrJfSvRJQFwSiD0iCWdSbmpo7O58btoo5 xOkg== X-Gm-Message-State: ALoCoQkdv07nE6HtS6w1Ds2bVVURuynXCm3qixka0evKk0ULOf2FkuQgpCeA4IiYPY/2MTZA8/T0 X-Received: by 10.140.30.195 with SMTP id d61mr6313493qgd.12.1403810104685; Thu, 26 Jun 2014 12:15:04 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id 88sm4763039qgh.5.2014.06.26.12.15.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jun 2014 12:15:03 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, Trond Myklebust Subject: [PATCH v2 058/117] nfsd: nfsd4_open_confirm() must reference the open stateid Date: Thu, 26 Jun 2014 15:12:38 -0400 Message-Id: <1403810017-16062-59-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1403810017-16062-1-git-send-email-jlayton@primarydata.com> References: <1403810017-16062-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 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 828205fabd3e..32d0238cb0bf 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -4397,10 +4397,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)); @@ -4409,6 +4411,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: + put_generic_stateid(stp); out: nfsd4_bump_seqid(cstate, status); nfs4_unlock_state();