diff mbox series

[5/8] xfs_repair: clean up lock resources

Message ID 171338845855.1856674.16300821271746079157.stgit@frogsfrogsfrogs (mailing list archive)
State Accepted
Headers show
Series [1/8] xfs_db: add a bmbt inflation command | expand

Commit Message

Darrick J. Wong April 17, 2024, 9:45 p.m. UTC
From: Darrick J. Wong <djwong@djwong.org>

When we free all the incore block mapping data, be sure to free the
locks too.

Signed-off-by: Darrick J. Wong <djwong@djwong.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 repair/incore.c |    9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/repair/incore.c b/repair/incore.c
index 2ed37a105..06edaf0d6 100644
--- a/repair/incore.c
+++ b/repair/incore.c
@@ -301,8 +301,17 @@  free_bmaps(xfs_mount_t *mp)
 {
 	xfs_agnumber_t i;
 
+	pthread_mutex_destroy(&rt_lock.lock);
+
+	for (i = 0; i < mp->m_sb.sb_agcount; i++)
+		pthread_mutex_destroy(&ag_locks[i].lock);
+
+	free(ag_locks);
+	ag_locks = NULL;
+
 	for (i = 0; i < mp->m_sb.sb_agcount; i++)
 		btree_destroy(ag_bmap[i]);
+
 	free(ag_bmap);
 	ag_bmap = NULL;