From patchwork Mon Oct 1 14:41:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10622267 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEE6B175A for ; Mon, 1 Oct 2018 14:42:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5A3228DDB for ; Mon, 1 Oct 2018 14:42:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA01129396; Mon, 1 Oct 2018 14:42:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DF7C28DDB for ; Mon, 1 Oct 2018 14:42:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729487AbeJAVUf (ORCPT ); Mon, 1 Oct 2018 17:20:35 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:37266 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729489AbeJAVUe (ORCPT ); Mon, 1 Oct 2018 17:20:34 -0400 Received: by mail-it1-f195.google.com with SMTP id m9-v6so11757022ita.2 for ; Mon, 01 Oct 2018 07:42:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=exobWiQB0XuVVgroWyhlm2fEEcib1Bp2VkLm7dx40X0=; b=hRvoj9nvBlMkWCKOEHRL/DTie6how3wYOmeFlMR4LFXHIjPAjKtqzKhduvZrtScYtt b78inYthRILi4Fpa38y77Q+E4t54nfrN/uRMqg9HXm8kNpdoQuX6yxcQ+NyNeskVT0FB vG73hK9o5qRSEiAl/jMrNGSpVc8MRMHY+zI7ufCwF1OnBrvvJUPNB40QPj5KY2fuKYxe MLX7Vda/OYth9RJC3bWt2ULzZFfbZuEmDKA+TPwz5UBeVFz4feTEsQfUwcHJOasSADDd 4tLEXxpCVv/8HrDqMZKvQn9KcvRUCrDcQq+Y8+yLhmtccLyDhP6Q3tiKy1W6VZFSp+Q4 8PoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=exobWiQB0XuVVgroWyhlm2fEEcib1Bp2VkLm7dx40X0=; b=He6/+ZYUoSylxdvcRp9eN4rsID2FWuWeClY6OKdo1Nqh9gQdY2v5mxgJQ7FkWq47GH Lg/g0eNTNFI7jzzWuoMyZGnIAwDq1TMID4mAB98V861/6XzJvsY33YxhV5+BVgxlIFx9 p0cRDYcBDvdjIk5OlBrmrf7eD2wfQLdbquiVU1xK664c4PxOGsEjLFuGZpRmG3R/4hF5 vpmZR08YoXLTAp5l/lGK0zrtvOe9jGbibRyLneZvC7CttHYE4cmIwDbb2R402m+5m5Ed z51PyggrTES4/yMc1/zU3JlKff9qEaQgEtNnioYX8nQCFYWV3CCJBNqIhHkpIBx8pe3I fxvQ== X-Gm-Message-State: ABuFfojJ1Nk1H9Q+6Tr0FI7sLm8KrpALpL9D8mymar5hwLQDfZDpBaQM 6Xpz6Qzca574XI9gSydPBw== X-Google-Smtp-Source: ACcGV61k5e9Rh5ReNmsd+3MG475/SUK2vjtPGrTR2BR77sXydSwVn2oA97DL/NFUZTAi1OlKmKJQeA== X-Received: by 2002:a24:9005:: with SMTP id x5-v6mr10396258itd.76.1538404945475; Mon, 01 Oct 2018 07:42:25 -0700 (PDT) Received: from leira.trondhjem.org.localdomain (c-68-40-195-73.hsd1.mi.comcast.net. [68.40.195.73]) by smtp.gmail.com with ESMTPSA id j75-v6sm2055597itj.33.2018.10.01.07.42.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Oct 2018 07:42:25 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: "J . Bruce Fields" Cc: linux-nfs@vger.kernel.org Subject: [PATCH 07/15] knfsd: Lockless lookup of NFSv4 identities. Date: Mon, 1 Oct 2018 10:41:49 -0400 Message-Id: <20181001144157.3515-8-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181001144157.3515-7-trond.myklebust@hammerspace.com> References: <20181001144157.3515-1-trond.myklebust@hammerspace.com> <20181001144157.3515-2-trond.myklebust@hammerspace.com> <20181001144157.3515-3-trond.myklebust@hammerspace.com> <20181001144157.3515-4-trond.myklebust@hammerspace.com> <20181001144157.3515-5-trond.myklebust@hammerspace.com> <20181001144157.3515-6-trond.myklebust@hammerspace.com> <20181001144157.3515-7-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Enable RCU protected lookups of the NFSv4 idmap. Signed-off-by: Trond Myklebust --- fs/nfsd/nfs4idmap.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c index a5bb76593ce7..bf137fec33ff 100644 --- a/fs/nfsd/nfs4idmap.c +++ b/fs/nfsd/nfs4idmap.c @@ -65,6 +65,7 @@ struct ent { u32 id; char name[IDMAP_NAMESZ]; char authname[IDMAP_NAMESZ]; + struct rcu_head rcu_head; }; /* Common entry handling */ @@ -89,7 +90,7 @@ static void ent_put(struct kref *ref) { struct ent *map = container_of(ref, struct ent, h.ref); - kfree(map); + kfree_rcu(map, rcu_head); } static struct cache_head * @@ -264,8 +265,8 @@ idtoname_parse(struct cache_detail *cd, char *buf, int buflen) static struct ent * idtoname_lookup(struct cache_detail *cd, struct ent *item) { - struct cache_head *ch = sunrpc_cache_lookup(cd, &item->h, - idtoname_hash(item)); + struct cache_head *ch = sunrpc_cache_lookup_rcu(cd, &item->h, + idtoname_hash(item)); if (ch) return container_of(ch, struct ent, h); else @@ -422,8 +423,8 @@ nametoid_parse(struct cache_detail *cd, char *buf, int buflen) static struct ent * nametoid_lookup(struct cache_detail *cd, struct ent *item) { - struct cache_head *ch = sunrpc_cache_lookup(cd, &item->h, - nametoid_hash(item)); + struct cache_head *ch = sunrpc_cache_lookup_rcu(cd, &item->h, + nametoid_hash(item)); if (ch) return container_of(ch, struct ent, h); else