[PATCH 1/5] xfs: handle NULL open_zone for merged ioends in xfs_ioend_put_open_zones
Christoph Hellwig <[email protected]>
| Newsgroups | org.kernel.vger.linux-xfs |
|---|---|
| Message-ID | <[email protected]> |
In theory we could fail multiple ioends before an open zoned was assigned
to them, and the iomap code could merge them. Check for NULL not only
for the main ioend but also all merged ones on ->io_list to handle this
case.
Fixes: 058dd70c65ab ("xfs: implement buffered writes to zoned RT devices")
Signed-off-by: Christoph Hellwig <[email protected]>
---
fs/xfs/xfs_aops.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 2a0c54256e93..c80f05507373 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -89,8 +89,10 @@ xfs_ioend_put_open_zones(
/*
* 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);
+ list_for_each_entry(tmp, &ioend->io_list, io_list) {
+ if (tmp->io_private)
+ xfs_open_zone_put(tmp->io_private);
+ }
/*
* The main ioend might not have an open zone if the submission failed
--
2.53.0