From patchwork Tue Apr 19 11:47:12 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: 12817785 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 89ACFC4332F for ; Tue, 19 Apr 2022 10:48:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350776AbiDSKvY (ORCPT ); Tue, 19 Apr 2022 06:51:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238369AbiDSKvX (ORCPT ); Tue, 19 Apr 2022 06:51:23 -0400 Received: from mail1.bemta36.messagelabs.com (mail1.bemta36.messagelabs.com [85.158.142.2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1ACB11CB33; Tue, 19 Apr 2022 03:48:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1650365319; i=@fujitsu.com; bh=L0gnk54iyGfM60Qjlex0JGvplvmF+grDZIqDPCSoCAQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Vbslnnvp7hIfI/TZE7tXKJR3U/OhVVDHi8Nw9ysK8O4YO+PvAYCM18PJZ8HA6Kdn+ If51cY2Pw67flEgu2vdqdfOuq6cIybAAHtJkSAYZuBAPQMHMOLGGnlngMMZpsJqLMG gXrHPgh5XGU7xDzAlXBS8nwzW8RQ0zedJ/9gvroDF2o2StoYVv7u1NE3nb/MXgDyW7 CO+qyFNdGjE0n4e4zXgA7jAOK/gxO7FifSPWONtuauFRyD3sIRbm+vn4YcuBc/zJU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P8Dzxcgh72suKNThlu G5Zrs60236H6M8vy1aW4jqWuq+dusG/pm7J91Uv5nsSJPFsFlQ1+2XOIf79SNyHU+oLqro2PX Nie986TfyMys/buTfnrj73dzF5xtVZa7zhdGaH5RImlOCPRUIu5qDgRAJF7efCfAwAA X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-25.tower-545.messagelabs.com!1650365318!270565!1 X-Originating-IP: [62.60.8.148] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.85.8; banners=-,-,- X-VirusChecked: Checked Received: (qmail 14526 invoked from network); 19 Apr 2022 10:48:38 -0000 Received: from unknown (HELO mailhost1.uk.fujitsu.com) (62.60.8.148) by server-25.tower-545.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 19 Apr 2022 10:48:38 -0000 Received: from R01UKEXCASM126.r01.fujitsu.local ([10.183.43.178]) by mailhost1.uk.fujitsu.com (8.14.5/8.14.5) with ESMTP id 23JAmcLA004855 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Tue, 19 Apr 2022 11:48:38 +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:48:32 +0100 From: Yang Xu To: CC: , , , , , , , , , , , Yang Xu Subject: [PATCH v4 6/8] ntfs3: Use the same order for acl pointer check in ntfs_init_acl Date: Tue, 19 Apr 2022 19:47:12 +0800 Message-ID: <1650368834-2420-6-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-fsdevel@vger.kernel.org Like ext4 and other use ${fs}_init_acl filesystem, they all used the following style error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl); if (error) return error; if (default_acl) { error = __ext4_set_acl(handle, inode, ACL_TYPE_DEFAULT, default_acl, XATTR_CREATE); posix_acl_release(default_acl); } else { inode->i_default_acl = NULL; } if (acl) { if (!error) error = __ext4_set_acl(handle, inode, ACL_TYPE_ACCESS, acl, XATTR_CREATE); posix_acl_release(acl); } else { inode->i_acl = NULL; } ... So for the readability and unity of the code, adjust this order. Signed-off-by: Yang Xu --- fs/ntfs3/xattr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index afd0ddad826f..64cefa869a61 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -642,13 +642,13 @@ int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode, inode->i_default_acl = NULL; } - if (!acl) - inode->i_acl = NULL; - else { + if (acl) { if (!err) err = ntfs_set_acl_ex(mnt_userns, inode, acl, ACL_TYPE_ACCESS); posix_acl_release(acl); + } else { + inode->i_acl = NULL; } return err;