Skip to content

Commit f56f73e

Browse files
Darrick J. Wongcmaiolino
authored andcommitted
xfs: don't wake zone space waiters without m_zone_info
xfs_zoned_wake_all checks SB_ACTIVE to make sure it does the right thing when a shutdown happens during unmount, but it fails to account for the log recovery special case that sets SB_ACTIVE temporarily. Add a NULL check to cover both cases. Signed-off-by: Darrick J. Wong <[email protected]> [hch: added a commit log and comment] Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Carlos Maiolino <[email protected]> Reviewed-by: Hans Holmberg <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]>
1 parent 9ec3f79 commit f56f73e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

fs/xfs/xfs_zone_alloc.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -853,13 +853,22 @@ xfs_zone_alloc_and_submit(
853853
bio_io_error(&ioend->io_bio);
854854
}
855855

856+
/*
857+
* Wake up all threads waiting for a zoned space allocation when the file system
858+
* is shut down.
859+
*/
856860
void
857861
xfs_zoned_wake_all(
858862
struct xfs_mount *mp)
859863
{
860-
if (!(mp->m_super->s_flags & SB_ACTIVE))
861-
return; /* can happen during log recovery */
862-
wake_up_all(&mp->m_zone_info->zi_zone_wait);
864+
/*
865+
* Don't wake up if there is no m_zone_info. This is complicated by the
866+
* fact that unmount can't atomically clear m_zone_info and thus we need
867+
* to check SB_ACTIVE for that, but mount temporarily enables SB_ACTIVE
868+
* during log recovery so we can't entirely rely on that either.
869+
*/
870+
if ((mp->m_super->s_flags & SB_ACTIVE) && mp->m_zone_info)
871+
wake_up_all(&mp->m_zone_info->zi_zone_wait);
863872
}
864873

865874
/*

0 commit comments

Comments
 (0)