]> git.baikalelectronics.ru Git - kernel.git/commit
gfs2: dequeue iopen holder in gfs2_inode_lookup error
authorBob Peterson <rpeterso@redhat.com>
Wed, 29 Sep 2021 19:42:38 +0000 (14:42 -0500)
committerAndreas Gruenbacher <agruenba@redhat.com>
Mon, 25 Oct 2021 06:42:18 +0000 (08:42 +0200)
commitfee0b67796e04632bedf3fecb7c186a30d31c90b
tree7017ace19fd27b509eef5e9700059dabb79a5f4b
parente979bab26a83677426f97a70c901ca9c138be62d
gfs2: dequeue iopen holder in gfs2_inode_lookup error

Before this patch, if function gfs2_inode_lookup encountered an error
after it had locked the iopen glock, it never unlocked it, relying on
the evict code to do the cleanup.  The evict code then took the
inode glock while holding the iopen glock, which violates the locking
order.  For example,

 (1) node A does a gfs2_inode_lookup that fails, leaving the iopen glock
     locked.

 (2) node B calls delete_work_func -> gfs2_lookup_by_inum ->
     gfs2_inode_lookup.  It locks the inode glock and blocks trying to
     lock the iopen glock, which is held by node A.

 (3) node A eventually calls gfs2_evict_inode -> evict_should_delete.
     It blocks trying to lock the inode glock, which is now held by
     node B.

This patch introduces error handling to function gfs2_inode_lookup
so it properly dequeues held iopen glocks on errors.

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