From patchwork Tue Apr 19 11:47:09 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: 12817755 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 5B822C4332F for ; Tue, 19 Apr 2022 10:47:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350779AbiDSKto (ORCPT ); Tue, 19 Apr 2022 06:49:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240381AbiDSKtm (ORCPT ); Tue, 19 Apr 2022 06:49:42 -0400 Received: from mail3.bemta32.messagelabs.com (mail3.bemta32.messagelabs.com [195.245.230.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DFD61CB34; Tue, 19 Apr 2022 03:46:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1650365217; i=@fujitsu.com; bh=4LvUQiHQuZbq3+y9oGS90voMbGFx43rdOdvN/yWo2vI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ao26HRrlQaKtDPImAqAml+KuTJieC1e81R6RJISy54lToIcQ9oV2MWbIFyiM2crWn e2k778pGa9p83yhbDtcbWtLkSKwWjXo4FBLtw0S/8lqbjKD8ZR4itsIvORc768ViOH HnjfTwwYH+CW8+BRezNa2dyoWhbCCF/cXAPE3GxAOUbRvbeQvsbpyuG3AABzoDTJpH YrnDFbAejVXwaHCPJR0Vo9S5ElKSJwD3tChw7RUTM689yjQb6nkk8lnqo6tO+sm8gI rbDe3b0Utulm5ETU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qXqb+DLf /Nu/f11d5x/jyuvrvDMDD73tDfJtS3POury3lP1LabfJwwmLfhl8lsvdcryKcXlXbdekmqap3 0OEhTzOz/mn1dKx3GvWqR+ynnL3t3XNOJtZLv9NiaU4I9FQi7moOBEAMekPSpoDAAA= X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-18.tower-585.messagelabs.com!1650365216!280278!1 X-Originating-IP: [62.60.8.84] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.85.8; banners=-,-,- X-VirusChecked: Checked Received: (qmail 24417 invoked from network); 19 Apr 2022 10:46:56 -0000 Received: from unknown (HELO mailhost3.uk.fujitsu.com) (62.60.8.84) by server-18.tower-585.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 19 Apr 2022 10:46:56 -0000 Received: from R01UKEXCASM126.r01.fujitsu.local ([10.183.43.178]) by mailhost3.uk.fujitsu.com (8.14.5/8.14.5) with ESMTP id 23JAkiuN014724 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Tue, 19 Apr 2022 11:46:44 +0100 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; Tue, 19 Apr 2022 11:46:38 +0100 From: Yang Xu To: CC: , , , , , , , , , , , Yang Xu Subject: [PATCH v4 3/8] xfs: only call posix_acl_create under CONFIG_XFS_POSIX_ACL Date: Tue, 19 Apr 2022 19:47:09 +0800 Message-ID: <1650368834-2420-3-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1650368834-2420-1-git-send-email-xuyang2018.jy@fujitsu.com> References: <1650368834-2420-1-git-send-email-xuyang2018.jy@fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Since xfs_generic_create only calls xfs_set_acl when enable this kconfig, we don't need to call posix_acl_create for the !CONFIG_XFS_POSIX_ACL case. The previous patch has added missing umask strip for tmpfile, so all creation paths handle umask in the vfs directly if the filesystem doesn't support or enable POSIX ACLs. So just put this function under CONFIG_XFS_POSIX_ACL and umask strip still works well. Also use unified rule for CONFIG_XFS_POSIX_ACL in this file, so use IS_ENABLED in xfs_generic_create. Signed-off-by: Yang Xu --- fs/xfs/xfs_iops.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index b34e8e4344a8..6b8df9ab215a 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -150,6 +150,7 @@ xfs_create_need_xattr( return true; if (default_acl) return true; + #if IS_ENABLED(CONFIG_SECURITY) if (dir->i_sb->s_security) return true; @@ -169,7 +170,7 @@ xfs_generic_create( { struct inode *inode; struct xfs_inode *ip = NULL; - struct posix_acl *default_acl, *acl; + struct posix_acl *default_acl = NULL, *acl = NULL; struct xfs_name name; int error; @@ -184,9 +185,11 @@ xfs_generic_create( rdev = 0; } +#if IS_ENABLED(CONFIG_XFS_POSIX_ACL) error = posix_acl_create(dir, &mode, &default_acl, &acl); if (error) return error; +#endif /* Verify mode is valid also for tmpfile case */ error = xfs_dentry_mode_to_name(&name, dentry, mode); @@ -209,7 +212,7 @@ xfs_generic_create( if (unlikely(error)) goto out_cleanup_inode; -#ifdef CONFIG_XFS_POSIX_ACL +#if IS_ENABLED(CONFIG_XFS_POSIX_ACL) if (default_acl) { error = __xfs_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); if (error)