xfs: don't try to get a reference to a NULL oz in xfs_get_cached_zone

oz can be NULL when we resample it after taking i_flags_lock, so account
for that.

Fixes: 2d829cc767 ("xfs: fix racy open zone caching")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
Christoph Hellwig 2026-09-14 13:35:38 +02:00 committed by Carlos Maiolino
parent e9193f2f1c
commit 14e379600d

View File

@ -820,7 +820,7 @@ xfs_get_cached_zone(
spin_unlock(&ip->i_flags_lock);
}
if (!atomic_inc_not_zero(&oz->oz_ref))
if (oz && !atomic_inc_not_zero(&oz->oz_ref))
oz = NULL;
out_unlock:
rcu_read_unlock();