All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs: Fix bug in gfs2_freeze_func that can cause deadlock
@ 2023-06-20  3:38 ` Li Dong
  0 siblings, 0 replies; 4+ messages in thread
From: Li Dong @ 2023-06-20  3:38 UTC (permalink / raw)
  To: Bob Peterson, Andreas Gruenbacher, open list:GFS2 FILE SYSTEM, open list
  Cc: opensource.kernel, lidong

Function gfs2_freeze_func causes a deadlock,because sd_freeze_mutex was
not released when return

Signed-off-by: Li Dong <lidong@vivo.com>
---
 fs/gfs2/super.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -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);
 
-- 
2.31.1.windows.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Cluster-devel] [PATCH] fs: Fix bug in gfs2_freeze_func that can cause deadlock
@ 2023-06-20  3:38 ` Li Dong
  0 siblings, 0 replies; 4+ messages in thread
From: Li Dong @ 2023-06-20  3:38 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Function gfs2_freeze_func causes a deadlock?because sd_freeze_mutex was
not released when return

Signed-off-by: Li Dong <lidong@vivo.com>
---
 fs/gfs2/super.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -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);
 
-- 
2.31.1.windows.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fs: Fix bug in gfs2_freeze_func that can cause deadlock
  2023-06-20  3:38 ` [Cluster-devel] " Li Dong
@ 2023-07-03 20:31   ` Andreas Gruenbacher
  -1 siblings, 0 replies; 4+ messages in thread
From: Andreas Gruenbacher @ 2023-07-03 20:31 UTC (permalink / raw)
  To: Li Dong
  Cc: Bob Peterson, open list:GFS2 FILE SYSTEM, open list, opensource.kernel

Li Dong,

On Tue, Jun 20, 2023 at 5:47 AM Li Dong <lidong@vivo.com> wrote:
> Function gfs2_freeze_func causes a deadlock,because sd_freeze_mutex was
> not released when return
>
> Signed-off-by: Li Dong <lidong@vivo.com>
> ---
>  fs/gfs2/super.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
> --- a/fs/gfs2/super.c
> +++ b/fs/gfs2/super.c
> @@ -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

>         clear_bit(SDF_FROZEN, &sdp->sd_flags);
>
> --
> 2.31.1.windows.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Cluster-devel] [PATCH] fs: Fix bug in gfs2_freeze_func that can cause deadlock
@ 2023-07-03 20:31   ` Andreas Gruenbacher
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Gruenbacher @ 2023-07-03 20:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Li Dong,

On Tue, Jun 20, 2023 at 5:47?AM Li Dong <lidong@vivo.com> wrote:
> Function gfs2_freeze_func causes a deadlock?because sd_freeze_mutex was
> not released when return
>
> Signed-off-by: Li Dong <lidong@vivo.com>
> ---
>  fs/gfs2/super.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
> --- a/fs/gfs2/super.c
> +++ b/fs/gfs2/super.c
> @@ -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

>         clear_bit(SDF_FROZEN, &sdp->sd_flags);
>
> --
> 2.31.1.windows.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-03 20:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-20  3:38 [PATCH] fs: Fix bug in gfs2_freeze_func that can cause deadlock Li Dong
2023-06-20  3:38 ` [Cluster-devel] " Li Dong
2023-07-03 20:31 ` Andreas Gruenbacher
2023-07-03 20:31   ` [Cluster-devel] " Andreas Gruenbacher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.