fs: Fix bug in gfs2_freeze_func that can cause deadlock
PATCH 1/1 fs: Fix bug in gfs2_freeze_func that can cause deadlock
Function gfs2_freeze_func causes a deadlock?because sd_freeze_mutex was not released when return
Signed-off-by Li Dong <[email protected]>
--- fs/gfs2/super.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/gfs2/super.c +3 -1
@@ -741,8 +741,10 @@ void gfs2_freeze_func(struct work_struct *work)set_bit (SDF_FROZEN , &sdp->sd_flags); error =gfs2_do_thaw (sdp); -if (error) +if (error) { +mutex_unlock (&sdp->sd_freeze_mutex); goto out; + }clear_bit (SDF_FROZEN , &sdp->sd_flags);
Signature · 1 line
2.31.1.windows.1
Andreas Gruenbacher
maintainerLi Dong,
Quoted 12 lines · On Tue, Jun 20, 2023 at 5:47?AM Li Dong <[email protected]> wrote:
Function
gfs2_freeze_funccauses a deadlock?becausesd_freeze_mutexwas not released when returnSigned-off-by Li Dong <[email protected]>--- fs/gfs2/super.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/gfs2/super.c void gfs2_freeze_func(struct work_struct *work) · line 747
Quoted 8 lines
fs/gfs2/super.c +3
-1@@ -741,8 +741,10 @@ void gfs2_freeze_func(struct work_struct *work)set_bit (SDF_FROZEN , &sdp->sd_flags); error =gfs2_do_thaw (sdp); -if (error) +if (error) { +mutex_unlock (&sdp->sd_freeze_mutex); goto out; + }
thank you for this bug report. I have chosen to fold this fix into commit "gfs2: Rework freeze / thaw logic" and clean up gfs2_freeze_func() a little along the way; see the current for-next branch.
Thanks,
Andreas
Quoted 4 lines
fs/gfs2/super.c +0
-1clear_bit (SDF_FROZEN , &sdp->sd_flags); --2.31.1.windows.1