Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp315022iog; Fri, 24 Jun 2022 04:44:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uRJZSBRg1q+oHmfGffoiTqYUrtzGSQhx8fc0x8xgcjDcVBT7skMUlbctf4Qv+r25NOPBcN X-Received: by 2002:a17:906:9c82:b0:6e1:2c94:1616 with SMTP id fj2-20020a1709069c8200b006e12c941616mr12886925ejc.64.1656071080520; Fri, 24 Jun 2022 04:44:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656071080; cv=none; d=google.com; s=arc-20160816; b=CVw7rieJljQRjBJ4bpXrGKYYqT5zZVMK2fDjkbNWvIsUamccUKZgr59/jflkHOrz6p afa8tJ30WL6sXhuro1T40J6IoEkelEtoR085EbmP2SfBMc54MDPoUkcIwrWfW7exgzT8 imwmS+iwTPN9EPKLbhCl0GEctGeKwZumnAHo7DXRF1kFFz8aIo6SKCoN8/fHikQ6YXww XyXkqWIaeOrltvI9x6i8/OBppI9gs0aAS86uIskJUOrZ1Ko3eQFZ/VAthQZwFhHt0e79 GoWybr2YQRTNUhT7AkT6IdVThj0keIM5Ib1oi5ZO9Pid4VbqCW4I381aP+ejmI6M6n0W NBRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=3Mkqb1PWuU0xIeT72wwiSaW/DavCpeTw5fGLN/P1VQc=; b=WvdZNGKUvfy+L6iOsT2yVEDSqb+IaWRrUgcd4o37qt9/FqxRE4TmgFe1gsODRTHzCt 8G6r7JQw3veaeP+w1jeYPid82Beiz/rQMPx+0Nb6C4j2AcTGO21sCDfS0Wo5DphDD5g+ 9KZE9IJBVnWpDVhYJrIwwOW12YDiQ1eteq/hs3X9BQoPJbu8ck5iijd79ZqnQK1GNw5+ 2f5v76CQPVdMEyBgEFEbnO9yqCNB8Ccb0E9Y7HauNkyCvmpbTZGnGMgLePJ0zJJ5dFBZ Ik9n/wsYh8FqKQ3zpQcsV9vIyU1kJADeBWQ5MeB27TibCWnDX7Jb+C+q32mXqhnR4kY5 3ANQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=QdTf2H87; dkim=pass header.i=@paragon-software.com header.s=mail header.b=tIKtuYDR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y19-20020a056402359300b00435ba45ad70si3505145edc.14.2022.06.24.04.44.15; Fri, 24 Jun 2022 04:44:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=QdTf2H87; dkim=pass header.i=@paragon-software.com header.s=mail header.b=tIKtuYDR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231134AbiFXLk7 (ORCPT + 99 others); Fri, 24 Jun 2022 07:40:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230032AbiFXLk5 (ORCPT ); Fri, 24 Jun 2022 07:40:57 -0400 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B63D8680A7; Fri, 24 Jun 2022 04:40:56 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 88D4C1D74; Fri, 24 Jun 2022 11:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1656070803; bh=3Mkqb1PWuU0xIeT72wwiSaW/DavCpeTw5fGLN/P1VQc=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=QdTf2H871h2QnnqOsrvFnsrrRAqRAmzhcM5EVdkt2w+7SmIkPp//N+MPFcUNhY23L 7XhfgW3cEl7Fr/1zlFC6jsYP3EtKUnO3hXODEIEenlvbxUyNb9fMzJQvmDqjPFMMVc m/RrnjMWDa9pgRK1qnegZ9Ncgg3RmxaX9lGiIsXs= Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayfre-01.paragon-software.com (Postfix) with ESMTPS id CF2B321AE; Fri, 24 Jun 2022 11:40:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1656070854; bh=3Mkqb1PWuU0xIeT72wwiSaW/DavCpeTw5fGLN/P1VQc=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=tIKtuYDRhff+4vCu0zOMkGRP3foRNjv4lcGXrl2UmALCXSGATWlxM4IZMcK/2pMj8 kDqXevtqpF2UAPvHlszMSBACPja77tcN6XAL0DNuYMPwA9pBzf1WfEFtq84nCKqkgJ dh/XGKKagWx5C+9iJHnZ/8kIl+bsGbRBmAjsKPWM= Received: from [172.30.8.65] (172.30.8.65) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Fri, 24 Jun 2022 14:40:54 +0300 Message-ID: <71c6964a-bcab-0c53-931a-6e41b2637ff0@paragon-software.com> Date: Fri, 24 Jun 2022 14:40:54 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: [PATCH 1/3] fs/ntfs3: Do not change mode if ntfs_set_ea failed Content-Language: en-US From: Konstantin Komarov To: CC: , References: In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [172.30.8.65] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ntfs_set_ea can fail with NOSPC, so we don't need to change mode in this situation. Fixes xfstest generic/449 Fixes: be71b5cba2e6 ("fs/ntfs3: Add attrib operations") Signed-off-by: Konstantin Komarov --- fs/ntfs3/xattr.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index 5e0e0280e70d..1e849428bbc8 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -547,28 +547,23 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, { const char *name; size_t size, name_len; - void *value = NULL; - int err = 0; + void *value; + int err; int flags; + umode_t mode; if (S_ISLNK(inode->i_mode)) return -EOPNOTSUPP; + mode = inode->i_mode; switch (type) { case ACL_TYPE_ACCESS: /* Do not change i_mode if we are in init_acl */ if (acl && !init_acl) { - umode_t mode; - err = posix_acl_update_mode(mnt_userns, inode, &mode, &acl); if (err) goto out; - - if (inode->i_mode != mode) { - inode->i_mode = mode; - mark_inode_dirty(inode); - } } name = XATTR_NAME_POSIX_ACL_ACCESS; name_len = sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1; @@ -604,8 +599,13 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0); if (err == -ENODATA && !size) err = 0; /* Removing non existed xattr. */ - if (!err) + if (!err) { set_cached_acl(inode, type, acl); + if (inode->i_mode != mode) { + inode->i_mode = mode; + mark_inode_dirty(inode); + } + } out: kfree(value); -- 2.36.1