From 90388d46b08ac8dd2c179f63f8739b4ac514d926 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 13 Oct 2026 13:57:55 +0200 Subject: [PATCH] xfs: handle NULL open_zone for merged ioends in xfs_end_ioend_write_zoned The NULL checks on the merged ioends added in commit ae285611891f ("xfs: handle NULL open_zone for merged ioends in xfs_ioend_put_open_zones") got lost when the code was moved to a new file. Reinstate the check, and also update the comments to be a little more coherent. Fixes: 6b855256eb9e ("xfs: split ioend handling into a separate source file") Signed-off-by: Christoph Hellwig Reviewed-by: Carlos Maiolino Signed-off-by: Carlos Maiolino --- fs/xfs/xfs_ioend.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/xfs/xfs_ioend.c b/fs/xfs/xfs_ioend.c index f0e01ac34de8..48becc3bf608 100644 --- a/fs/xfs/xfs_ioend.c +++ b/fs/xfs/xfs_ioend.c @@ -182,15 +182,15 @@ xfs_end_ioend_write_zoned( error = xfs_setfilesize(ip, ioend->io_offset, ioend->io_size); done: /* - * Put the open zone for all ioends merged into this one (if any). - */ - list_for_each_entry(tmp, &ioend->io_list, io_list) - xfs_open_zone_put(tmp->io_private); - - /* - * The main ioend might not have an open zone if the submission failed - * before xfs_zone_alloc_and_submit got called. + * Put the open zone references for all ioends merged into this one in + * addition to the main one they were merged into. If the submission + * failed before xfs_zone_alloc_and_submit got called, there is no open + * zone and at least in theory that could also happen for merged ioends. */ + list_for_each_entry(tmp, &ioend->io_list, io_list) { + if (tmp->io_private) + xfs_open_zone_put(tmp->io_private); + } if (oz) xfs_open_zone_put(oz); iomap_finish_ioends(ioend, error);