linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* UAPI value collision: STATX_ATTR_MOUNT_ROOT vs STATX_ATTR_DAX
@ 2020-11-25 16:50 David Howells
  2020-11-25 19:26 ` Miklos Szeredi
  2020-11-25 19:32 ` Eric Sandeen
  0 siblings, 2 replies; 5+ messages in thread
From: David Howells @ 2020-11-25 16:50 UTC (permalink / raw)
  To: torvalds, Miklos Szeredi, Ira Weiny
  Cc: dhowells, sandeen, linux-fsdevel, linux-man, linux-kernel

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: UAPI value collision: STATX_ATTR_MOUNT_ROOT vs STATX_ATTR_DAX
  2020-11-25 16:50 UAPI value collision: STATX_ATTR_MOUNT_ROOT vs STATX_ATTR_DAX David Howells
@ 2020-11-25 19:26 ` Miklos Szeredi
  2020-11-26  3:00   ` Andreas Dilger
  2020-11-25 19:32 ` Eric Sandeen
  1 sibling, 1 reply; 5+ messages in thread
From: Miklos Szeredi @ 2020-11-25 19:26 UTC (permalink / raw)
  To: David Howells
  Cc: Linus Torvalds, Miklos Szeredi, Ira Weiny, sandeen,
	linux-fsdevel, linux-man, linux-kernel

On Wed, Nov 25, 2020 at 5:57 PM David Howells <dhowells@redhat.com> wrote:
>
> 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?

<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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: UAPI value collision: STATX_ATTR_MOUNT_ROOT vs STATX_ATTR_DAX
  2020-11-25 16:50 UAPI value collision: STATX_ATTR_MOUNT_ROOT vs STATX_ATTR_DAX David Howells
  2020-11-25 19:26 ` Miklos Szeredi
@ 2020-11-25 19:32 ` Eric Sandeen
  2020-11-25 20:44   ` Miklos Szeredi
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Sandeen @ 2020-11-25 19:32 UTC (permalink / raw)
  To: David Howells, torvalds, Miklos Szeredi, Ira Weiny
  Cc: linux-fsdevel, linux-man, linux-kernel

On 11/25/20 10:50 AM, David Howells wrote:
> 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

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: UAPI value collision: STATX_ATTR_MOUNT_ROOT vs STATX_ATTR_DAX
  2020-11-25 19:32 ` Eric Sandeen
@ 2020-11-25 20:44   ` Miklos Szeredi
  0 siblings, 0 replies; 5+ messages in thread
From: Miklos Szeredi @ 2020-11-25 20:44 UTC (permalink / raw)
  To: Eric Sandeen
  Cc: David Howells, Linus Torvalds, Miklos Szeredi, Ira Weiny,
	linux-fsdevel, linux-man, linux-kernel

> 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?)

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: UAPI value collision: STATX_ATTR_MOUNT_ROOT vs STATX_ATTR_DAX
  2020-11-25 19:26 ` Miklos Szeredi
@ 2020-11-26  3:00   ` Andreas Dilger
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Dilger @ 2020-11-26  3:00 UTC (permalink / raw)
  To: Miklos Szeredi
  Cc: David Howells, Linus Torvalds, Miklos Szeredi, Ira Weiny,
	Eric Sandeen, linux-fsdevel, linux-man, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1264 bytes --]

On Nov 25, 2020, at 12:26 PM, Miklos Szeredi <miklos@szeredi.hu> wrote:
> 
> On Wed, Nov 25, 2020 at 5:57 PM David Howells <dhowells@redhat.com> wrote:
>> 
>> 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?
> 
> <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.

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






[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-26  3:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 16:50 UAPI value collision: STATX_ATTR_MOUNT_ROOT vs STATX_ATTR_DAX David Howells
2020-11-25 19:26 ` Miklos Szeredi
2020-11-26  3:00   ` Andreas Dilger
2020-11-25 19:32 ` Eric Sandeen
2020-11-25 20:44   ` Miklos Szeredi

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).