[GFS2] Fix a page lock / glock deadlock
authorSteven Whitehouse <swhiteho@redhat.com>
Fri, 22 Feb 2008 16:07:18 +0000 (16:07 +0000)
committerSteven Whitehouse <swhiteho@redhat.com>
Mon, 31 Mar 2008 09:41:12 +0000 (10:41 +0100)
commit7afd88d9166a752b52517648bcbe923e05d393fc
tree2fb945189e3cb1be7ad007088f8ec86e9f67ece6
parent60b779cfc1fa52034a996ee12a23b62d32e86000
[GFS2] Fix a page lock / glock deadlock

We've previously been using a "try lock" in readpage on the basis that
it would prevent deadlocks due to the inverted lock ordering (our normal
lock ordering is glock first and then page lock). Unfortunately tests
have shown that this isn't enough. If the glock has a demote request
queued such that run_queue() in the glock code tries to do a demote when
its called under readpage then it will try and write out all the dirty
pages which requires locking them. This then deadlocks with the page
locked by readpage.

The solution is to always require two calls into readpage. The first
unlocks the page, gets the glock and returns AOP_TRUNCATED_PAGE, the
second does the actual readpage and unlocks the glock & page as
required.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/glock.h
fs/gfs2/inode.c
fs/gfs2/ops_address.c
fs/gfs2/ops_dentry.c
fs/gfs2/ops_inode.c