From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C1263FCB for ; Wed, 22 Sep 2021 17:59:09 +0000 (UTC) Received: by mail-lf1-f52.google.com with SMTP id m3so15335848lfu.2 for ; Wed, 22 Sep 2021 10:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=WgiekJX/9s+5F7cMUsEs7Zs0JsPNW6fpesGls7i7KT8=; b=Nail03moQgFVy1/7r6Gq/ckz1aed3mwnw3MlwiU1PQ42OrOdGSlNkpbWD+mWymhTLN pkwNGNCLoFG4UhwR8st2sSygtqa7K/QBDCq+8ZDK1QzdEagva/C77QzYbnkJJE3+siu7 OGJRQ2W/LAvY594y4BDxlEiMZBurWunhDXsMZwHBJzx1dVRWo2gIoO2EuVdAafksAibz f1pBlpt1R0qyNqEgvF8/JqrkoCTjILsqUl927jHQul12PzAiWhI/g2i/toUIJ8N810Y4 KA28WuXjDhTEd2OdefOpdaj+pwjyOl+yF5WZThY/EitbuOYEFBTNEtAc64DpXtKnUEyZ aaSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=WgiekJX/9s+5F7cMUsEs7Zs0JsPNW6fpesGls7i7KT8=; b=gE3vswimzUoLaPvvjkGQvoUIejTm4VtZFL8hytLS3PggL0VvTm96RU5JTMfccGHDnN GUzIPNqhf+/2d4TZ7E2xAzGfGV/xkyg0EbIwYJH61ZS19ydKSgjXnUi7zyjRJ8t8lPVt VT3vss2AjyQ4qD9x+66jolqLpySwKNwcGo4gtEe2Grmv/UYDbU2XDVA6syNTW9l5RBkF dVjGvZzUeDs8MZGsmMoDE3D900okVQ6WJ9aZIP5i+80pjpGmprgkksj4kd8rurMmUzoG cugspJpxaFK93I7wWZJTIzGAF88bnKEfimL0eh7V5NczpUztrswFjwF+9DlPHTZgRRp3 DUHA== X-Gm-Message-State: AOAM533OZUzBD1RYV21LEDyi29THI2bMO9LPDiOz/J5y0eBzKpn9Z3K/ c3gvhHXlygwWp4TTAUQ/D78= X-Google-Smtp-Source: ABdhPJz36uCauveUA5oGPy0oAbBIE0SUYcjYHgpKN1npnNyNrwzCY3bAaxCkb0RAIxuuXF56d1+HgQ== X-Received: by 2002:a2e:9dcb:: with SMTP id x11mr538140ljj.505.1632333546859; Wed, 22 Sep 2021 10:59:06 -0700 (PDT) Received: from kari-VirtualBox ([31.132.12.44]) by smtp.gmail.com with ESMTPSA id n9sm228733lfh.267.2021.09.22.10.59.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Sep 2021 10:59:06 -0700 (PDT) Date: Wed, 22 Sep 2021 20:59:04 +0300 From: Kari Argillander To: Konstantin Komarov Cc: ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 3/5] fs/ntfs3: Pass flags to ntfs_set_ea in ntfs_set_acl_ex Message-ID: <20210922175904.s5rxwhabnfopjbve@kari-VirtualBox> References: <2771ff62-e612-a8ed-4b93-5534c26aef9e@paragon-software.com> Precedence: bulk X-Mailing-List: ntfs3@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Sep 22, 2021 at 07:19:19PM +0300, Konstantin Komarov wrote: > Signed-off-by: Konstantin Komarov Please tell why we need to pass flags to ntfs_set_ea(). Commit message is for why we do something. It does not have to have example have any info what we did. Code will tell that. > --- > 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 > > >