From patchwork Tue Oct 29 09:39:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benny Halevy X-Patchwork-Id: 3107021 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 72DDB9F2B7 for ; Tue, 29 Oct 2013 09:39:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7375B20253 for ; Tue, 29 Oct 2013 09:39:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 63865202B8 for ; Tue, 29 Oct 2013 09:39:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753743Ab3J2Jj1 (ORCPT ); Tue, 29 Oct 2013 05:39:27 -0400 Received: from mail-we0-f177.google.com ([74.125.82.177]:40594 "EHLO mail-we0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751339Ab3J2Jj1 (ORCPT ); Tue, 29 Oct 2013 05:39:27 -0400 Received: by mail-we0-f177.google.com with SMTP id x55so7830579wes.36 for ; Tue, 29 Oct 2013 02:39:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=pxgFsFd6Vld3a0tht8diRACsnBXV/GyWzyC7VRHUeyM=; b=hrjFmY9rdNh5M6ybMMhIKJCuB8GHenTEDLsgXYF8e+KDMg97C3Uot31wrtXpblt4gb sYQHEojnlieuGkLLHobu1h2YQeHSgyx8zhy35LX+18JVB4B9aMsUWNsRmskE/W2QYJ+5 yyGpozgyz6IUPCJ19v0FO96bEGsCZezUXLo6JkrC28TkmiIUsVCqT4Su7kN0uo8CAcRF pycLRlA6rISIQDwU3OVfhtZd5kujBUERCSCcfYpHQW49ZZ383klno0WfYcATP/1qnFjh 5c0yTPvsiMEly3ed9Bxs3yEXIY86IRSIS22U9umd0gpUfQYpxfKTmRykYLiGF0W6R+3N rKUQ== X-Received: by 10.181.13.173 with SMTP id ez13mr12786560wid.49.1383039565948; Tue, 29 Oct 2013 02:39:25 -0700 (PDT) Received: from bhalevy-lt.il.tonian.com (bzq-80-49-130.static.bezeqint.net. [82.80.49.130]) by mx.google.com with ESMTPSA id i8sm3003455wiy.6.2013.10.29.02.39.24 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Tue, 29 Oct 2013 02:39:25 -0700 (PDT) From: Benny Halevy To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, Benny Halevy Subject: [PATCH 4/7] nfsd4: hash deleg stateid only on successful nfs4_set_delegation Date: Tue, 29 Oct 2013 11:39:21 +0200 Message-Id: <1383039561-27308-1-git-send-email-bhalevy@primarydata.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <526F81DE.6060704@primarydata.com> References: <526F81DE.6060704@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.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 We don't want the stateid to be found in the hash table before the delegation is granted. Signed-off-by: Benny Halevy --- fs/nfsd/nfs4state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 405649f..64fcdd6 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -375,7 +375,6 @@ static struct nfs4_ol_stateid * nfs4_alloc_stateid(struct nfs4_client *clp) dp = delegstateid(nfs4_alloc_stid(clp, deleg_slab)); if (dp == NULL) return dp; - dp->dl_stid.sc_type = NFS4_DELEG_STID; /* * delegation seqid's are never incremented. The 4.1 special * meaning of seqid 0 isn't meaningful, really, but let's avoid @@ -3079,6 +3078,7 @@ static int nfs4_set_delegation(struct nfs4_delegation *dp, struct nfs4_file *fp) atomic_inc(&fp->fi_delegees); hash_delegation_locked(dp, fp); spin_unlock(&recall_lock); + dp->dl_stid.sc_type = NFS4_DELEG_STID; return 0; out_free: put_nfs4_file(fp);