Btrfs: fix repeated delalloc work allocation
authorMiao Xie <miaox@cn.fujitsu.com>
Tue, 22 Jan 2013 10:49:00 +0000 (10:49 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Thu, 24 Jan 2013 17:51:27 +0000 (12:51 -0500)
commit1eafa6c73791e4f312324ddad9cbcaf6a1b6052b
tree59ffd2a324039af64354fbaaaa116c9366acba6f
parentc9f01bfe0ca411b4751d7fdbb9d602035ba52f75
Btrfs: fix repeated delalloc work allocation

btrfs_start_delalloc_inodes() locks the delalloc_inodes list, fetches the
first inode, unlocks the list, triggers btrfs_alloc_delalloc_work/
btrfs_queue_worker for this inode, and then it locks the list, checks the
head of the list again. But because we don't delete the first inode that it
deals with before, it will fetch the same inode. As a result, this function
allocates a huge amount of btrfs_delalloc_work structures, and OOM happens.

Fix this problem by splice this delalloc list.

Reported-by: Alex Lyakas <alex.btrfs@zadarastorage.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/inode.c