From patchwork Wed Jul 30 01:34:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4644121 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 2517FC0338 for ; Wed, 30 Jul 2014 01:35:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 50EA120142 for ; Wed, 30 Jul 2014 01:35:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D3712012B for ; Wed, 30 Jul 2014 01:35:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754675AbaG3BfJ (ORCPT ); Tue, 29 Jul 2014 21:35:09 -0400 Received: from mail-qg0-f50.google.com ([209.85.192.50]:64444 "EHLO mail-qg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751895AbaG3BfI (ORCPT ); Tue, 29 Jul 2014 21:35:08 -0400 Received: by mail-qg0-f50.google.com with SMTP id q108so631437qgd.37 for ; Tue, 29 Jul 2014 18:35:07 -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=c9ObMrrX6OvhkFKe9h9pBF0hplUGiLk+KZlpXM24jeE=; b=YUOwjdbx7/RqC9BMS37lByFa0roJnESdEK+xjutzAiB55bxs14mbMFls2BYG5qzCCv Icg13CS5lf6Wzee/htGU6lt24l6Qjpw1rpTUMi8FHFyBy+d3MRZAMfSJQsySjfY7+3G0 aD4GojKVDU4gUH6NV5eVLh7/wbfnLqP57ojRfp0HTpYYJa01EqMH+py7bq9rRHlSKTP9 jCSFaowgxeckciZpdVY4y4OC5Zxp2/EJ9hRf1umsA4m1qOXK2/gTQn2HqNQ0GRz6ieTf Kjl3swV6rviEHkyzoOS1cWrFsLbkh5uE+hKDG5+AY7zs5CjrH4MtewdkXSmEozd2pQ/n tBxA== X-Gm-Message-State: ALoCoQmGPga9qdcp/30fppYL+d+fL4boYggZoc65iK6DvcfS9vVluz3XBAWBstQmsJ7dAv3s/TfA X-Received: by 10.229.67.69 with SMTP id q5mr1232678qci.25.1406684107906; Tue, 29 Jul 2014 18:35:07 -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.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jul 2014 18:35:06 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, hch@infradead.org, Trond Myklebust Subject: [PATCH v3 12/38] nfsd: Ensure that nfs4_open_delegation() references the delegation stateid Date: Tue, 29 Jul 2014 21:34:17 -0400 Message-Id: <1406684083-19736-13-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 nfs4_open_delegation() keeps a reference to the delegation stateid until it is done working with it. Necessary step toward client_mutex removal. Signed-off-by: Trond Myklebust --- fs/nfsd/nfs4state.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 4f191456d737..2df6af93120e 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -674,6 +674,7 @@ hash_delegation_locked(struct nfs4_delegation *dp, struct nfs4_file *fp) lockdep_assert_held(&state_lock); lockdep_assert_held(&fp->fi_lock); + atomic_inc(&dp->dl_stid.sc_count); dp->dl_stid.sc_type = NFS4_DELEG_STID; list_add(&dp->dl_perfile, &fp->fi_delegations); list_add(&dp->dl_perclnt, &dp->dl_stid.sc_client->cl_delegations); @@ -3704,6 +3705,7 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, dprintk("NFSD: delegation stateid=" STATEID_FMT "\n", STATEID_VAL(&dp->dl_stid.sc_stateid)); open->op_delegate_type = NFS4_OPEN_DELEGATE_READ; + nfs4_put_stid(&dp->dl_stid); return; out_no_deleg: open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE;