Skip to content

Commit 7582026

Browse files
Abhi DasAndreas Gruenbacher
authored andcommitted
gfs2: fix gfs2_find_jhead that returns uninitialized jhead with seq 0
When the first log header in a journal happens to have a sequence number of 0, a bug in gfs2_find_jhead() causes it to prematurely exit, and return an uninitialized jhead with seq 0. This can cause failures in the caller. For instance, a mount fails in one test case. The correct behavior is for it to continue searching through the journal to find the correct journal head with the highest sequence number. Fixes: f4686c2 ("gfs2: read journal in large chunks") Cc: [email protected] # v5.2+ Signed-off-by: Abhi Das <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent a62aa6f commit 7582026

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/gfs2/lops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ static bool gfs2_jhead_pg_srch(struct gfs2_jdesc *jd,
422422

423423
for (offset = 0; offset < PAGE_SIZE; offset += sdp->sd_sb.sb_bsize) {
424424
if (!__get_log_header(sdp, kaddr + offset, 0, &lh)) {
425-
if (lh.lh_sequence > head->lh_sequence)
425+
if (lh.lh_sequence >= head->lh_sequence)
426426
*head = lh;
427427
else {
428428
ret = true;

0 commit comments

Comments
 (0)