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 6D5FA1DE88F; Tue, 8 Oct 2024 13:22:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728393723; cv=none; b=L7Pk4dU8Jmnm3MqtSsJmJMzo0+PpXkUePu3WfigOdRtzBDS9/sHVPWX57m9/9m7mA331jcZ5ZluFXktLBqHknBy3/69kFwjk/GNVwN0cIW/Fv0BGNALu/xIj2W0LtIjKFAik6KVi3Oacn0O1aKPl5qYenL1rzLZACewhoAaAWe8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728393723; c=relaxed/simple; bh=v3VDULWMNM263P0m7YWo3aFzUZCpSh1LxGjBt8vLRtU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WVFqNlGlgc7ny5ZQlUzpZj7MiukwrMyO3bPh0pr3qKJ/2s00kh9TqS1Ik4wt/iq0mbaNVRVFr6B+sfiD1PefVXYoxW/4v70jV2+c9BQB4jzMT/z8jffQMALDqdrvPgFKRXq6iJ1g6Vn8zw1MbGz70KgnDEM112AO8xBtO64JG6o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=G9DjjseL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="G9DjjseL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80D98C4CEC7; Tue, 8 Oct 2024 13:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728393723; bh=v3VDULWMNM263P0m7YWo3aFzUZCpSh1LxGjBt8vLRtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G9DjjseLwgj7cJ9n1eoctlNDQ8BqVea9Pm6GlklKU7MGC3W/QXoINp9GTX5C6qcxW Oha2Gb8zrqtH5b7EA3JCRwvHfX1x2Ep3w+cfy3vxlIkhS157Gk+dIE8eNQGNF5QgyF uLSlaXqxOgAjCv5J774Zg23x3jqfxZz/sdY3wTjY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Luis Henriques (SUSE)" , Jan Kara , Theodore Tso , stable@kernel.org Subject: [PATCH 6.6 237/386] ext4: fix incorrect tid assumption in __jbd2_log_wait_for_space() Date: Tue, 8 Oct 2024 14:08:02 +0200 Message-ID: <20241008115638.726207607@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241008115629.309157387@linuxfoundation.org> References: <20241008115629.309157387@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Luis Henriques (SUSE) commit 972090651ee15e51abfb2160e986fa050cfc7a40 upstream. Function __jbd2_log_wait_for_space() assumes that '0' is not a valid value for transaction IDs, which is incorrect. Don't assume that and invoke jbd2_log_wait_commit() if the journal had a committing transaction instead. Signed-off-by: Luis Henriques (SUSE) Reviewed-by: Jan Kara Link: https://patch.msgid.link/20240724161119.13448-3-luis.henriques@linux.dev Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/checkpoint.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/fs/jbd2/checkpoint.c +++ b/fs/jbd2/checkpoint.c @@ -79,9 +79,12 @@ __releases(&journal->j_state_lock) if (space_left < nblocks) { int chkpt = journal->j_checkpoint_transactions != NULL; tid_t tid = 0; + bool has_transaction = false; - if (journal->j_committing_transaction) + if (journal->j_committing_transaction) { tid = journal->j_committing_transaction->t_tid; + has_transaction = true; + } spin_unlock(&journal->j_list_lock); write_unlock(&journal->j_state_lock); if (chkpt) { @@ -89,7 +92,7 @@ __releases(&journal->j_state_lock) } else if (jbd2_cleanup_journal_tail(journal) == 0) { /* We were able to recover space; yay! */ ; - } else if (tid) { + } else if (has_transaction) { /* * jbd2_journal_commit_transaction() may want * to take the checkpoint_mutex if JBD2_FLUSHED