From patchwork Thu Jun 26 19:12: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: 4430731 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 E97499F2C8 for ; Thu, 26 Jun 2014 19:15:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01F052024D for ; Thu, 26 Jun 2014 19:15:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 075DF201BB for ; Thu, 26 Jun 2014 19:15:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751819AbaFZTPM (ORCPT ); Thu, 26 Jun 2014 15:15:12 -0400 Received: from mail-qc0-f170.google.com ([209.85.216.170]:61241 "EHLO mail-qc0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751808AbaFZTPK (ORCPT ); Thu, 26 Jun 2014 15:15:10 -0400 Received: by mail-qc0-f170.google.com with SMTP id l6so3659717qcy.1 for ; Thu, 26 Jun 2014 12:15:10 -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=NI0NMKN4bmEhYHDqpR6b0QyuYHWfn4XzovQZcq+wpvU=; b=TD0FZqtc640oQhfPZ1eD7V9ckRFJMiaVRrw3lDQ9NXq7SzZbua2lI2ZBmRgpNugT5L KZX0mwi2HXW655VLzi32hsW/YGUKgBZi5E7CIomEMBmIB3CWMu8L13shTOp35A3y7VG3 XlhvUarIcGXucQvBEdlapOA0G3BODv4tTM9C8OooxL/DQUxAHFEFjXFg+P+9zmpYzlG/ eoIm4pCxNdCO4zrQk521hX25zpxy5M+cnh0dqa9zw1Rb4g1VDT5W2OpdRYg4UXJeYEZi 2BiSerPXy5RJnr/QCQlQLNZsPDwXtO6rq7rfEAIKmwuJzHjgwRYnLNdy6tEzHOPlDFdW co/g== X-Gm-Message-State: ALoCoQlTjXlji8J7Og3tdKVoIxBfTmdoyB03ejoQoASKo3NeS23FYy805YA6SoWhnpUOQuHh3VPy X-Received: by 10.140.104.225 with SMTP id a88mr23430192qgf.91.1403810109949; Thu, 26 Jun 2014 12:15:09 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id 88sm4763039qgh.5.2014.06.26.12.15.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jun 2014 12:15:09 -0700 (PDT) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, Trond Myklebust Subject: [PATCH v2 062/117] nfsd: Migrate the stateid reference into nfs4_find_stateid_by_type() Date: Thu, 26 Jun 2014 15:12:42 -0400 Message-Id: <1403810017-16062-63-git-send-email-jlayton@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1403810017-16062-1-git-send-email-jlayton@primarydata.com> References: <1403810017-16062-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. 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 e0f140c7c5a4..c5058683877d 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1700,8 +1700,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; } @@ -3288,8 +3292,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); } @@ -4136,8 +4138,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; }