From: Kemeng Shi Date: Thu, 1 Aug 2024 01:38:08 +0000 (+0800) Subject: jbd2: correctly compare tids with tid_geq function in jbd2_fc_begin_commit X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e58e570a88f0c62d4043d2b99b0ddb237c1f6ff8;p=linux jbd2: correctly compare tids with tid_geq function in jbd2_fc_begin_commit commit f0e3c14802515f60a47e6ef347ea59c2733402aa upstream. Use tid_geq to compare tids to work over sequence number wraps. Signed-off-by: Kemeng Shi Reviewed-by: Jan Kara Reviewed-by: Zhang Yi Cc: stable@kernel.org Link: https://patch.msgid.link/20240801013815.2393869-2-shikemeng@huaweicloud.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 7635e5411012..cca73b8282d1 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -725,7 +725,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; }