Commit 92514ef2 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull btrfs fixes from David Sterba:

 - add lockdep annotation for relocation root to fix a splat warning
   while merging roots

 - fix assertion failure when splitting ordered extent after transaction
   abort

 - don't print 'qgroup inconsistent' message when rescan process updates
   qgroup data sooner than the subvolume deletion process

 - fix use-after-free (accessing the error number) when attempting to
   join an aborted transaction

 - avoid starting new transaction if not necessary when cleaning qgroup
   during subvolume drop

* tag 'for-6.14-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
  btrfs: avoid starting new transaction when cleaning qgroup during subvolume drop
  btrfs: fix use-after-free when attempting to join an aborted transaction
  btrfs: do not output error message if a qgroup has been already cleaned up
  btrfs: fix assertion failure when splitting ordered extent after transaction abort
  btrfs: fix lockdep splat while merging a relocation root
parents 5c8c2292 fdef89ce
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1496,6 +1496,7 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p,

		if (!p->skip_locking) {
			btrfs_unlock_up_safe(p, parent_level + 1);
			btrfs_maybe_reset_lockdep_class(root, tmp);
			tmp_locked = true;
			btrfs_tree_read_lock(tmp);
			btrfs_release_path(p);
@@ -1539,6 +1540,7 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p,

	if (!p->skip_locking) {
		ASSERT(ret == -EAGAIN);
		btrfs_maybe_reset_lockdep_class(root, tmp);
		tmp_locked = true;
		btrfs_tree_read_lock(tmp);
		btrfs_release_path(p);
+12 −0
Original line number Diff line number Diff line
@@ -1229,6 +1229,18 @@ struct btrfs_ordered_extent *btrfs_split_ordered_extent(
	 */
	if (WARN_ON_ONCE(len >= ordered->num_bytes))
		return ERR_PTR(-EINVAL);
	/*
	 * If our ordered extent had an error there's no point in continuing.
	 * The error may have come from a transaction abort done either by this
	 * task or some other concurrent task, and the transaction abort path
	 * iterates over all existing ordered extents and sets the flag
	 * BTRFS_ORDERED_IOERR on them.
	 */
	if (unlikely(flags & (1U << BTRFS_ORDERED_IOERR))) {
		const int fs_error = BTRFS_FS_ERROR(fs_info);

		return fs_error ? ERR_PTR(fs_error) : ERR_PTR(-EIO);
	}
	/* We cannot split partially completed ordered extents. */
	if (ordered->bytes_left) {
		ASSERT(!(flags & ~BTRFS_ORDERED_TYPE_FLAGS));
+5 −6
Original line number Diff line number Diff line
@@ -1880,11 +1880,7 @@ int btrfs_qgroup_cleanup_dropped_subvolume(struct btrfs_fs_info *fs_info, u64 su
	 * Commit current transaction to make sure all the rfer/excl numbers
	 * get updated.
	 */
	trans = btrfs_start_transaction(fs_info->quota_root, 0);
	if (IS_ERR(trans))
		return PTR_ERR(trans);

	ret = btrfs_commit_transaction(trans);
	ret = btrfs_commit_current_transaction(fs_info->quota_root);
	if (ret < 0)
		return ret;

@@ -1897,8 +1893,11 @@ int btrfs_qgroup_cleanup_dropped_subvolume(struct btrfs_fs_info *fs_info, u64 su
	/*
	 * It's squota and the subvolume still has numbers needed for future
	 * accounting, in this case we can not delete it.  Just skip it.
	 *
	 * Or the qgroup is already removed by a qgroup rescan. For both cases we're
	 * safe to ignore them.
	 */
	if (ret == -EBUSY)
	if (ret == -EBUSY || ret == -ENOENT)
		ret = 0;
	return ret;
}
+3 −1
Original line number Diff line number Diff line
@@ -274,8 +274,10 @@ static noinline int join_transaction(struct btrfs_fs_info *fs_info,
	cur_trans = fs_info->running_transaction;
	if (cur_trans) {
		if (TRANS_ABORTED(cur_trans)) {
			const int abort_error = cur_trans->aborted;

			spin_unlock(&fs_info->trans_lock);
			return cur_trans->aborted;
			return abort_error;
		}
		if (btrfs_blocked_trans_types[cur_trans->state] & type) {
			spin_unlock(&fs_info->trans_lock);