Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

uapi: fix statx attribute value overlap for DAX & MOUNT_ROOT

STATX_ATTR_MOUNT_ROOT and STATX_ATTR_DAX got merged with the same value,
so one of them needs fixing. Move STATX_ATTR_DAX.

While we're in here, clarify the value-matching scheme for some of the
attributes, and explain why the value for DAX does not match.

Fixes: 80340fe3605c ("statx: add mount_root")
Fixes: 712b2698e4c0 ("fs/stat: Define DAX statx attribute")
Link: https://lore.kernel.org/linux-fsdevel/7027520f-7c79-087e-1d00-743bdefa1a1e@redhat.com/
Link: https://lore.kernel.org/lkml/20201202214629.1563760-1-ira.weiny@intel.com/
Reported-by: David Howells <dhowells@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: David Howells <dhowells@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Cc: <stable@vger.kernel.org> # 5.8
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Eric Sandeen and committed by
Linus Torvalds
72d1249e 062c9cdf

+6 -3
+6 -3
include/uapi/linux/stat.h
··· 171 171 * be of use to ordinary userspace programs such as GUIs or ls rather than 172 172 * specialised tools. 173 173 * 174 - * Note that the flags marked [I] correspond to generic FS_IOC_FLAGS 174 + * Note that the flags marked [I] correspond to the FS_IOC_SETFLAGS flags 175 175 * semantically. Where possible, the numerical value is picked to correspond 176 - * also. 176 + * also. Note that the DAX attribute indicates that the file is in the CPU 177 + * direct access state. It does not correspond to the per-inode flag that 178 + * some filesystems support. 179 + * 177 180 */ 178 181 #define STATX_ATTR_COMPRESSED 0x00000004 /* [I] File is compressed by the fs */ 179 182 #define STATX_ATTR_IMMUTABLE 0x00000010 /* [I] File is marked immutable */ ··· 186 183 #define STATX_ATTR_AUTOMOUNT 0x00001000 /* Dir: Automount trigger */ 187 184 #define STATX_ATTR_MOUNT_ROOT 0x00002000 /* Root of a mount */ 188 185 #define STATX_ATTR_VERITY 0x00100000 /* [I] Verity protected file */ 189 - #define STATX_ATTR_DAX 0x00002000 /* [I] File is DAX */ 186 + #define STATX_ATTR_DAX 0x00200000 /* File is currently in DAX state */ 190 187 191 188 192 189 #endif /* _UAPI_LINUX_STAT_H */