From patchwork Thu Nov 30 13:04:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Becker X-Patchwork-Id: 10084847 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 5260460234 for ; Thu, 30 Nov 2017 13:07:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4244C29F30 for ; Thu, 30 Nov 2017 13:07:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 366DD29F99; Thu, 30 Nov 2017 13:07:07 +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 C5E2C29F30 for ; Thu, 30 Nov 2017 13:07:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753025AbdK3NHF (ORCPT ); Thu, 30 Nov 2017 08:07:05 -0500 Received: from mail-qt0-f196.google.com ([209.85.216.196]:37721 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753021AbdK3NHD (ORCPT ); Thu, 30 Nov 2017 08:07:03 -0500 Received: by mail-qt0-f196.google.com with SMTP id d15so8598901qte.4; Thu, 30 Nov 2017 05:07:03 -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=Ihz2JeclRaq3RakjhBAOwXSfSQBPmxBPvA3/lrNZklfWaQsGFpNy1xTzq71uLQpRby nBJfkN6RSBR3WIFgo3uWoDfq1g4uz4Q8ECJZGHx9AAy/dT9iUAIdbqMKqBY7t6hTTjLo Q2whLMBO+wCd7ODhF9S0Gt7DLL1YdUiiJ5NA5QyPgQYOEmLRrDez98HJe7MkgNa4L8gu yH75jSIlA7VjvxZJiSKVFHwm+Z+H1/CNel/v0XA20P1qiUXQFzv5C86BDOHpx6S37KdO k4U49jpbDz9z2glLBxv1kedv1CfSPtWolJJBEglmndobOMo4bwhCsI7HqDnynO2TRI7Z oMQw== 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=HuxVoytpwR5zTDMriiIJrtYWJmJh/rce11+1it1AEBQYR/RuWIvZ7gev8P3nKbh4zq GFjSgvOxZ+zweq0SII2wxt3B36dRJGSc88pt4nZElgxGXs3+fH5xVGhdHxLLUWEFrRWD +3Zles8H/0/zpSzpgQxaoVWA0QXPAS2JSNWvnd9FhlrRt660wTiRZ6ANNEGyZO5ApIYN KFTEyj58nEpUl2a69GAKgAIDdEmzu1LsHzEc+75ylSY0W47luE9qoMP7IcdGb0rX4cee cenqDCCmjpRCxs+vgWwgfhlTgp/mMnt7Kt0mICCrL8/7rAxX12Y5dPdudLaFXc8l/PDH brtw== X-Gm-Message-State: AKGB3mJo0X0StEkNqBQHXObH5Sxnh5qeC7Y266r9iPaq5DRxhLsPXEys k4Y/81NIjJUGZzedYZ5ddw== X-Google-Smtp-Source: AGs4zMbaGZPYDEdhU83O9MAsjofVF5CfnIPYraZDRLCnuKGd3oejfDx05HWIKif83fcbyr+dFAUQIg== X-Received: by 10.200.54.198 with SMTP id b6mr3265075qtc.48.1512047222833; Thu, 30 Nov 2017 05:07:02 -0800 (PST) Received: from tbecker-rhat.redhat.com ([189.7.118.40]) by smtp.googlemail.com with ESMTPSA id c72sm2862490qka.31.2017.11.30.05.06.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 05:07:02 -0800 (PST) From: Thiago Rafael Becker To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Thiago Rafael Becker Subject: [PATCH 3/3, V2] kernel: set_groups doesn't call groups_sort anymore. Date: Thu, 30 Nov 2017 11:04:57 -0200 Message-Id: <20171130130457.11429-4-thiago.becker@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171130130457.11429-1-thiago.becker@gmail.com> References: <20171130130457.11429-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; }