From patchwork Thu Jun 26 19:12:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4430651 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 281289F2C8 for ; Thu, 26 Jun 2014 19:15:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5BBF9201BB for ; Thu, 26 Jun 2014 19:15:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 56793202D1 for ; Thu, 26 Jun 2014 19:15:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751804AbaFZTO7 (ORCPT ); Thu, 26 Jun 2014 15:14:59 -0400 Received: from mail-qc0-f179.google.com ([209.85.216.179]:41306 "EHLO mail-qc0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751511AbaFZTO6 (ORCPT ); Thu, 26 Jun 2014 15:14:58 -0400 Received: by mail-qc0-f179.google.com with SMTP id x3so3629333qcv.10 for ; Thu, 26 Jun 2014 12:14:58 -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=Wo3dld5txVLZ+oyUNWsW+Kh92HYbhsGDFBgbQc4I1qo=; b=NUUIjeWfYOFhTw5cMTSMdFNYrTdx/qkFAWil+3IH7Pd1y/GGi2+fVVWZRmZ0vwVbrm WgPicXPXdbK8G2AfMz1CJF+AxZM8TXe+vCVLYhu0jBotnrkRKVSbKzq39/ytoLp0jr3f ON5YTBlUzWbwpLtjfuwyWRx2LS608j4nvPkK/AODpuSqY5b+Rr6NJ1MjCH3cQO3sVpyK 2uPdo2OTzX+nuGdrqJK3x4Cc6q+YFPt6MCeAh8D0Dm6xzgemcbZIOACLTP/sBFIAKaGE vHdpI9Te1PvuBv3QQyGNOv8MUwVBPSq0iAW2FVk5ann9O3zUoZjLrAupZwysL0/1idSJ yR1w== X-Gm-Message-State: ALoCoQnZy/raEFEF8v13kP0S8dCiCrSNsUVruQMT4877+GGLgeX2b3ZCdayrp5pjLp1RlW7tWZpR X-Received: by 10.224.68.2 with SMTP id t2mr25779703qai.71.1403810098136; Thu, 26 Jun 2014 12:14:58 -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.14.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jun 2014 12:14:57 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, Trond Myklebust Subject: [PATCH v2 053/117] nfsd: nfsd4_locku() must reference the lock stateid Date: Thu, 26 Jun 2014 15:12:33 -0400 Message-Id: <1403810017-16062-54-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_locku() keeps a reference to the lock 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 29b31a6d749b..0c9f707c8470 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -5114,10 +5114,12 @@ 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; - goto out; + goto put_stateid; } file_lock = locks_alloc_lock(); if (!file_lock) { @@ -5147,6 +5149,8 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, memcpy(&locku->lu_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t)); fput: fput(filp); +put_stateid: + put_generic_stateid(stp); out: nfsd4_bump_seqid(cstate, status); nfs4_unlock_state();