diff options
author | Jeff Mahoney <jeffm@suse.com> | 2012-08-02 21:36:04 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2012-08-15 00:22:57 +0200 |
commit | 48d1788493f874e5d32dccb2911a7bc91c248b4b (patch) | |
tree | c03aa75bc4143380e177555fb32acff6126ff782 /fs/reiserfs/bitmap.c | |
parent | 6ea2eea1fa930b9308a06f77fce65c38931eeb13 (diff) | |
download | linux-stable-48d1788493f874e5d32dccb2911a7bc91c248b4b.tar.gz linux-stable-48d1788493f874e5d32dccb2911a7bc91c248b4b.tar.bz2 linux-stable-48d1788493f874e5d32dccb2911a7bc91c248b4b.zip |
reiserfs: fix deadlocks with quotas
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: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/reiserfs/bitmap.c')
-rw-r--r-- | fs/reiserfs/bitmap.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c index 4c0c7d163d15..a98b7740a0fc 100644 --- a/fs/reiserfs/bitmap.c +++ b/fs/reiserfs/bitmap.c @@ -1334,9 +1334,7 @@ struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb, else if (bitmap == 0) block = (REISERFS_DISK_OFFSET_IN_BYTES >> sb->s_blocksize_bits) + 1; - reiserfs_write_unlock(sb); bh = sb_bread(sb, block); - reiserfs_write_lock(sb); if (bh == NULL) reiserfs_warning(sb, "sh-2029: %s: bitmap block (#%u) " "reading failed", __func__, block); |