From 3aa18f1ae63d54542e71bc00f740196f6d6893ee Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 16 Sep 2023 14:29:24 +0200 Subject: [PATCH] 4.14-stable patches added patches: btrfs-don-t-start-transaction-when-joining-with-trans_join_nostart.patch --- ...when-joining-with-trans_join_nostart.patch | 43 +++++++++++++++++++ queue-4.14/series | 1 + 2 files changed, 44 insertions(+) create mode 100644 queue-4.14/btrfs-don-t-start-transaction-when-joining-with-trans_join_nostart.patch diff --git a/queue-4.14/btrfs-don-t-start-transaction-when-joining-with-trans_join_nostart.patch b/queue-4.14/btrfs-don-t-start-transaction-when-joining-with-trans_join_nostart.patch new file mode 100644 index 00000000000..d07f7481b92 --- /dev/null +++ b/queue-4.14/btrfs-don-t-start-transaction-when-joining-with-trans_join_nostart.patch @@ -0,0 +1,43 @@ +From 4490e803e1fe9fab8db5025e44e23b55df54078b Mon Sep 17 00:00:00 2001 +From: Filipe Manana +Date: Wed, 26 Jul 2023 16:56:57 +0100 +Subject: btrfs: don't start transaction when joining with TRANS_JOIN_NOSTART + +From: Filipe Manana + +commit 4490e803e1fe9fab8db5025e44e23b55df54078b upstream. + +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. + +CC: stable@vger.kernel.org # 4.14+ +Fixes: a6d155d2e363 ("Btrfs: fix deadlock between fiemap and transaction commits") +Signed-off-by: Filipe Manana +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman +--- + fs/btrfs/transaction.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/fs/btrfs/transaction.c ++++ b/fs/btrfs/transaction.c +@@ -216,10 +216,11 @@ loop: + 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; + + /* diff --git a/queue-4.14/series b/queue-4.14/series index 7f48c6d6589..297e7e6de4a 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -141,3 +141,4 @@ igbvf-change-igbvf_min-to-allow-set-rx-tx-value-betw.patch igb-change-igb_min-to-allow-set-rx-tx-value-between-.patch ata-sata_gemini-add-missing-module_description.patch ata-pata_ftide010-add-missing-module_description.patch +btrfs-don-t-start-transaction-when-joining-with-trans_join_nostart.patch -- 2.47.3