A REQ_OP_FLUSH request is completed by do_qcow2_fsync_work() with
errno_to_blk_status() of the vfs_fsync() result, so a failed fsync
with -ENOSPC ends it with BLK_STS_NOSPC. qrq_endio() then hits
WARN_ON_ONCE(!op_is_write()), as op_is_write(REQ_OP_FLUSH) is false.
With panic_on_warn this takes the node down.

fsync returns ENOSPC on file systems that allocate on writeback (NFS,
FUSE, thin or reflink backends), and when ext4 or xfs report a failed
delayed write. Delaying and resubmitting the flush is already correct,
so only let the WARN accept REQ_OP_FLUSH.

Fixes: 7d49e18c5c36 ("dm-qcow2: Pause IO and notify about ENOSPC events")
https://virtuozzo.atlassian.net/browse/VSTOR-148171
Feature: dm-qcow2: block device over QCOW2 files driver

Signed-off-by: Alexander Ivanov <[email protected]>
---
 drivers/md/dm-qcow2-map.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
index 823b2e23644f..c2154c4f6f76 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -4491,7 +4491,8 @@ static void qrq_endio(struct qcow2_target *tgt, struct 
qio *qio,
         * callers receive -ENOSPC synchronous without intermediaries.
         */
        if (unlikely(bi_status == BLK_STS_NOSPC)) {
-               WARN_ON_ONCE(!op_is_write(qio->bi_op));
+               WARN_ON_ONCE(!op_is_write(qio->bi_op) &&
+                            qio->bi_op != REQ_OP_FLUSH);
                if (qcow2_try_delay_enospc(tgt, qrq, qio))
                        return;
        }
-- 
2.53.0

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to