From patchwork Tue Dec 5 14:05:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Becker X-Patchwork-Id: 10092967 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6934F6035E for ; Tue, 5 Dec 2017 14:05:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6081828C94 for ; Tue, 5 Dec 2017 14:05:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55605291BB; Tue, 5 Dec 2017 14:05:55 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 0EA4F28C94 for ; Tue, 5 Dec 2017 14:05:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753313AbdLEOFs (ORCPT ); Tue, 5 Dec 2017 09:05:48 -0500 Received: from mail-qt0-f193.google.com ([209.85.216.193]:46676 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752283AbdLEOFm (ORCPT ); Tue, 5 Dec 2017 09:05:42 -0500 Received: by mail-qt0-f193.google.com with SMTP id r39so842324qtr.13; Tue, 05 Dec 2017 06:05:41 -0800 (PST) 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; bh=aN8TGpOWH6zJpCB6T7bT6Lp2CGwjo8UFv6U+F1Sq2ho=; b=MaxR8Dx44PYK6n9tQvLGuK3Qx+ceSYUXDFnIRNZjJK4j3cERqoWsCmBMfH+rDQkvXw jbULuZNmXia2v+7/B56ls9I05CPC7y4eoWQ7pADHzMWi3EaW8NtT/Dskc/zRwgNsdO6k qectm6tDY/NWKmH2p26rVmfhCu3fEFPEJLdT5n1+Bj8Hh4xK7d1X3/t5SyhsNLVAY8YD Dlv4Llw1dKdzXbfc4WMwNYS/dS4Ht02fwYW9HnT37+o114gVxtBBSjPBdO/sE1TKffPs rtP9GVdpRPMZWpW+1coymMaCSoqrfgaZ9mRY1yoVMcixf+GE2TmBScEBTrF37BYk18Z1 Sjog== 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; bh=aN8TGpOWH6zJpCB6T7bT6Lp2CGwjo8UFv6U+F1Sq2ho=; b=ZGrcrb5dhCPIy2w+3sxSyE3ipAOP64BLKshiUaWy1OcTR6OJMgcuf8IqFRVutIGDYp pT4XvVESk2fMPFO5sw9xCKTCJ9QqFgHTU5PI3o9NJ1PhxEsK78sh3XAUHrP+ur6Z2quV Og+C++VOzscXnATPsEPoMpMOL+nT+B6H6YJBNZ10mZLQTPFe2iFKqeXVli1PTi3rDYin 08eWOlLlBAX66fGlhQqp1k+yhS3PTYdlXTmNyiIPhMEPLZY1VynJyUKxRKGYAqD4Gj7J GckscYLmNq7lHuoF5DEzvMBu2WlCTmJubjvmlOYEA48jCsVPNT2+qAja71yoCHpKLZIE gF4w== X-Gm-Message-State: AKGB3mLFUwZzq82bDwc5ImEtuS8VDiz5K6Lum33brlsb3hYBIAt6Red7 Hd2OXRuoqg72EQLuNAiRCQ== X-Google-Smtp-Source: AGs4zMYZyIi847gV6pqNavUyU1AFMJ8XCmv1UbIRjkdRbljqn+g7vjckMInVe01Q+tSwuIEHh1kXQg== X-Received: by 10.55.101.22 with SMTP id z22mr23122680qkb.140.1512482741104; Tue, 05 Dec 2017 06:05:41 -0800 (PST) Received: from tbecker-rhat.redhat.com ([201.37.68.249]) by smtp.googlemail.com with ESMTPSA id f5sm148437qte.87.2017.12.05.06.05.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Dec 2017 06:05:40 -0800 (PST) From: Thiago Rafael Becker To: bfields@fieldses.org, neilb@suse.com Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Thiago Rafael Becker Subject: [PATCH 3/3 v3] kernel: set_groups doesn't call groups_sort anymore. Date: Tue, 5 Dec 2017 12:05:12 -0200 Message-Id: <20171205140512.13349-4-thiago.becker@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171205140512.13349-1-thiago.becker@gmail.com> References: <20171130130457.11429-1-thiago.becker@gmail.com> <20171205140512.13349-1-thiago.becker@gmail.com> 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 When the group_info is cached (e.g. sunrpc) there's the possibility that threads calling set_groups will attempt to do so simultaneously. Moving the responsibility of sorting to the caller of set_groups, or in the case of nfsd, to the point where it is received from rpc.mountd avoids this issue. Moving it to the caller has the added benifit of a slight improvement on the nfsd performance. Signed-off-by: Thiago Rafael Becker --- kernel/groups.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/groups.c b/kernel/groups.c index 17073a9..8620ad3 100644 --- a/kernel/groups.c +++ b/kernel/groups.c @@ -124,7 +124,6 @@ int groups_search(const struct group_info *group_info, kgid_t grp) void set_groups(struct cred *new, struct group_info *group_info) { put_group_info(new->group_info); - groups_sort(group_info); get_group_info(group_info); new->group_info = group_info; }