mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
Btrfs: fix possible empty list access when flushing the delalloc inodes
We didn't have a lock to protect the access to the delalloc inodes list, that is we might access a empty delalloc inodes list if someone start flushing delalloc inodes because the delalloc inodes were moved into a other list temporarily. Fix it by wrapping the access with a lock. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Josef Bacik <jbacik@fb.com>
This commit is contained in:
parent
31f3d255c6
commit
573bfb72f7
3 changed files with 8 additions and 0 deletions
|
@ -1221,6 +1221,7 @@ static void __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
|
|||
mutex_init(&root->objectid_mutex);
|
||||
mutex_init(&root->log_mutex);
|
||||
mutex_init(&root->ordered_extent_mutex);
|
||||
mutex_init(&root->delalloc_mutex);
|
||||
init_waitqueue_head(&root->log_writer_wait);
|
||||
init_waitqueue_head(&root->log_commit_wait[0]);
|
||||
init_waitqueue_head(&root->log_commit_wait[1]);
|
||||
|
@ -2209,6 +2210,7 @@ int open_ctree(struct super_block *sb,
|
|||
spin_lock_init(&fs_info->buffer_lock);
|
||||
rwlock_init(&fs_info->tree_mod_log_lock);
|
||||
mutex_init(&fs_info->reloc_mutex);
|
||||
mutex_init(&fs_info->delalloc_root_mutex);
|
||||
seqlock_init(&fs_info->profiles_lock);
|
||||
|
||||
init_completion(&fs_info->kobj_unregister);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue