From patchwork Thu Jul 14 06:11:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yang Xu (Fujitsu)" X-Patchwork-Id: 12917310 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CA9EC43334 for ; Thu, 14 Jul 2022 05:12:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232322AbiGNFMD (ORCPT ); Thu, 14 Jul 2022 01:12:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232847AbiGNFL4 (ORCPT ); Thu, 14 Jul 2022 01:11:56 -0400 Received: from mail1.bemta34.messagelabs.com (mail1.bemta34.messagelabs.com [195.245.231.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A09352DEA; Wed, 13 Jul 2022 22:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1657775512; i=@fujitsu.com; bh=dPx8xkRH+M13ldiVfjHxDDuE38BfJZItPQyU90+LlAU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UdL04D/PvpOcIYhycQcyhhskygebrGC9cqkFJzpFLou55zK0aTizyWJejLgWhgk+e iTWo5uFlR1GxfeFwPsvGos7FAIPZbFT1h5fARnYynv7g24gwlGriF/GNGFSD2y1rDM dvPqgekKOh8AAdGlYFQwUGyC6XyOhCTkFV0eSbY6KeceBnEUo63YqcO/ljIoPtAI6X y9PzK/Z7YmIxHJA9Mg4m+7GfqvIDqY0WnJonuF+SGpqOOCfwPm3l7MzDafWgL44wGx OD7n1/wufcFvlemTS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0PDOfMP3xUq/V7A0v1/yzqNtxmQu2VVHTttdv+H5v96q4X+UH1dj3bJtlWFt11cfLbDeE3pSa 3369K+1h57N+vb67qzkyTZc92V3TLnHrP747v0EJZbijERDLeai4kQAqvXQYqcDAAA= X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-4.tower-571.messagelabs.com!1657775502!145405!1 X-Originating-IP: [62.60.8.97] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.87.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 5696 invoked from network); 14 Jul 2022 05:11:43 -0000 Received: from unknown (HELO n03ukasimr01.n03.fujitsu.local) (62.60.8.97) by server-4.tower-571.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 14 Jul 2022 05:11:43 -0000 Received: from n03ukasimr01.n03.fujitsu.local (localhost [127.0.0.1]) by n03ukasimr01.n03.fujitsu.local (Postfix) with ESMTP id AB73B100198; Thu, 14 Jul 2022 06:11:42 +0100 (BST) Received: from R01UKEXCASM126.r01.fujitsu.local (R01UKEXCASM126 [10.183.43.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by n03ukasimr01.n03.fujitsu.local (Postfix) with ESMTPS id 9D72E100197; Thu, 14 Jul 2022 06:11:42 +0100 (BST) Received: from localhost.localdomain (10.167.220.84) by R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Thu, 14 Jul 2022 06:11:38 +0100 From: Yang Xu To: , CC: , , , , , , , Subject: [PATCH v10 4/4] ceph: rely on vfs for setgid stripping Date: Thu, 14 Jul 2022 14:11:28 +0800 Message-ID: <1657779088-2242-4-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1657779088-2242-1-git-send-email-xuyang2018.jy@fujitsu.com> References: <1657779088-2242-1-git-send-email-xuyang2018.jy@fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD08.g08.fujitsu.local (10.167.33.83) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Now that we finished moving setgid stripping for regular files in setgid directories into the vfs, individual filesystem don't need to manually strip the setgid bit anymore. Drop the now unneeded code from ceph. Reviewed-by: Xiubo Li Reviewed-by: Christian Brauner (Microsoft) Reviewed-and-Tested-by: Jeff Layton Signed-off-by: Yang Xu --- fs/ceph/file.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index da59e836a06e..5a0266ea66ff 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -657,10 +657,6 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry, /* Directories always inherit the setgid bit. */ if (S_ISDIR(mode)) mode |= S_ISGID; - else if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP) && - !in_group_p(dir->i_gid) && - !capable_wrt_inode_uidgid(&init_user_ns, dir, CAP_FSETID)) - mode &= ~S_ISGID; } else { in.gid = cpu_to_le32(from_kgid(&init_user_ns, current_fsgid())); }