[PATCH v2 02/17] fs: add kiocb_write_iter() and kiocb_end_write_iter()
Christian Brauner
brauner at kernel.org
Mon Nov 16 05:23:14 PST 2026
On Mon, Nov 16, 2026 at 11:30:59AM +0000, sashiko-bot at kernel.org wrote:
> Should kiocb_write_iter() check S_ISREG(file_inode(iocb->ki_filp)->i_mode)
> before taking freeze protection and setting IOCB_WRITE, the way
> file_start_write(), aio_write() and io_kiocb_start_write() do?
Eeew, no. That check alone would bring the bug back for these drivers.
blkdev_write_iter() calls file_update_time() which dirties the device
node's inode on the filesystem the node lives on. And write(2) on such a
node modifies a frozen filesystem today for the same reason.
For FIFOs we skip the time update on a frozen filesystem instead of
blocking (cf. 7e775f46a125f ("fs/pipe.c: skip file_update_time on frozen
fs")). If we change file_update_time() to do that for all special files
then kiocb_write_iter() can take the S_ISREG() check.
> Without an S_ISREG() check, writes to a block device node whose hosting
> filesystem is frozen will block in sb_start_write() (or fail with -EAGAIN for
> IOCB_NOWAIT), and will deadlock if that filesystem is mounted on or
> flushing through the virtual block device during freeze_super().
That can't happen. The node is opened when the device is set up so its
filesystem can't be mounted on that device.
More information about the Linux-nvme
mailing list