Skip to content
  • Jeff Mahoney's avatar
    reiserfs: fix deadlocks with quotas · 48d17884
    Jeff Mahoney authored
    
    
    The BKL push-down for reiserfs made lock recursion a special case that needs
    to be handled explicitly. One of the cases that was unhandled is dropping
    the quota during inode eviction. Both reiserfs_evict_inode and
    reiserfs_write_dquot take the write lock, but when the journal lock is
    taken it only drops one the references. The locking rules are that the journal
    lock be acquired before the write lock so leaving the reference open leads
    to a ABBA deadlock.
    
    This patch pushes the unlock up before clear_inode and avoids the recursive
    locking.
    
    Another ABBA situation can occur when the write lock is dropped while reading
    the bitmap buffer while in the quota code. When the lock is reacquired, it
    will deadlock against dquot->dq_lock and dqopt->dqio_mutex in the dquot_acquire
    path. It's safe to retain the lock across the read and should be cached under
    write load.
    
    Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    48d17884