Skip to content

Commit ead188f

Browse files
jankaraFengguang Wu
authored and
Fengguang Wu
committed
writeback: Fix lock imbalance in writeback_sb_inodes()
Fix bug introduced by 169ebd9. We have to have wb_list_lock locked when restarting writeback loop after having waited for inode writeback. Bug description by Ted Tso: I can reproduce this fairly easily by using ext4 w/o a journal, running under KVM with 1024megs memory, with fsstress (xfstests #13): [ 45.153294] ===================================== [ 45.154784] [ BUG: bad unlock balance detected! ] [ 45.155591] 3.5.0-rc1-00002-gb22b1f1 #124 Not tainted [ 45.155591] ------------------------------------- [ 45.155591] flush-254:16/2499 is trying to release lock (&(&wb->list_lock)->rlock) at: [ 45.155591] [<c022c3da>] writeback_sb_inodes+0x160/0x327 [ 45.155591] but there are no more locks to release! Reported-by: Theodore Ts'o <[email protected]> Tested-by: Theodore Ts'o <[email protected]> Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Fengguang Wu <[email protected]>
1 parent f8f5701 commit ead188f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/fs-writeback.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ static long writeback_sb_inodes(struct super_block *sb,
664664
/* Wait for I_SYNC. This function drops i_lock... */
665665
inode_sleep_on_writeback(inode);
666666
/* Inode may be gone, start again */
667+
spin_lock(&wb->list_lock);
667668
continue;
668669
}
669670
inode->i_state |= I_SYNC;

0 commit comments

Comments
 (0)