UAPI value collision: STATX_ATTR_MOUNT_ROOT vs STATX_ATTR_DAX
Hi Linus, Miklos, Ira,
It seems that two patches that got merged in the 5.8 merge window collided and no one noticed until now:
80340fe3605c0 (Miklos Szeredi 2020-05-14 184) #define STATX_ATTR_MOUNT_ROOT 0x00002000 /* Root of a mount */
...712b2698e4c02 (Ira Weiny 2020-04-30 186) #define STATX_ATTR_DAX 0x00002000 /* [I] File is DAX */
The question is, what do we do about it? Renumber one or both of the constants?
David
Quoted 6 lines · David Howells
Hi Linus, Miklos, Ira,
It seems that two patches that got merged in the 5.8 merge window collided and no one noticed until now:
Quoted 6 lines
80340fe3605c0(Miklos Szeredi 2020-05-14 184) #defineSTATX_ATTR_MOUNT_ROOT0x00002000/* Root of a mount */
...712b2698e4c02(Ira Weiny 2020-04-30 186) #defineSTATX_ATTR_DAX0x00002000/* [I] File is DAX */The question is, what do we do about it? Renumber one or both of the constants?
<uapi/linux/stat.h>:
* Note that the flags marked [I] correspond to generic FS_IOC_FLAGS
* semantically. Where possible, the numerical value is picked to correspond
* also.
<uapi/linux/fs.h>:
#define FS_DAX_FL 0x02000000 /* Inode is DAX */
The DAX one can be the same value as FS_DAX_FL, the placement (after STATX_ATTR_VERITY, instead of before) seems to confirm this intention.
Not that I care too much, the important thing is to have distinct values. Thanks,
Miklos
Quoted 20 lines · Miklos Szeredi
Quoted 6 lines · David Howells
Hi Linus, Miklos, Ira,
It seems that two patches that got merged in the 5.8 merge window collided and no one noticed until now:
Quoted 6 lines
80340fe3605c0(Miklos Szeredi 2020-05-14 184) #defineSTATX_ATTR_MOUNT_ROOT0x00002000/* Root of a mount */
...712b2698e4c02(Ira Weiny 2020-04-30 186) #defineSTATX_ATTR_DAX0x00002000/* [I] File is DAX */The question is, what do we do about it? Renumber one or both of the constants?
<
uapi/linux/stat.h>:
* Note that the flags marked [I] correspond to genericFS_IOC_FLAGS
* semantically. Where possible, the numerical value is picked to correspond
* also.
Quoted 5 lines
<
uapi/linux/fs.h>:
#defineFS_DAX_FL0x02000000/* Inode is DAX */The DAX one can be the same value as
FS_DAX_FL, the placement (afterSTATX_ATTR_VERITY, instead of before) seems to confirm this intention.
Yes, this looks like a bug in the STATX_ATTR_DAX value. It should be the same as FS_DAX_FL, like all of the other STATX_ATTR_* [I] values are.
Cheers, Andreas
Quoted 5 lines · David Howells
Hi Linus, Miklos, Ira,
It seems that two patches that got merged in the 5.8 merge window collided and no one noticed until now:
Quoted 8 lines
80340fe3605c0(Miklos Szeredi 2020-05-14 184) #defineSTATX_ATTR_MOUNT_ROOT0x00002000/* Root of a mount */
...712b2698e4c02(Ira Weiny 2020-04-30 186) #defineSTATX_ATTR_DAX0x00002000/* [I] File is DAX */The question is, what do we do about it? Renumber one or both of the constants?
David
Related to this, nothing sets STATX_ATTR_DAX into statx->attributes_mask, anywhere in the kernel.
The flag is set into statx->attributes in vfs_getattr_nosec(), but that does not know whether the particular filesystem under query supports dax or not.
This is related to my other email about exactly what attributes_mask means, so should STATX_ATTR_DAX be set in statx->attributes_mask only in the filesystems that support dax?
(And should that be done only if CONFIG_DAX is turned on, etc?)
-Eric
Quoted 7 lines
Related to this, nothing sets
STATX_ATTR_DAXintostatx->attributes_mask, anywhere in the kernel.The flag is set into
statx->attributesinvfs_getattr_nosec(), but that does not know whether the particular filesystem under query supports dax or not.
Quoted 5 lines
This is related to my other email about exactly what
attributes_maskmeans, so shouldSTATX_ATTR_DAXbe set instatx->attributes_maskonly in the filesystems that support dax?(And should that be done only if
CONFIG_DAXis turned on, etc?)
I think the mask/flag combinations should mean:
mask:off, flag:off -> value unknown
mask:off, flag:on -> N/A
mask:on, flag:off -> value is off
mask:on, flag:on -> value is on
So mask should be off iff STATX_ATTR_DAX will not be set even if DAX is enabled on a particular inode (such as on an old kernel not supporting STATX_ATTR_DAX).
Thanks,
Miklos