All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] [GFS2 PATCH v2] gfs2: fix gfs2_find_jhead that returns uninitialized jhead with seq 0
@ 2020-02-04 20:14 Abhi Das
  2020-02-04 21:55 ` Andreas Gruenbacher
  0 siblings, 1 reply; 2+ messages in thread
From: Abhi Das @ 2020-02-04 20:14 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

This version changes the description as per discussion with Andreas.

Cheers!
--Abhi

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.

Signed-off-by: Abhi Das <adas@redhat.com>
---
 fs/gfs2/lops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index d9431724b788..c090d5ad3f22 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -422,7 +422,7 @@ static bool gfs2_jhead_pg_srch(struct gfs2_jdesc *jd,
 
 	for (offset = 0; offset < PAGE_SIZE; offset += sdp->sd_sb.sb_bsize) {
 		if (!__get_log_header(sdp, kaddr + offset, 0, &lh)) {
-			if (lh.lh_sequence > head->lh_sequence)
+			if (lh.lh_sequence >= head->lh_sequence)
 				*head = lh;
 			else {
 				ret = true;
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Cluster-devel] [GFS2 PATCH v2] gfs2: fix gfs2_find_jhead that returns uninitialized jhead with seq 0
  2020-02-04 20:14 [Cluster-devel] [GFS2 PATCH v2] gfs2: fix gfs2_find_jhead that returns uninitialized jhead with seq 0 Abhi Das
@ 2020-02-04 21:55 ` Andreas Gruenbacher
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Gruenbacher @ 2020-02-04 21:55 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi Abhi,

On Tue, Feb 4, 2020 at 9:15 PM Abhi Das <adas@redhat.com> wrote:
> 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.

applied for the next merge window, with a suitable Fixes tag for stable.

Thanks,
Andreas




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-04 21:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 20:14 [Cluster-devel] [GFS2 PATCH v2] gfs2: fix gfs2_find_jhead that returns uninitialized jhead with seq 0 Abhi Das
2020-02-04 21:55 ` Andreas Gruenbacher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.