Skip to contentSkip to conversation

FAILED: patch "[PATCH] btrfs: don't start transaction when joining with" failed to apply to 4.14-stable tree

PATCH [email protected] 1 participant 1 message Sep 16, 2023

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.14.y
git checkout FETCH_HEAD
git cherry-pick -x 4490e803e1fe9fab8db5025e44e23b55df54078b
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023091642-bonding-pessimism-6fe2@gregkh' --subject-prefix 'PATCH 4.14.y' HEAD^..

Possible dependencies:

4490e803e1fe ("btrfs: don't start transaction when joining with TRANS_JOIN_NOSTART")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 4490e803e1fe9fab8db5025e44e23b55df54078b Mon Sep 17 00:00:00 2001
From: Filipe Manana <[email protected]>
Date: Wed, 26 Jul 2023 16:56:57 +0100
Subject: [PATCH] btrfs: don't start transaction when joining with
TRANS_JOIN_NOSTART

When joining a transaction with TRANS_JOIN_NOSTART, if we don't find a running transaction we end up creating one. This goes against the purpose of TRANS_JOIN_NOSTART which is to join a running transaction if its state is at or below the state TRANS_STATE_COMMIT_START, otherwise return an -ENOENT error and don't start a new transaction. So fix this to not create a new transaction if there's no running transaction at or below that state.

Fixes a6d155d2e363 ("Btrfs: fix deadlock between fiemap and transaction commits")
fs/btrfs/transaction.c +4 -3
index 815f61d6b506..6a2a12593183 100644
@@ -292,10 +292,11 @@ static noinline int join_transaction(struct btrfs_fs_info *fs_info,
 	spin_unlock(&fs_info->trans_lock);
 
 	/*
-	 * If we are ATTACH, we just want to catch the current transaction,
-	 * and commit it. If there is no transaction, just return ENOENT.
+	 * If we are ATTACH or TRANS_JOIN_NOSTART, we just want to catch the
+	 * current transaction, and commit it. If there is no transaction, just
+	 * return ENOENT.
 	 */
-	if (type == TRANS_ATTACH)
+	if (type == TRANS_ATTACH || type == TRANS_JOIN_NOSTART)
 		return -ENOENT;
 
 	/*