From: JeffleXu <jefflexu@linux.alibaba.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
linux-ext4@vger.kernel.org
Subject: Re: [PATCH] vfs: only allow SETFLAGS to set DAX flag on files and dirs
Date: Mon, 19 Jul 2021 09:47:45 +0800 [thread overview]
Message-ID: <e85ceae6-23b8-aea8-1314-7e2ebece61d6@linux.alibaba.com> (raw)
In-Reply-To: <20210716162017.GA22346@magnolia>
On 7/17/21 12:20 AM, Darrick J. Wong wrote:
> On Fri, Jul 16, 2021 at 02:19:51PM +0800, Jeffle Xu wrote:
>> This is similar to commit dbc77f31e58b ("vfs: only allow FSSETXATTR to
>> set DAX flag on files and dirs").
>>
>> Though the underlying filesystems may have filtered invalid flags, e.g.,
>> ext4_mask_flags() called in ext4_fileattr_set(), also check it in VFS
>> layer.
>>
>> Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
>> ---
>> fs/ioctl.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/ioctl.c b/fs/ioctl.c
>> index 1e2204fa9963..1fe73e148e2d 100644
>> --- a/fs/ioctl.c
>> +++ b/fs/ioctl.c
>> @@ -835,7 +835,7 @@ static int fileattr_set_prepare(struct inode *inode,
>> * It is only valid to set the DAX flag on regular files and
>> * directories on filesystems.
>> */
>> - if ((fa->fsx_xflags & FS_XFLAG_DAX) &&
>> + if ((fa->fsx_xflags & FS_XFLAG_DAX || fa->flags & FS_DAX_FL) &&
>
> I thought we always had to surround flag tests with separate
> parentheses...?
Thanks.
The 'bitwise and' has a higher priority than 'logical or'. But for sure
I can add parentheses to make it more readable and precise.
--
Thanks,
Jeffle
prev parent reply other threads:[~2021-07-19 1:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-16 6:19 [PATCH] vfs: only allow SETFLAGS to set DAX flag on files and dirs Jeffle Xu
2021-07-16 16:20 ` Darrick J. Wong
2021-07-19 1:47 ` JeffleXu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e85ceae6-23b8-aea8-1314-7e2ebece61d6@linux.alibaba.com \
--to=jefflexu@linux.alibaba.com \
--cc=djwong@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).