* [Cluster-devel] [PATCH gfs2/for-next] gfs2: Fix deadlock dumping resource group glocks
@ 2020-11-22 23:10 Alexander Aring
2020-11-23 15:30 ` Andreas Gruenbacher
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Aring @ 2020-11-22 23:10 UTC (permalink / raw)
To: cluster-devel.redhat.com
Commit 0e539ca1bbbe ("gfs2: Fix NULL pointer dereference in gfs2_rgrp_dump")
introduced additional locking in gfs2_rgrp_go_dump, which is also used for
dumping resource group glocks via debugfs. However, on that code path, the
glock spin lock is already taken in dump_glock, and taking it again in
gfs2_glock2rgrp leads to deadlock. This can be reproduced with:
$ mkfs.gfs2 -O -p lock_nolock /dev/FOO
$ mount /dev/FOO /mnt/foo
$ touch /mnt/foo/bar
$ cat /sys/kernel/debug/gfs2/FOO/glocks
Fix that by not taking the glock spin lock inside the go_dump callback.
Fixes: 0e539ca1bbbe ("gfs2: Fix NULL pointer dereference in gfs2_rgrp_dump")
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
fs/gfs2/glops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 67f2921ae8d4..6cedeefb7b3f 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -245,7 +245,7 @@ static void rgrp_go_inval(struct gfs2_glock *gl, int flags)
static void gfs2_rgrp_go_dump(struct seq_file *seq, struct gfs2_glock *gl,
const char *fs_id_buf)
{
- struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl);
+ struct gfs2_rgrpd *rgd = gl->gl_object;
if (rgd)
gfs2_rgrp_dump(seq, rgd, fs_id_buf);
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Cluster-devel] [PATCH gfs2/for-next] gfs2: Fix deadlock dumping resource group glocks
2020-11-22 23:10 [Cluster-devel] [PATCH gfs2/for-next] gfs2: Fix deadlock dumping resource group glocks Alexander Aring
@ 2020-11-23 15:30 ` Andreas Gruenbacher
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Gruenbacher @ 2020-11-23 15:30 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Mon, Nov 23, 2020 at 12:10 AM Alexander Aring <aahringo@redhat.com> wrote:
> Commit 0e539ca1bbbe ("gfs2: Fix NULL pointer dereference in gfs2_rgrp_dump")
> introduced additional locking in gfs2_rgrp_go_dump, which is also used for
> dumping resource group glocks via debugfs. However, on that code path, the
> glock spin lock is already taken in dump_glock, and taking it again in
> gfs2_glock2rgrp leads to deadlock. This can be reproduced with:
>
> $ mkfs.gfs2 -O -p lock_nolock /dev/FOO
> $ mount /dev/FOO /mnt/foo
> $ touch /mnt/foo/bar
> $ cat /sys/kernel/debug/gfs2/FOO/glocks
>
> Fix that by not taking the glock spin lock inside the go_dump callback.
>
> Fixes: 0e539ca1bbbe ("gfs2: Fix NULL pointer dereference in gfs2_rgrp_dump")
> Signed-off-by: Alexander Aring <aahringo@redhat.com>
> ---
> fs/gfs2/glops.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
> index 67f2921ae8d4..6cedeefb7b3f 100644
> --- a/fs/gfs2/glops.c
> +++ b/fs/gfs2/glops.c
> @@ -245,7 +245,7 @@ static void rgrp_go_inval(struct gfs2_glock *gl, int flags)
> static void gfs2_rgrp_go_dump(struct seq_file *seq, struct gfs2_glock *gl,
> const char *fs_id_buf)
> {
> - struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl);
> + struct gfs2_rgrpd *rgd = gl->gl_object;
>
> if (rgd)
> gfs2_rgrp_dump(seq, rgd, fs_id_buf);
> --
> 2.26.2
>
Thanks. I've added this to for-next for now, but I'll try to push this
to Linus before the 5.10 release.
Andreas
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-23 15:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-22 23:10 [Cluster-devel] [PATCH gfs2/for-next] gfs2: Fix deadlock dumping resource group glocks Alexander Aring
2020-11-23 15:30 ` Andreas Gruenbacher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).