Skip to contentSkip to conversation

xfs: handle NULL open_zone for merged ioends in xfs_end_ioend_write_zoned

PATCH Applied Christoph Hellwig 2 participants 3 messages Oct 13 – Oct 14 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 fs/xfs/xfs_ioend.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
fs/xfs/xfs_ioend.c +8 -8
index f0e01ac34de8..26b996a52d8b 100644
@@ -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 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);
Signature · 1 line
2.53.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 29 lines · Christoph Hellwig

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")
---
 fs/xfs/xfs_ioend.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
fs/xfs/xfs_ioend.c +2 -8
index f0e01ac34de8..26b996a52d8b 100644
@@ -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

fs/xfs/xfs_ioend.c xfs_end_ioend_write_zoned( · line 196

Quoted 10 lines
fs/xfs/xfs_ioend.c +6 -0
+	 * failed before xfs_zone_alloc_and_submit got called, there is 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);
Quoted 4 lines
Signature · 1 line
2.53.0
maintainer Applied
#2 lore raw
In reply to Christoph Hellwig
Quoted 6 lines · Christoph Hellwig

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.

Applied to for-next, thanks!

[1/1] xfs: handle NULL open_zone for merged ioends in xfs_end_ioend_write_zoned

      commit: 90388d46b08ac8dd2c179f63f8739b4ac514d926

Best regards,

Signature · 1 line
Carlos Maiolino <[email protected]>