Skip to contentSkip to conversation

gfs2: Wait for gfs2_qd_dealloc() before freeing sbd

PATCH New Andrew Price 1 participant 1 message Jul 24, 2025 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gfs2: Wait for gfs2_qd_dealloc() before freeing sbd

gfs2_qd_dealloc() is called asynchronously with call_rcu() in gfs2_qd_dispose(). It uses the sbd so it can race with the sbd being freed on unmount. Add an rcu_barrier() to free_sbd() to make sure it completes before the sbd is freed.

---
 fs/gfs2/ops_fstype.c | 2 ++
 1 file changed, 2 insertions(+)
fs/gfs2/ops_fstype.c +2 -0
index 85c491fcf1a36..0385807d79ab6 100644
@@ -66,6 +66,8 @@ void free_sbd(struct gfs2_sbd *sdp)
 {
 	struct super_block *sb = sdp->sd_vfs;
 
+	/* Wait for rcu_call(gfs2_qd_dealloc) */
+	rcu_barrier();
 	free_percpu(sdp->sd_lkstats);
 	sb->s_fs_info = NULL;
 	kfree(sdp);
Signature · 1 line
2.50.1