Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a2a1330 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 9583f1c9 0e4324a4
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -4825,10 +4825,6 @@ static void shrink_delalloc(struct btrfs_fs_info *fs_info, u64 to_reclaim,
		else
			flush = BTRFS_RESERVE_NO_FLUSH;
		spin_lock(&space_info->lock);
		if (can_overcommit(fs_info, space_info, orig, flush, false)) {
			spin_unlock(&space_info->lock);
			break;
		}
		if (list_empty(&space_info->tickets) &&
		    list_empty(&space_info->priority_tickets)) {
			spin_unlock(&space_info->lock);
@@ -7589,6 +7585,10 @@ static noinline int find_free_extent(struct btrfs_fs_info *fs_info,
		u64 offset;
		int cached;

		/* If the block group is read-only, we can skip it entirely. */
		if (unlikely(block_group->ro))
			continue;

		btrfs_grab_block_group(block_group, delalloc);
		search_start = block_group->key.objectid;

@@ -7624,8 +7624,6 @@ static noinline int find_free_extent(struct btrfs_fs_info *fs_info,

		if (unlikely(block_group->cached == BTRFS_CACHE_ERROR))
			goto loop;
		if (unlikely(block_group->ro))
			goto loop;

		/*
		 * Ok we want to try and use the cluster allocator, so
@@ -7839,6 +7837,7 @@ static noinline int find_free_extent(struct btrfs_fs_info *fs_info,
		failed_alloc = false;
		BUG_ON(index != get_block_group_index(block_group));
		btrfs_release_block_group(block_group, delalloc);
		cond_resched();
	}
	up_read(&space_info->groups_sem);

+1 −2
Original line number Diff line number Diff line
@@ -2153,8 +2153,7 @@ static int replay_xattr_deletes(struct btrfs_trans_handle *trans,
			u32 this_len = sizeof(*di) + name_len + data_len;
			char *name;

			ret = verify_dir_item(fs_info, path->nodes[0],
					      path->slots[0], di);
			ret = verify_dir_item(fs_info, path->nodes[0], i, di);
			if (ret) {
				ret = -EIO;
				goto out;
+2 −2
Original line number Diff line number Diff line
@@ -2702,7 +2702,7 @@ int btrfs_grow_device(struct btrfs_trans_handle *trans,

	mutex_lock(&fs_info->chunk_mutex);
	old_total = btrfs_super_total_bytes(super_copy);
	diff = new_size - device->total_bytes;
	diff = round_down(new_size - device->total_bytes, fs_info->sectorsize);

	if (new_size <= device->total_bytes ||
	    device->is_tgtdev_for_dev_replace) {
@@ -4406,7 +4406,7 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size)
	u64 diff;

	new_size = round_down(new_size, fs_info->sectorsize);
	diff = old_size - new_size;
	diff = round_down(old_size - new_size, fs_info->sectorsize);

	if (device->is_tgtdev_for_dev_replace)
		return -EINVAL;