From patchwork Wed Jul 30 01:34:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4644181 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 C08009F36A for ; Wed, 30 Jul 2014 01:35:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F157B2012B for ; Wed, 30 Jul 2014 01:35:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1F31420142 for ; Wed, 30 Jul 2014 01:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754491AbaG3Bf0 (ORCPT ); Tue, 29 Jul 2014 21:35:26 -0400 Received: from mail-qg0-f47.google.com ([209.85.192.47]:36319 "EHLO mail-qg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754725AbaG3BfU (ORCPT ); Tue, 29 Jul 2014 21:35:20 -0400 Received: by mail-qg0-f47.google.com with SMTP id i50so650544qgf.20 for ; Tue, 29 Jul 2014 18:35:20 -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=68Ahfbl/0Zy6KWejuY24RgArEb3ZUpogHuG9ztOLfIE=; b=WJvqUmKP4VjQ/fpt2Vxj4MUKtQ9hT3b4kuufSGkwFJEEGMozVXy1Rqe0NKxXwjEEUI WqQhoo5k7tDUbrCmHfelv4iQoBJd20gO2zDEe5ZidLvWJ+cFXNNjntJE5mCxirmIchg2 x7jPGzLNztgSTJRnIEk0seL6Adje5ECrBo26Keew1XbKXQDUztyFiNT0805Ke425me/i 6RQj1EppGl3Arqo3JLlOWfDtGKFfYci2/0nHTxbn8zzFgEHs60+zZRWVJN+7MSxNEC38 XZ/oyw5z2mqTRMDmk6n1bK6H+yHnzplEqm6vuG/jruphLFrxRGe8GHjJgepiNX/94SIN OXfQ== X-Gm-Message-State: ALoCoQmJDo6G6O+PY9gcagokJNP5I1OMeR3PW8I4qxL6duFbKl6X6t0cj96HaMI+mwVRQe91gAKV X-Received: by 10.224.173.7 with SMTP id n7mr1143291qaz.57.1406684120058; Tue, 29 Jul 2014 18:35:20 -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.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jul 2014 18:35:19 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, hch@infradead.org, Trond Myklebust Subject: [PATCH v3 20/38] nfsd: Migrate the stateid reference into nfs4_find_stateid_by_type() Date: Tue, 29 Jul 2014 21:34:25 -0400 Message-Id: <1406684083-19736-21-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 Allow nfs4_find_stateid_by_type to take the stateid reference, while still holding the &cl->cl_lock. Necessary step toward client_mutex removal. 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 a4a49a3b464c..653de6b14665 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1696,8 +1696,12 @@ find_stateid_by_type(struct nfs4_client *cl, stateid_t *t, char typemask) 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; } @@ -3326,8 +3330,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); } @@ -4170,8 +4172,6 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate, *s = find_stateid_by_type(cstate->clp, stateid, typemask); if (!*s) return nfserr_bad_stateid; - /* FIXME: move into find_stateid_by_type */ - atomic_inc(&(*s)->sc_count); return nfs_ok; }