From patchwork Thu Jun 19 14:49:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4383901 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 2D208BEEAA for ; Thu, 19 Jun 2014 14:51:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3AE5920384 for ; Thu, 19 Jun 2014 14:51:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6728920394 for ; Thu, 19 Jun 2014 14:51:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757959AbaFSOvu (ORCPT ); Thu, 19 Jun 2014 10:51:50 -0400 Received: from mail-qc0-f171.google.com ([209.85.216.171]:35054 "EHLO mail-qc0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757917AbaFSOvt (ORCPT ); Thu, 19 Jun 2014 10:51:49 -0400 Received: by mail-qc0-f171.google.com with SMTP id w7so2304523qcr.30 for ; Thu, 19 Jun 2014 07:51:49 -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=VUOxN97uOy0ltugo8uBdvcW4736a/sMjnRvs4T9Yass=; b=WRzdqN8aFi2KyBv9Iezn92GFaxGrQQzlqD+pacTMr/tdErHo5pofoS8kdpdXZ1GJbD EfSwOuIbNgpNepAkM+Bwaj/TKttRzef90vbbUgQnGaYWNWKtMuowWd/5A04tj8bOvMKv mLqAdq0c3Uw8BlzgFz8U475eyhidC02KNEMOXWn78yoRX6EBpRB45LIPtKXc2geBl/EO 7I7xQHbI+jOEls21fJx7k069mTI0NeZN+8Y5yWLrqWKB2ACW70vDafGE8QM3CsxZ4osC WRDjbmkb4H7giSzeMl6C0Cs+/TWxq3y9decQN5ge87z5KBgNJjo/rkTp6Ap7iSwyPBrf MmKw== X-Gm-Message-State: ALoCoQkk4L+u2+IrLCXJliaPVLDL+OX24fY1O2qVmwJMPykV52d0jiqDaLatRLaDH4qJg0xeIlja X-Received: by 10.224.53.202 with SMTP id n10mr7473004qag.73.1403189509140; Thu, 19 Jun 2014 07:51:49 -0700 (PDT) Received: from tlielax.poochiereds.net (cpe-107-015-124-230.nc.res.rr.com. [107.15.124.230]) by mx.google.com with ESMTPSA id r60sm3364044qgd.26.2014.06.19.07.51.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jun 2014 07:51:48 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org Subject: [PATCH v1 036/104] NFSd: Ensure that nfs4_open_delegation() references the delegation stateid Date: Thu, 19 Jun 2014 10:49:42 -0400 Message-Id: <1403189450-18729-37-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1403189450-18729-1-git-send-email-jlayton@primarydata.com> References: <1403189450-18729-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 nfs4_open_delegation() keeps a reference to the delegation stateid until it is done working with it. 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 08425b1bc3b1..cf3b19bb5839 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -589,6 +589,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); @@ -3513,6 +3514,7 @@ nfs4_open_delegation(struct net *net, struct svc_fh *fh, dprintk("NFSD: delegation stateid=" STATEID_FMT "\n", STATEID_VAL(&dp->dl_stid.sc_stateid)); open->op_delegate_type = NFS4_OPEN_DELEGATE_READ; + nfs4_put_delegation(dp); return; out_free: unhash_and_destroy_delegation(dp);