Commit c4e00f1d31c4c83d15162782491689229bd92527
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs fixes from Chris Mason: "We have a few fixes in my for-linus branch. Qu Wenruo's batch fix a regression between some our merge window pull and the inode_cache feature. The rest are smaller bugs" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: btrfs: Don't call btrfs_start_transaction() on frozen fs to avoid deadlock. btrfs: Fix the bug that fs_info->pending_changes is never cleared. btrfs: fix state->private cast on 32 bit machines Btrfs: fix race deleting block group from space_info->ro_bgs list Btrfs: fix incorrect freeing in scrub_stripe btrfs: sync ioctl, handle errors after transaction start
Showing 6 changed files Side-by-side Diff
fs/btrfs/ctree.h
fs/btrfs/extent-tree.c
... | ... | @@ -9422,7 +9422,6 @@ |
9422 | 9422 | * are still on the list after taking the semaphore |
9423 | 9423 | */ |
9424 | 9424 | list_del_init(&block_group->list); |
9425 | - list_del_init(&block_group->ro_list); | |
9426 | 9425 | if (list_empty(&block_group->space_info->block_groups[index])) { |
9427 | 9426 | kobj = block_group->space_info->block_group_kobjs[index]; |
9428 | 9427 | block_group->space_info->block_group_kobjs[index] = NULL; |
... | ... | @@ -9464,6 +9463,7 @@ |
9464 | 9463 | btrfs_remove_free_space_cache(block_group); |
9465 | 9464 | |
9466 | 9465 | spin_lock(&block_group->space_info->lock); |
9466 | + list_del_init(&block_group->ro_list); | |
9467 | 9467 | block_group->space_info->total_bytes -= block_group->key.offset; |
9468 | 9468 | block_group->space_info->bytes_readonly -= block_group->key.offset; |
9469 | 9469 | block_group->space_info->disk_total -= block_group->key.offset * factor; |
fs/btrfs/extent_io.c
fs/btrfs/scrub.c
fs/btrfs/super.c
... | ... | @@ -1000,10 +1000,20 @@ |
1000 | 1000 | */ |
1001 | 1001 | if (fs_info->pending_changes == 0) |
1002 | 1002 | return 0; |
1003 | + /* | |
1004 | + * A non-blocking test if the fs is frozen. We must not | |
1005 | + * start a new transaction here otherwise a deadlock | |
1006 | + * happens. The pending operations are delayed to the | |
1007 | + * next commit after thawing. | |
1008 | + */ | |
1009 | + if (__sb_start_write(sb, SB_FREEZE_WRITE, false)) | |
1010 | + __sb_end_write(sb, SB_FREEZE_WRITE); | |
1011 | + else | |
1012 | + return 0; | |
1003 | 1013 | trans = btrfs_start_transaction(root, 0); |
1004 | - } else { | |
1005 | - return PTR_ERR(trans); | |
1006 | 1014 | } |
1015 | + if (IS_ERR(trans)) | |
1016 | + return PTR_ERR(trans); | |
1007 | 1017 | } |
1008 | 1018 | return btrfs_commit_transaction(trans, root); |
1009 | 1019 | } |
fs/btrfs/transaction.c