[Cluster-devel] [GFS2 PATCH 0/7] Fix glock deadlocks with deleted inodes

Bob Peterson rpeterso at redhat.com
Tue May 24 19:12:32 UTC 2016


I'm sending this to linux-fsdevel because one of the patches affects vfs.

GFS2 has a long-standing deadlock related to the transition of dinodes from
the Unlinked state to the Deleted state. The problem is that function
delete_work_func in glock.c called gfs2_lookup_by_inum, which locks the
inode glock before performing the rest of its checks, which means the lock
order is different from the normal lookups.

My original idea was to make delete_work_func call the normal lookup
function, and do away with the non-blocking lookups so they had the same
lock order. But we decided that was a bad idea. So the first two patches
revert the changes I had made earlier toward that end. The next five
patches implement a new design by Andreas Gruenbacher, which allows for
more flexibility in waiting for freeing inodes.

These missed transitions from unlinked to free also had another side-effect:
It often failed to acquire the lock and gave up, which meant that slowly
over time, the "df" value would get out of sync with "du." So it appeared
that the file system was more full than it was. (These unlinked dinodes
should, in theory, be reclaimed automatically, but they still threw the
numbers off, because the "unlinked" dinodes were not considered free space.)

This patch set has undergone rigorous testing that reliably recreated the
deadlock. Normally, the deadlock appeared in about an hour or two of
testing. With these patches, it's been running for weeks without a problem.

Signed-off-by: Bob Peterson <rpeterso at redhat.com>
---
Andreas Gruenbacher (5):
  GFS2: Remove superfluous assignment
  GFS2: No need for non-blocking gfs2_ilookup in delete_work_func
  vfs: Introduce prepare_wait_on_freeing_inode
  GFS2: Use non-blocking wait in gfs2_iget
  GFS2: Prevent deadlock in gfs2_lookup_by_inum

Bob Peterson (2):
  Revert "GFS2: Eliminate parameter non_block on gfs2_inode_lookup"
  Revert "GFS2: Don't filter out I_FREEING inodes anymore"

 fs/gfs2/dir.c        |   2 +-
 fs/gfs2/glock.c      |   4 +-
 fs/gfs2/inode.c      | 109 ++++++++++++++++++++++++++++++++++++++++++++++-----
 fs/gfs2/inode.h      |   8 +++-
 fs/gfs2/ops_fstype.c |   2 +-
 fs/inode.c           |  18 +++++++--
 include/linux/fs.h   |   1 +
 include/linux/wait.h |  21 +++++++---
 8 files changed, 142 insertions(+), 23 deletions(-)

-- 
2.5.5




More information about the Cluster-devel mailing list