diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-28 15:26:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-28 15:26:59 -0400 |
commit | 0a2a1330d2621c7f963d9f55bb094811cc1c06b9 (patch) | |
tree | ee1850a7461623a9ac0fbcb2d8ccd1701606a5c6 | |
parent | 9583f1c99fe5a11b3f294ac8093e93f008bea29e (diff) | |
parent | 0e4324a4c36b3eb5cd1f71cbbc38d888f919ebfc (diff) |
Merge branch 'for-4.13-part3' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs fixes from David Sterba:
"Fixes addressing problems reported by users, and there's one more
regression fix"
* 'for-4.13-part3' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: round down size diff when shrinking/growing device
Btrfs: fix early ENOSPC due to delalloc
btrfs: fix lockup in find_free_extent with read-only block groups
Btrfs: fix dir item validation when replaying xattr deletes
-rw-r--r-- | fs/btrfs/extent-tree.c | 11 | ||||
-rw-r--r-- | fs/btrfs/tree-log.c | 3 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 4 |
3 files changed, 8 insertions, 10 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 375f8c728d91..e3b0b4196d3d 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -4825,10 +4825,6 @@ skip_async: | |||
4825 | else | 4825 | else |
4826 | flush = BTRFS_RESERVE_NO_FLUSH; | 4826 | flush = BTRFS_RESERVE_NO_FLUSH; |
4827 | spin_lock(&space_info->lock); | 4827 | spin_lock(&space_info->lock); |
4828 | if (can_overcommit(fs_info, space_info, orig, flush, false)) { | ||
4829 | spin_unlock(&space_info->lock); | ||
4830 | break; | ||
4831 | } | ||
4832 | if (list_empty(&space_info->tickets) && | 4828 | if (list_empty(&space_info->tickets) && |
4833 | list_empty(&space_info->priority_tickets)) { | 4829 | list_empty(&space_info->priority_tickets)) { |
4834 | spin_unlock(&space_info->lock); | 4830 | spin_unlock(&space_info->lock); |
@@ -7589,6 +7585,10 @@ search: | |||
7589 | u64 offset; | 7585 | u64 offset; |
7590 | int cached; | 7586 | int cached; |
7591 | 7587 | ||
7588 | /* If the block group is read-only, we can skip it entirely. */ | ||
7589 | if (unlikely(block_group->ro)) | ||
7590 | continue; | ||
7591 | |||
7592 | btrfs_grab_block_group(block_group, delalloc); | 7592 | btrfs_grab_block_group(block_group, delalloc); |
7593 | search_start = block_group->key.objectid; | 7593 | search_start = block_group->key.objectid; |
7594 | 7594 | ||
@@ -7624,8 +7624,6 @@ have_block_group: | |||
7624 | 7624 | ||
7625 | if (unlikely(block_group->cached == BTRFS_CACHE_ERROR)) | 7625 | if (unlikely(block_group->cached == BTRFS_CACHE_ERROR)) |
7626 | goto loop; | 7626 | goto loop; |
7627 | if (unlikely(block_group->ro)) | ||
7628 | goto loop; | ||
7629 | 7627 | ||
7630 | /* | 7628 | /* |
7631 | * Ok we want to try and use the cluster allocator, so | 7629 | * Ok we want to try and use the cluster allocator, so |
@@ -7839,6 +7837,7 @@ loop: | |||
7839 | failed_alloc = false; | 7837 | failed_alloc = false; |
7840 | BUG_ON(index != get_block_group_index(block_group)); | 7838 | BUG_ON(index != get_block_group_index(block_group)); |
7841 | btrfs_release_block_group(block_group, delalloc); | 7839 | btrfs_release_block_group(block_group, delalloc); |
7840 | cond_resched(); | ||
7842 | } | 7841 | } |
7843 | up_read(&space_info->groups_sem); | 7842 | up_read(&space_info->groups_sem); |
7844 | 7843 | ||
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index f20ef211a73d..3a11ae63676e 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -2153,8 +2153,7 @@ process_leaf: | |||
2153 | u32 this_len = sizeof(*di) + name_len + data_len; | 2153 | u32 this_len = sizeof(*di) + name_len + data_len; |
2154 | char *name; | 2154 | char *name; |
2155 | 2155 | ||
2156 | ret = verify_dir_item(fs_info, path->nodes[0], | 2156 | ret = verify_dir_item(fs_info, path->nodes[0], i, di); |
2157 | path->slots[0], di); | ||
2158 | if (ret) { | 2157 | if (ret) { |
2159 | ret = -EIO; | 2158 | ret = -EIO; |
2160 | goto out; | 2159 | goto out; |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 5eb7217738ed..e8b9a269fdde 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -2702,7 +2702,7 @@ int btrfs_grow_device(struct btrfs_trans_handle *trans, | |||
2702 | 2702 | ||
2703 | mutex_lock(&fs_info->chunk_mutex); | 2703 | mutex_lock(&fs_info->chunk_mutex); |
2704 | old_total = btrfs_super_total_bytes(super_copy); | 2704 | old_total = btrfs_super_total_bytes(super_copy); |
2705 | diff = new_size - device->total_bytes; | 2705 | diff = round_down(new_size - device->total_bytes, fs_info->sectorsize); |
2706 | 2706 | ||
2707 | if (new_size <= device->total_bytes || | 2707 | if (new_size <= device->total_bytes || |
2708 | device->is_tgtdev_for_dev_replace) { | 2708 | device->is_tgtdev_for_dev_replace) { |
@@ -4406,7 +4406,7 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size) | |||
4406 | u64 diff; | 4406 | u64 diff; |
4407 | 4407 | ||
4408 | new_size = round_down(new_size, fs_info->sectorsize); | 4408 | new_size = round_down(new_size, fs_info->sectorsize); |
4409 | diff = old_size - new_size; | 4409 | diff = round_down(old_size - new_size, fs_info->sectorsize); |
4410 | 4410 | ||
4411 | if (device->is_tgtdev_for_dev_replace) | 4411 | if (device->is_tgtdev_for_dev_replace) |
4412 | return -EINVAL; | 4412 | return -EINVAL; |