Re: [RFC PATCH v14 00/10] migrate ocfs2 DIO from buffer_head to iomap
From: Nico Schmidt
Date: Wed Dec 02 2026 - 14:26:59 EST
Hi Joseph,
thanks for the quick answer. As offered, I ran v14 on our multipath SAN
lab. In short: no data errors, the two-node and crash runs passed, and
one small issue with error logging on misaligned reads (below).
Setup:
- next-20261127, with and without v14, x86_64, Debian 13 userspace,
the nodes are KVM guests
- one TrueNAS iSCSI LUN (100 GiB, 512 byte logical blocks) over two
paths, dm-multipath with two path groups
- mkfs.ocfs2 -b 4K -C 1M -T vmstore -N 4, o2cb, local heartbeat
- the second node ran a 7.0 distribution kernel (Proxmox 7.0.6), so the
domain had the old and the new DIO path side by side
Results:
1. One node, base and v14: qemu-io growing a qcow2 with aio=io_uring,
native and threads; fio O_DIRECT extending writes with io_uring at
iodepth 1 and 16, libaio and pvsync2; RWF_NOWAIT; local mode; ext4
on the same map as a control. No errors on either kernel.
2. Two nodes writing at the same time (v14 with io_uring, 7.0 with
libaio): per node a 1 GiB extending sequential file and 512 MiB of
random writes into its own half of one shared sparse file, 64k
blocks, crc32c verify. Then each node verified the data of the
other with the page cache dropped. No errors.
3. Crash: SysRq-b on the v14 node while both were writing. The other
node evicted it after the idle timeout, became recovery master and
replayed slot 0. Its verified writer saw no error; the longest
single write took 12.5 s.
The issue: ocfs2_dio_end_io_r_pr() logs every error it gets, and with
iomap an O_DIRECT read into a misaligned user buffer, which correctly
fails with EINVAL, now reaches it:
(qemu-io,6254,1):ocfs2_dio_end_io_r_pr:3980 ERROR: Direct IO failed, bytes = 0 errno:-22
Reproducer: preadv() of 4096 bytes at offset 0 on an O_DIRECT fd, into
a buffer at a page address + 1. A misaligned length (1 byte) does not
log, an aligned read does not log. QEMU probes the buffer alignment
exactly like this when it opens an image with cache.direct=on
(raw_probe_alignment() in block/file-posix.c), so with v14 every VM
start on OCFS2 logs this line. The buffer_head path returned the EINVAL
without logging. Maybe leave -EINVAL out there, or do not log on the
read side at all, as ext4 and xfs do. I did not test the same on the
write side.
Tested-by: Nico Schmidt <nico.schmidt@xxxxxxxxxxxx>
About the io_uring EIO from my first mail: it is not in the DIO code
this series replaces, and it is fixed in mainline since 7.1. Up to 7.0,
fs/direct-io.c set REQ_NOWAIT on write bios for IOCB_NOWAIT. ocfs2 sets
FMODE_NOWAIT, so io_uring tries each write nonblocking first, and
dm-multipath does not support REQ_NOWAIT: submit_bio_noacct() ends the
bio with BLK_STS_NOTSUPP, dio_bio_complete() turns that into -EIO, and
io_uring gets no -EAGAIN to retry with. Christoph's 38273e7b153d
("direct-io: remove IOCB_NOWAIT support") removed that code, with the
note that no filesystem on the legacy path sets FMODE_NOWAIT; ocfs2
does. The commit has no stable tag, so 6.1 to 6.18 still fail. I will
ask stable for it in a separate mail, with you on Cc.
The testing and the analysis were done with the help of an AI coding
assistant (Claude); I went through the results.
Best regards,
Nico