From patchwork Thu Jun 19 14:49:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4383981 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 A931EBEEAA for ; Thu, 19 Jun 2014 14:52:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9F38420384 for ; Thu, 19 Jun 2014 14:52:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9184220394 for ; Thu, 19 Jun 2014 14:52:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758027AbaFSOwD (ORCPT ); Thu, 19 Jun 2014 10:52:03 -0400 Received: from mail-qc0-f177.google.com ([209.85.216.177]:38210 "EHLO mail-qc0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758052AbaFSOwC (ORCPT ); Thu, 19 Jun 2014 10:52:02 -0400 Received: by mail-qc0-f177.google.com with SMTP id r5so2252609qcx.36 for ; Thu, 19 Jun 2014 07:52:01 -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=Osv0KkKtKVdlbJ3Ipt26RxbwFLHkEhVjKmGB2OxdZe4=; b=YtBWh9b3yIY7OeRtUlRjb9JrSxIEAMMk0FtRshT3r5NAqH8yMMb3nLE4ZPTTZX29ND f76AG0itXuc54pZyWXtzgxhX9WoaqVvWsVgMFt9tgP2bd6ZVikg9a69zP4BCEG94Dqba m7HPEYxOFx/b7q0o4UMcZlnAvm7GqD01ulmE2IjAT8X5g6KiaSdopcCzJX97EcHB538U WnlRFD2pjdjLecFGCgnyt5LR0g4SrlfXmjyswBuJ9Pe6Y/TvRiOEErblu55tTf7tVlKZ eXOIQjQXiO59+IAGLtpxpIrwZ0rxgqNb0BvPQmfh9seANsJI0GF+t2B4wl5lImDw7GWn RoxA== X-Gm-Message-State: ALoCoQkmnQnbJi1uCFVaDAT9/SkeIq5REFRX5VKAWxFkvIG+XNjGWw317EJseS4M/eRr+GwgHrJN X-Received: by 10.224.119.198 with SMTP id a6mr7655204qar.39.1403189521780; Thu, 19 Jun 2014 07:52:01 -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.52.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jun 2014 07:52:00 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org Subject: [PATCH v1 044/104] NFSd: Migrate the stateid reference into nfs4_find_stateid_by_type() Date: Thu, 19 Jun 2014 10:49:50 -0400 Message-Id: <1403189450-18729-45-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 Allow nfs4_find_stateid_by_type to take the stateid reference, while still holding the &cl->cl_lock. Signed-off-by: Trond Myklebust --- fs/nfsd/nfs4state.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 25af8b7628ae..4ddd7ec31d6c 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1590,8 +1590,12 @@ static struct nfs4_stid *find_stateid_by_type(struct nfs4_client *cl, stateid_t spin_lock(&cl->cl_lock); s = find_stateid_locked(cl, t); - if (s != NULL && !(typemask & s->sc_type)) - s = NULL; + if (s != NULL) { + if (typemask & s->sc_type) + atomic_inc(&s->sc_count); + else + s = NULL; + } spin_unlock(&cl->cl_lock); return s; } @@ -3181,8 +3185,6 @@ static struct nfs4_delegation *find_deleg_stateid(struct nfs4_client *cl, statei ret = find_stateid_by_type(cl, s, NFS4_DELEG_STID); if (!ret) return NULL; - /* FIXME: move into find_stateid_by_type */ - atomic_inc(&ret->sc_count); return delegstateid(ret); } @@ -3998,8 +4000,6 @@ static __be32 nfsd4_lookup_stateid(stateid_t *stateid, unsigned char typemask, *s = find_stateid_by_type(cl, stateid, typemask); if (!*s) return nfserr_bad_stateid; - /* FIXME: move into find_stateid_by_type */ - atomic_inc(&(*s)->sc_count); return nfs_ok; }