From nobody Fri Oct 18 08:38:25 2024 Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) (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 34157157A6B for ; Tue, 23 Jul 2024 15:44:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.186 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721749465; cv=none; b=mfNxAjgxZtGJuhEjV9PS4BHpkHsZPVjZ9mVKtJ45zXMC3cePJfZ9uMhM89EmctKrc1qu3dzPXBtKasfSJEIxYce67XGSwI6xbF7a3Mru5HnkXkbaBXGAxuV5lEX7XFXOV9j+WaYdbBKUmBNa4toKNI/i4cqGHECRbDK/qvz5QsY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721749465; c=relaxed/simple; bh=TA7W0pcxd/Eb0Vc0SGJlJR1RToLMmy29uT+Pri3wrDE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W+C4qJMOMYw77foIJpDxdB/0UCHzqUfxVfszCSFvnUB61YnV5UtXfLFCuR+/R+/cmj5WxuzVWTqu1oKXA6h+kMIHdDiUGamFjZDpUQFEF7T6rhkrHxcIkP9vk7hh35iqpx2aJyhc6ZJEy2ZEm5HK19JemdmC9giurcKiKhzKRXY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=rNAMjQzH; arc=none smtp.client-ip=95.215.58.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="rNAMjQzH" X-Envelope-To: tytso@mit.edu DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1721749461; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OCQDY39ftFCrPmBUE2fSsNAe1oUYALwUXrxgaHtT78I=; b=rNAMjQzHp6gz96BOMWcSXgxujUT5aMsp3ZtuFZ0R93ex24p/zBr+pWltm0Yt4SyzAJ2vdJ mYAkDm257Puk1iE+Rek54tMh9Dh9UMc9lLqhldFCQYuCvjMwHJxZ0OUkt//oxOuvrMOHS/ p1Dp6vc/HFh1wzo9TBo2GTQhP4n/Puo= X-Envelope-To: adilger@dilger.ca X-Envelope-To: jack@suse.cz X-Envelope-To: harshadshirwadkar@gmail.com X-Envelope-To: linux-ext4@vger.kernel.org X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: luis.henriques@linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Luis Henriques (SUSE)" To: Theodore Ts'o , Andreas Dilger , Jan Kara , Harshad Shirwadkar Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, "Luis Henriques (SUSE)" Subject: [PATCH 2/4] ext4: fix incorrect tid assumption in __jbd2_log_wait_for_space() Date: Tue, 23 Jul 2024 16:44:00 +0100 Message-ID: <20240723154402.21125-3-luis.henriques@linux.dev> In-Reply-To: <20240723154402.21125-1-luis.henriques@linux.dev> References: <20240723154402.21125-1-luis.henriques@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" 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 --- fs/jbd2/checkpoint.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c index 951f78634adf..77bc522e6821 100644 --- 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 =3D journal->j_checkpoint_transactions !=3D NULL; tid_t tid =3D 0; + bool has_transaction =3D false; =20 - if (journal->j_committing_transaction) + if (journal->j_committing_transaction) { tid =3D journal->j_committing_transaction->t_tid; + has_transaction =3D 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) =3D=3D 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