From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A5A51F957 for ; Tue, 1 Aug 2023 09:37:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EABCCC433D9; Tue, 1 Aug 2023 09:37:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1690882655; bh=2cdEFtNEVGxt/VgsmkoUVG2sgu/+8C6ckzL/L/Z3yFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cgocn3gr7yVKj3RgH8e9X6K0zvmzyj5Ed3OUQNLKweGiyH3cCjvXeR9qnhP8rIo57 CgzJR0fWTgnrQomalGF2Ch/dbhqDAHLzx4UwucC5BHFCKPTMx7juzaSGfo4Z5Od0GK aL1At1JvALgfQ/ozZzGH3HaHjPB+BNpfkkooZos4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Qu Wenruo , Filipe Manana , David Sterba Subject: [PATCH 6.1 184/228] btrfs: check if the transaction was aborted at btrfs_wait_for_commit() Date: Tue, 1 Aug 2023 11:20:42 +0200 Message-ID: <20230801091929.514256933@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230801091922.799813980@linuxfoundation.org> References: <20230801091922.799813980@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Filipe Manana 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 --- fs/btrfs/transaction.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -919,6 +919,7 @@ int btrfs_wait_for_commit(struct btrfs_f } wait_for_commit(cur_trans, TRANS_STATE_COMPLETED); + ret = cur_trans->aborted; btrfs_put_transaction(cur_trans); out: return ret;