From patchwork Mon Dec 4 19:03:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Becker X-Patchwork-Id: 10091355 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 659B760327 for ; Mon, 4 Dec 2017 19:04:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56FA3290AA for ; Mon, 4 Dec 2017 19:04:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C0DF290FA; Mon, 4 Dec 2017 19:04:50 +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 E4B12290AA for ; Mon, 4 Dec 2017 19:04:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752811AbdLDTEn (ORCPT ); Mon, 4 Dec 2017 14:04:43 -0500 Received: from mail-ua0-f195.google.com ([209.85.217.195]:40041 "EHLO mail-ua0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751852AbdLDTEE (ORCPT ); Mon, 4 Dec 2017 14:04:04 -0500 Received: by mail-ua0-f195.google.com with SMTP id i92so13253816uad.7; Mon, 04 Dec 2017 11:04: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=iUj4iB1CfgNy2CXIEImVbKXvwdtw3bQ6XLuovXB3vcno1WIVBWlvFYdZrj9mDJB+e1 sNNJ3jTl3CwRcgrz9Tg9AEucGUoBXueALqkYOWxAUZf3qgrguyv3SUmePjpEUIXmaItW cKwyWnuDo0YLxE2lO2DXSqChY82yizJR/FGUOyA20k2dKxG1picGWXui7A70wjLozFtw JLqNxYoy1PjDioEXouGc70/Qamtj/5Kyhjg1w6Ab2zXWeO+wN1k2+mrNJTUqwZPkSCAq qJw8qlK6Y9K8NPZaf6uQuZ7sr+VaBFVA/k20f0TF48VCNJKRqyzeDHs80u0ZAKqCHOjf 84PA== 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=bnT/l9js6SUMEQ9EeQk+SxepPiByEJ9UVe5o1477jsKR123Jtvxe9H8GVRYingt98h gDY8AiYAGLojc6sYWD0lrj4Ehjx5P3gNADIykes/f1wHlXbbXVz1gqXbVyxc8zqxrCN0 MG2TgWYYesyhrdhFiE3x6DgHN1w/3h8l0AOaVUG5lEppgUGzuCN79Tulb7RM5dh8ZpeS 2P2V6j99kD91LW+lWNJ1gbkmLLJBgOfUAdEuk3KruGPVMP4WHdBS64XQiq+YhpZhW2pv yfndnmycRyP2osfQR6f5aNm+foc3jwj7fepFSjh+WD5rhu9tmzPVrXR8h3+WGOEVu+GD r+2w== X-Gm-Message-State: AKGB3mLAqRdzOi97C0QKMf43NBpI0QaHKDgMqVtUhPzPigdHxFaUqbHq vVQxcI3UyRlxZ03VFuCFvg== X-Google-Smtp-Source: AGs4zMbatrxfhW5cScGNHANCLz+iKbWFQdIwAA2dcXK9TdJNEuBV+5cocTmTOjNi9I2vZp7DVrOLiw== X-Received: by 10.176.7.5 with SMTP id h5mr20448uah.141.1512414242405; Mon, 04 Dec 2017 11:04:02 -0800 (PST) Received: from tbecker-rhat.redhat.com ([201.37.68.249]) by smtp.googlemail.com with ESMTPSA id o12sm2941797uaj.10.2017.12.04.11.04.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Dec 2017 11:04:01 -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: Mon, 4 Dec 2017 17:03:24 -0200 Message-Id: <20171204190324.6629-4-thiago.becker@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171204190324.6629-1-thiago.becker@gmail.com> References: <20171204190324.6629-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; }