add patch mballoc-avoid-20-argument-function-call
[ext4-patch-queue.git] / BUG_ON-assertion-repeated-for-inode1-not-done-for-inode2
blob151efc267c2412d995054ecd1d262cab70889173
1 ext4: BUG_ON assertion repeated for inode1, not done for inode2
3 From: David Moore <dmoorefo@gmail.com>
5 During a source code review of fs/ext4/extents.c I noted identical
6 consecutive lines. An assertion is repeated for inode1 and never done
7 for inode2. This is not in keeping with the rest of the code in the
8 ext4_swap_extents function and appears to be a bug.
10 Assert that the inode2 mutex is not locked.
12 Signed-off-by: David Moore <dmoorefo@gmail.com>
13 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
14 Reviewed-by: Eric Sandeen <sandeen@redhat.com>
15 ---
16  fs/ext4/extents.c | 2 +-
17  1 file changed, 1 insertion(+), 1 deletion(-)
19 diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
20 index e003a1e..f38a6d6 100644
21 --- a/fs/ext4/extents.c
22 +++ b/fs/ext4/extents.c
23 @@ -5542,7 +5542,7 @@ ext4_swap_extents(handle_t *handle, struct inode *inode1,
24         BUG_ON(!rwsem_is_locked(&EXT4_I(inode1)->i_data_sem));
25         BUG_ON(!rwsem_is_locked(&EXT4_I(inode2)->i_data_sem));
26         BUG_ON(!mutex_is_locked(&inode1->i_mutex));
27 -       BUG_ON(!mutex_is_locked(&inode1->i_mutex));
28 +       BUG_ON(!mutex_is_locked(&inode2->i_mutex));
30         *erp = ext4_es_remove_extent(inode1, lblk1, count);
31         if (unlikely(*erp))