Linux EXT4 FS development
 help / color / mirror / Atom feed
From: Kemeng Shi <shikemeng@huaweicloud.com>
To: tytso@mit.edu, jack@suse.com
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/8] jbd2: correctly compare tids with tid_geq function in jbd2_fc_begin_commit
Date: Wed, 31 Jul 2024 14:22:40 +0800	[thread overview]
Message-ID: <20240731062247.2380440-2-shikemeng@huaweicloud.com> (raw)
In-Reply-To: <20240731062247.2380440-1-shikemeng@huaweicloud.com>

Use tid_geq to compare tids to work over sequence number wraps.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: Jan Kara <jack@suse.cz>
---
 fs/jbd2/journal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 1ebf2393bfb7..da5a56d700f1 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -710,7 +710,7 @@ int jbd2_fc_begin_commit(journal_t *journal, tid_t tid)
 		return -EINVAL;
 
 	write_lock(&journal->j_state_lock);
-	if (tid <= journal->j_commit_sequence) {
+	if (tid_geq(journal->j_commit_sequence, tid)) {
 		write_unlock(&journal->j_state_lock);
 		return -EALREADY;
 	}
-- 
2.30.0


  reply	other threads:[~2024-07-31  6:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31  6:22 [PATCH v2 0/8] Fix and cleanups to jbd2 Kemeng Shi
2024-07-31  6:22 ` Kemeng Shi [this message]
2024-07-31  6:22 ` [PATCH v2 2/8] jbd2: remove dead check in journal_alloc_journal_head Kemeng Shi
2024-07-31  6:22 ` [PATCH v2 3/8] jbd2: remove unused return value of jbd2_fc_release_bufs Kemeng Shi
2024-07-31  6:22 ` [PATCH v2 4/8] jbd2: remove unneeded kmap for jh_in->b_frozen_data in jbd2_journal_write_metadata_buffer Kemeng Shi
2024-07-31  6:22 ` [PATCH v2 5/8] jbd2: remove unneeded done_copy_out variable " Kemeng Shi
2024-07-31 12:00   ` Jan Kara
2024-07-31  6:22 ` [PATCH v2 6/8] ext4: move escape handle to futher improve jbd2_journal_write_metadata_buffer Kemeng Shi
2024-07-31 12:00   ` Jan Kara
2024-07-31  6:22 ` [PATCH v2 7/8] jbd2: correct comment jbd2_mark_journal_empty Kemeng Shi
2024-07-31  6:22 ` [PATCH v2 8/8] jbd2: remove unneeded check of ret in jbd2_fc_get_buf Kemeng Shi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240731062247.2380440-2-shikemeng@huaweicloud.com \
    --to=shikemeng@huaweicloud.com \
    --cc=jack@suse.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox