]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
gfs2: Fix deadlock dumping resource group glocks
authorAlexander Aring <aahringo@redhat.com>
Sun, 22 Nov 2020 23:10:24 +0000 (18:10 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Dec 2020 12:22:12 +0000 (13:22 +0100)
commitc0c5b2ebdf28fc91952ad70e60e15ce83278139e
tree4b0e64c96398dfae3a1581529e089cc2dd4dd25d
parent17c8d31778f52f98d648fcfef685df0b6115dd4f
gfs2: Fix deadlock dumping resource group glocks

commit 16e6281b6b22b0178eab95c6a82502d7b10f67b8 upstream.

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>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/gfs2/glops.c