1 |
From 16e6281b6b22b0178eab95c6a82502d7b10f67b8 Mon Sep 17 00:00:00 2001 |
2 |
From: Alexander Aring <aahringo@redhat.com> |
3 |
Date: Sun, 22 Nov 2020 18:10:24 -0500 |
4 |
Subject: [PATCH 108/150] gfs2: Fix deadlock dumping resource group glocks |
5 |
|
6 |
Commit 0e539ca1bbbe ("gfs2: Fix NULL pointer dereference in gfs2_rgrp_dump") |
7 |
introduced additional locking in gfs2_rgrp_go_dump, which is also used for |
8 |
dumping resource group glocks via debugfs. However, on that code path, the |
9 |
glock spin lock is already taken in dump_glock, and taking it again in |
10 |
gfs2_glock2rgrp leads to deadlock. This can be reproduced with: |
11 |
|
12 |
$ mkfs.gfs2 -O -p lock_nolock /dev/FOO |
13 |
$ mount /dev/FOO /mnt/foo |
14 |
$ touch /mnt/foo/bar |
15 |
$ cat /sys/kernel/debug/gfs2/FOO/glocks |
16 |
|
17 |
Fix that by not taking the glock spin lock inside the go_dump callback. |
18 |
|
19 |
Fixes: 0e539ca1bbbe ("gfs2: Fix NULL pointer dereference in gfs2_rgrp_dump") |
20 |
Signed-off-by: Alexander Aring <aahringo@redhat.com> |
21 |
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> |
22 |
--- |
23 |
fs/gfs2/glops.c | 2 +- |
24 |
1 file changed, 1 insertion(+), 1 deletion(-) |
25 |
|
26 |
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c |
27 |
index 67f2921ae8d4..6cedeefb7b3f 100644 |
28 |
--- a/fs/gfs2/glops.c |
29 |
+++ b/fs/gfs2/glops.c |
30 |
@@ -245,7 +245,7 @@ static void rgrp_go_inval(struct gfs2_glock *gl, int flags) |
31 |
static void gfs2_rgrp_go_dump(struct seq_file *seq, struct gfs2_glock *gl, |
32 |
const char *fs_id_buf) |
33 |
{ |
34 |
- struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl); |
35 |
+ struct gfs2_rgrpd *rgd = gl->gl_object; |
36 |
|
37 |
if (rgd) |
38 |
gfs2_rgrp_dump(seq, rgd, fs_id_buf); |
39 |
-- |
40 |
2.29.2 |
41 |
|