Skip to contentSkip to conversation

Request: 38273e7b153d ("direct-io: remove IOCB_NOWAIT support") for 6.1, 6.6, 6.12 and 6.18

DISCUSSION Applied Nico Schmidt 2 participants 2 messages Dec 2 – Dec 3

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

please consider 38273e7b153d ("direct-io: remove IOCB_NOWAIT support") for the 6.1, 6.6, 6.12 and 6.18 trees. It went into 7.1 as a dead code removal, but it also fixes a real bug: O_DIRECT writes through io_uring fail with EIO on ocfs2 when the device is dm-multipath.

How it happens on the trees above:
- ocfs2_file_open() sets FMODE_NOWAIT, so io_uring first issues each write with IOCB_NOWAIT.
- ocfs2 uses the legacy fs/direct-io.c, which sets REQ_NOWAIT on write bios when IOCB_NOWAIT is set.
- dm-multipath does not support REQ_NOWAIT, so submit_bio_noacct() ends the bio with BLK_STS_NOTSUPP.
- dio_bio_complete() maps every status except BLK_STS_AGAIN to -EIO, so the write fails with EIO ("ocfs2_dio_end_io ... Direct IO failed, bytes = -5") instead of returning -EAGAIN for io_uring to retry.

Writes that need new clusters return -EAGAIN earlier in ocfs2 and are fine; writes into already allocated space fail. In practice this hits QEMU guests whose qcow2 images sit on ocfs2 over multipath with aio=io_uring, which Proxmox VE uses by default for directory storages. The guest sees write errors and remounts read-only. A plain SCSI path supports REQ_NOWAIT and is not affected.

The commit message says that no filesystem using the legacy direct I/O code sets FMODE_NOWAIT; ocfs2 does (since 4.17), which is how the removal fixed this.

Reproducer, any ocfs2 volume (cluster or local mode) on a dm-multipath map:

  fio --name=t --filename=/mnt/ocfs2/f --ioengine=io_uring --direct=1 \
      --rw=write --bs=64k --size=64m --iodepth=1 --fallocate=none

fails with EIO at offset 65536. With --force_async=1, or with libaio or pvsync2, it passes.

Tested on a two-path iSCSI LUN with dm-multipath:
- Proxmox VE kernel 7.0.14 (7.0 based): fails
- next-20261127 (contains the commit): passes
- 6.18.66: fails (qemu-io growing a qcow2 with aio=io_uring, cluster and local mode, and the fio run above)
- 6.18.66 + 38273e7b153d: passes, same runs; libaio, pvsync2 and RWF_NOWAIT behave as before (RWF_NOWAIT still gets EAGAIN)

The commit applies cleanly to 6.1.y, 6.6.y, 6.12.y and 6.18.y.

The testing and the analysis were done with the help of an AI coding assistant (Claude); I reviewed the analysis and checked the results myself.

Regards,
Nico Schmidt

maintainer Applied
#1 lore raw
Quoted 2 lines

please consider 38273e7b153d ("direct-io: remove IOCB_NOWAIT support") for the 6.1, 6.6, 6.12 and 6.18 trees.

Queued for 6.18, 6.12, 6.6 and 6.1, thanks.

Signature · 2 lines
Thanks,
Sasha