[Devel] [PATCH hci-8.1 v11 00/10] dm-qcow2: truncate unused tail of image on suspend

Konstantin Khorenko khorenko at virtuozzo.com
Mon Nov 9 18:54:12 MSK 2026


Sasha,

One more thing to my v11 review, the item I listed under "Separate
patches": a REQ_OP_FLUSH whose fsync fails with ENOSPC hits
WARN_ON_ONCE(!op_is_write()) in qrq_endio().

I checked this one to the end, it is real. Please send a separate
patch for it.

The path:
- qcow2_clone_and_map() sets endio_cb = qrq_endio for every request,
  a flush included;
- qcow2_submit_embedded_qio() puts an empty request on QLIST_FLUSH;
- do_qcow2_fsync_work() ends it with errno_to_blk_status(fsync_ret),
  so a failed vfs_fsync() with -ENOSPC gives BLK_STS_NOSPC;
- qrq_endio() then does WARN_ON_ONCE(!op_is_write(qio->bi_op)), and
  op_is_write(REQ_OP_FLUSH) is false.

fsync returns ENOSPC on file systems that allocate on writeback (NFS,
FUSE, thin or reflink backends), or when ext4/xfs report a failed
delayed write. The rest of the handling is already right: the flush is
delayed and resubmitted like a write. Only the WARN is wrong, and with
panic_on_warn it takes the node down.

Suggested fix:

	WARN_ON_ONCE(!op_is_write(qio->bi_op) &&
		     qio->bi_op != REQ_OP_FLUSH);

The WARN came with 7d49e18c5c36f ("dm-qcow2: Pause IO and notify about
ENOSPC events"), so that is the Fixes tag.

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team



More information about the Devel mailing list