From: Filipe Manana Date: Fri, 21 Jul 2023 09:49:20 +0000 (+0100) Subject: btrfs: check if the transaction was aborted at btrfs_wait_for_commit() X-Git-Tag: v6.1.43~44 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a7b85dc3164445a22ff7c073e563451f4be8e04d;p=thirdparty%2Fkernel%2Fstable.git btrfs: check if the transaction was aborted at btrfs_wait_for_commit() commit bf7ecbe9875061bf3fce1883e3b26b77f847d1e8 upstream. 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 Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 682b463a7633a..e45abbb20ee87 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -919,6 +919,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;