• Andreas Gruenbacher's avatar
    gfs2: gfs2_evict_inode: Put glocks asynchronously · 71c1b213
    Andreas Gruenbacher authored
    gfs2_evict_inode is called to free inodes under memory pressure.  The
    function calls into DLM when an inode's last cluster-wide reference goes
    away (remote unlink) and to release the glock and associated DLM lock
    before finally destroying the inode.  However, if DLM is blocked on
    memory to become available, calling into DLM again will deadlock.
    Avoid that by decoupling releasing glocks from destroying inodes in that
    case: with gfs2_glock_queue_put, glocks will be dequeued asynchronously
    in work queue context, when the associated inodes have likely already
    been destroyed.
    With this change, inodes can end up being unlinked, remote-unlink can be
    triggered, and then the inode can be reallocated before all
    remote-unlink callbacks are processed.  To detect that, revalidate the
    link count in gfs2_evict_inode to make sure we're not deleting an
    allocated, referenced inode.
    Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
    Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>