xfs: conditionally allow FS_XFLAG_REALTIME changes if S_DAX is set
authorDarrick J. Wong <djwong@kernel.org>
Sun, 4 Aug 2024 21:39:57 +0000 (14:39 -0700)
committerChandan Babu R <chandanbabu@kernel.org>
Wed, 14 Aug 2024 15:50:24 +0000 (21:20 +0530)
commit8d16762047c627073955b7ed171a36addaf7b1ff
treec4f51c346739f90b72e23cf0461bf6549cd3cecb
parent04d6dbb55301a29aeb9a197e6b0012cdc265f1e4
xfs: conditionally allow FS_XFLAG_REALTIME changes if S_DAX is set

If a file has the S_DAX flag (aka fsdax access mode) set, we cannot
allow users to change the realtime flag unless the datadev and rtdev
both support fsdax access modes.  Even if there are no extents allocated
to the file, the setattr thread could be racing with another thread
that has already started down the write code paths.

Fixes: ba23cba9b3bdc ("fs: allow per-device dax status checking for filesystems")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
fs/xfs/xfs_ioctl.c