From patchwork Tue Oct 29 09:39:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benny Halevy X-Patchwork-Id: 3107031 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 617F0BF924 for ; Tue, 29 Oct 2013 09:39:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 46FB9202B8 for ; Tue, 29 Oct 2013 09:39:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 48A4120253 for ; Tue, 29 Oct 2013 09:39:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753790Ab3J2Jjc (ORCPT ); Tue, 29 Oct 2013 05:39:32 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:59986 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753786Ab3J2Jjc (ORCPT ); Tue, 29 Oct 2013 05:39:32 -0400 Received: by mail-wi0-f174.google.com with SMTP id cb5so4875235wib.7 for ; Tue, 29 Oct 2013 02:39:30 -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=WhKUkTeJ+ESBj4MFdJVS79q4KhKP+coVwzkhcgTUdn4=; b=YjtOAc8qh3kldgaowo/Yz73vNkxX7M3MIDK9aCY1O0X6zwzWuSbNrQ/vCM/C3tW1LH ogPNtc4fNyIx332IIURbYdWYdT3idB/EEKsd3L15alMR2jxvnuU/FfKpW7MGH2pI1gz4 WILstZcNYPjyVl4QS0Xamb/0+VQSIeA/21MchJJ2ZHJM6DZbKnPdKBIhR+QYo1j/PfYW mdZ0WXwkJVqfDKibLmE3sSTdIvx7RN8UbrkHwlRGSGp43m2xLO+zgiou2KfEM+nVXBqb eUMGl+r8eb4gudpEg079/F9mo9WjfrvvtXGTqk/NaqAd8c27Kz3oc35+rZjV/j/PAeGA Anxw== X-Received: by 10.180.79.227 with SMTP id m3mr12842561wix.2.1383039570814; Tue, 29 Oct 2013 02:39:30 -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 bs15sm2977558wib.10.2013.10.29.02.39.28 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Tue, 29 Oct 2013 02:39:30 -0700 (PDT) From: Benny Halevy To: bfields@redhat.com Cc: linux-nfs@vger.kernel.org, Benny Halevy Subject: [PATCH 5/7] nfsd4: cleanup hash and unhash delegation Date: Tue, 29 Oct 2013 11:39:27 +0200 Message-Id: <1383039567-27356-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 make sure all atomic ops are under the recall_lock Signed-off-by: Benny Halevy --- fs/nfsd/nfs4state.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 64fcdd6..8840206 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -436,6 +436,7 @@ static void unhash_stid(struct nfs4_stid *s) { list_add(&dp->dl_perfile, &fp->fi_delegations); list_add(&dp->dl_perclnt, &dp->dl_stid.sc_client->cl_delegations); + dp->dl_stid.sc_type = NFS4_DELEG_STID; } /* Called under the state lock. */ @@ -446,8 +447,9 @@ static void unhash_stid(struct nfs4_stid *s) list_del_init(&dp->dl_perclnt); list_del_init(&dp->dl_perfile); list_del_init(&dp->dl_recall_lru); - spin_unlock(&recall_lock); + dp->dl_stid.sc_type = 0; nfs4_put_deleg_lease(dp->dl_file); + spin_unlock(&recall_lock); put_nfs4_file(dp->dl_file); dp->dl_file = NULL; } @@ -3078,7 +3080,6 @@ 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);