Re: [PATCH v2 14/14] fs: xfs: Support setting FMODE_CAN_ATOMIC_WRITE

From: John Garry
Date: Thu Mar 07 2024 - 06:56:42 EST


On 06/03/2024 21:33, Dave Chinner wrote:
+static bool xfs_file_open_can_atomicwrite(
+ struct inode *inode,
+ struct file *file)
+{
+ struct xfs_inode *ip = XFS_I(inode);
+ struct xfs_buftarg *target = xfs_inode_buftarg(ip);
+
+ if (!(file->f_flags & O_DIRECT))
+ return false;
+
+ if (!xfs_inode_atomicwrites(ip))
+ return false;
+
+ if (!bdev_can_atomic_write(target->bt_bdev))
+ return false;
Again, this is static blockdev information - the inode atomic write
flag should not be set if the bdev cannot do atomic writes. It
should be checked at mount time

ok

- the filesystem probably should
only mount read-only if it is configured to allow atomic writes and
the underlying blockdev does not support atomic writes...

Let me know if you really would like to see that change also. It does seem a bit drastic, considering we can just disallow atomic writes.

Thanks,
John