gfs2: fix withdraw sequence deadlock
authorBob Peterson <rpeterso@redhat.com>
Wed, 22 Apr 2020 19:14:30 +0000 (14:14 -0500)
committerAndreas Gruenbacher <agruenba@redhat.com>
Wed, 6 May 2020 19:25:26 +0000 (21:25 +0200)
commitac9155842829a811c12d3e1868a133fdb8300df0
treef654df998850da2390db3900214cc670a114b24f
parent8f3d9f354286745c751374f5f1fcafee6b3f3136
gfs2: fix withdraw sequence deadlock

After a gfs2 file system withdraw, any attempt to read metadata is
automatically rejected by function gfs2_meta_read() except for reads
of the journal inode. This turns out to be a problem because function
signal_our_withdraw() repeatedly calls check_journal_clean() which reads
the metadata (both its dinode and indirect blocks) to see if the entire
journal is mapped. The dinode read works, but reading the indirect blocks
returns -EIO which gets sent back up and causes a consistency error.
This results in withdraw-from-withdraw, which becomes a deadlock.

This patch changes the test in gfs2_meta_read() to allow all metadata
reads for the journal. Instead of checking the journal block, it now
checks for the journal inode glock which is the same for all blocks in
the journal. This allows check_journal_clean() to properly check the
journal without trying to withdraw recursively.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/meta_io.c