Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp623906pxb; Wed, 22 Sep 2021 09:21:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzb6EHYUIymZgqXqmg1An39e5506GHo7+7HAPKx7Id4zU4IXMJgIRcb0csHfH0lf0OkTgY0 X-Received: by 2002:a92:da85:: with SMTP id u5mr400258iln.213.1632327662078; Wed, 22 Sep 2021 09:21:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632327662; cv=none; d=google.com; s=arc-20160816; b=cLXH4vre5HjpZTSfyD4UAxQ3Dh8lTnCk5eDid5zJB7IrghMdhbEenr6ngZUqIJotkJ 9iPpyQZ4x+WDFfwF2VNaTtPPBvvNUlEXw6KC3AHwL4bLECyUzHxFWMOIgcfcHetZLv8t Zkk4ZZZuDfQdmnVamtJvnvqhX1KipvPxZ1qeNzIEylH5rr0rWgRiGJHjquUp6/ghRW1c JquLlkcQXUw/LjWwyMJtDtbVXNWEa87Vjt+e6ALQoJjyle/bEKTFzesyOlN6hgte81/k eHQMC7lZkvYaGwp6KmgllTy5HuVmZUBNEPOLoDATLTM8FhXiSQ8h1VQjBRKSHRakGUn0 sT+w== 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:cc :references:to:from:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=ha5KScEEr/4qiK0D82pDFvi0KlfCBt3k5qZ32Ma0pI4=; b=QDTnHyNyy4v/euNS5Pp9wYSvnHZLdJhYJElstIofiBs/cSnwXC7tABGDKcq6Xe4SB7 gC4SotmManLZ0jM7OELT3H5EGQpYybDAf0hcbtt+POJHWWSc8cumwwWIKDx9oLRQx5Ul tqrDd1ZeklCpK+STkDFeEYxJcqlNMX4IkstO/apvkQsYnKvGEIkafmy8PYa1VS3tuaU0 /FIcrN3N6Hb6LurOSWrhclpqZpgw/R1uSz0phkdG8c2IM4ANdsRrBMVEoBZXbBqY1Nsb 6kgZ1wSiOcGU+vZihI+dSWoehPCLkZARCzHgxQlKvjHFNpc0E8Xj4YTMbiYXxXBRac2g T76g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b="eWnwG8/L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s7si2895174ilp.105.2021.09.22.09.20.42; Wed, 22 Sep 2021 09:21:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b="eWnwG8/L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S236629AbhIVQU7 (ORCPT + 99 others); Wed, 22 Sep 2021 12:20:59 -0400 Received: from relaydlg-01.paragon-software.com ([81.5.88.159]:40893 "EHLO relaydlg-01.paragon-software.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236558AbhIVQUy (ORCPT ); Wed, 22 Sep 2021 12:20:54 -0400 Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relaydlg-01.paragon-software.com (Postfix) with ESMTPS id BC25782301; Wed, 22 Sep 2021 19:19:20 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1632327560; bh=ha5KScEEr/4qiK0D82pDFvi0KlfCBt3k5qZ32Ma0pI4=; h=Date:Subject:From:To:References:CC:In-Reply-To; b=eWnwG8/LYteUmYBDXEPA4JgEEErk+znXQLcq0vZtU+swgyx9Fs0zjmn2C64IT9hjI 6DbIsH/rX7GXzRabn8T0UttC/5wH+M119Ppz7VPMQOv1yPvftH9nqHTABdqORnDf/7 /3M/nhjpyYbrhqpJ5JHwBH9/36gXXKS6LaB7T1qw= Received: from [192.168.211.195] (192.168.211.195) 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.2176.2; Wed, 22 Sep 2021 19:19:20 +0300 Message-ID: Date: Wed, 22 Sep 2021 19:19:19 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.1 Subject: [PATCH 3/5] fs/ntfs3: Pass flags to ntfs_set_ea in ntfs_set_acl_ex Content-Language: en-US From: Konstantin Komarov To: References: <2771ff62-e612-a8ed-4b93-5534c26aef9e@paragon-software.com> CC: , In-Reply-To: <2771ff62-e612-a8ed-4b93-5534c26aef9e@paragon-software.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.211.195] X-ClientProxiedBy: vobn-exch-01.paragon-software.com (172.30.72.13) To vdlg-exch-02.paragon-software.com (172.30.1.105) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Konstantin Komarov --- fs/ntfs3/xattr.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index 3795943efc8e..70f2f9eb6b1e 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -549,6 +549,7 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, size_t size, name_len; void *value = NULL; int err = 0; + int flags; if (S_ISLNK(inode->i_mode)) return -EOPNOTSUPP; @@ -591,20 +592,24 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, } if (!acl) { + /* Remove xattr if it can be presented via mode. */ size = 0; value = NULL; + flags = XATTR_REPLACE; } else { size = posix_acl_xattr_size(acl->a_count); value = kmalloc(size, GFP_NOFS); if (!value) return -ENOMEM; - err = posix_acl_to_xattr(mnt_userns, acl, value, size); if (err < 0) goto out; + flags = 0; } - err = ntfs_set_ea(inode, name, name_len, value, size, 0, locked); + err = ntfs_set_ea(inode, name, name_len, value, size, flags, locked); + if (err == -ENODATA && !size) + err = 0; /* Removing non existed xattr. */ if (!err) set_cached_acl(inode, type, acl); -- 2.33.0