The patch below does not apply to the 4.19-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 stable@vger.kernel.org.
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.19.y git checkout FETCH_HEAD git cherry-pick -x bf7ecbe9875061bf3fce1883e3b26b77f847d1e8 # <resolve conflicts, build, test, etc.> git commit -s git send-email --to 'stable@vger.kernel.org' --in-reply-to '2023073106-swipe-overheat-432b@gregkh' --subject-prefix 'PATCH 4.19.y' HEAD^..
Possible dependencies:
bf7ecbe98750 ("btrfs: check if the transaction was aborted at btrfs_wait_for_commit()") d0c2f4fa555e ("btrfs: make concurrent fsyncs wait less when waiting for a transaction commit") bf31f87f71cc ("btrfs: add wrapper for transaction abort predicate") 77745c05115f ("btrfs: migrate the dirty bg writeout code") 26ce2095e03c ("btrfs: migrate inc/dec_block_group_ro code") 8484764e8587 ("btrfs: temporarily export btrfs_get_restripe_target") 4358d9635a16 ("btrfs: migrate the block group read/creation code") e3e0520b32bc ("btrfs: migrate the block group removal code") 3b2a78f21d5c ("btrfs: temporarily export inc_block_group_ro") 9f21246d8c7e ("btrfs: migrate the block group caching code") 32a9991f15a0 ("btrfs: factor sysfs code out of link_block_group") 89439109bc2b ("btrfs: move sysfs declarations out of ctree.h") 6a9fb468f115 ("btrfs: make caching_thread use btrfs_find_next_key") caa4efafcf03 ("btrfs: temporarily export fragment_free_space") e3cb339fa5ca ("btrfs: export the caching control helpers") 6f410d1b3dbf ("btrfs: export the excluded extents helpers") 676f1f759fa3 ("btrfs: export the block group caching helpers") 3eeb3226a889 ("btrfs: migrate nocow and reservation helpers") 3cad128400c2 ("btrfs: migrate the block group ref counting stuff") 2e405ad84254 ("btrfs: migrate the block group lookup code")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From bf7ecbe9875061bf3fce1883e3b26b77f847d1e8 Mon Sep 17 00:00:00 2001 From: Filipe Manana fdmanana@suse.com Date: Fri, 21 Jul 2023 10:49:20 +0100 Subject: [PATCH] btrfs: check if the transaction was aborted at btrfs_wait_for_commit()
At btrfs_wait_for_commit() we wait for a transaction to finish and then always return 0 (success) without checking if it was aborted, in which case the transaction didn't happen due to some critical error. Fix this by checking if the transaction was aborted.
Fixes: 462045928bda ("Btrfs: add START_SYNC, WAIT_SYNC ioctls") CC: stable@vger.kernel.org # 4.19+ Reviewed-by: Qu Wenruo wqu@suse.com Signed-off-by: Filipe Manana fdmanana@suse.com Reviewed-by: David Sterba dsterba@suse.com Signed-off-by: David Sterba dsterba@suse.com
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index cf306351b148..f11d803b2c4e 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -931,6 +931,7 @@ int btrfs_wait_for_commit(struct btrfs_fs_info *fs_info, u64 transid) }
wait_for_commit(cur_trans, TRANS_STATE_COMPLETED); + ret = cur_trans->aborted; btrfs_put_transaction(cur_trans); out: return ret;