mirror of https://gitee.com/openkylin/linux.git
Btrfs: fix autodefrag and umount lockup
This happens because writeback_inodes_sb_nr_if_idle does down_read. This doesn't work for us and it has not been fixed upstream yet, so do it ourselves and use that instead so we can stop having this stupid long standing lockup. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
parent
9185aa587b
commit
1135d6df22
|
@ -3689,6 +3689,20 @@ static int can_overcommit(struct btrfs_root *root,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int writeback_inodes_sb_nr_if_idle_safe(struct super_block *sb,
|
||||||
|
unsigned long nr_pages,
|
||||||
|
enum wb_reason reason)
|
||||||
|
{
|
||||||
|
if (!writeback_in_progress(sb->s_bdi) &&
|
||||||
|
down_read_trylock(&sb->s_umount)) {
|
||||||
|
writeback_inodes_sb_nr(sb, nr_pages, reason);
|
||||||
|
up_read(&sb->s_umount);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* shrink metadata reservation for delalloc
|
* shrink metadata reservation for delalloc
|
||||||
*/
|
*/
|
||||||
|
@ -3721,8 +3735,9 @@ static void shrink_delalloc(struct btrfs_root *root, u64 to_reclaim, u64 orig,
|
||||||
while (delalloc_bytes && loops < 3) {
|
while (delalloc_bytes && loops < 3) {
|
||||||
max_reclaim = min(delalloc_bytes, to_reclaim);
|
max_reclaim = min(delalloc_bytes, to_reclaim);
|
||||||
nr_pages = max_reclaim >> PAGE_CACHE_SHIFT;
|
nr_pages = max_reclaim >> PAGE_CACHE_SHIFT;
|
||||||
writeback_inodes_sb_nr_if_idle(root->fs_info->sb, nr_pages,
|
writeback_inodes_sb_nr_if_idle_safe(root->fs_info->sb,
|
||||||
WB_REASON_FS_FREE_SPACE);
|
nr_pages,
|
||||||
|
WB_REASON_FS_FREE_SPACE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need to wait for the async pages to actually start before
|
* We need to wait for the async pages to actually start before
|
||||||
|
|
Loading…
Reference in New Issue