Blame SOURCES/bz1659490-gfs2_utils_Wrong_hash_value_used_to_clean_journals.patch

7aadc5
commit 7095c5f1ab7ab2d9e02c203c9966b65c09249e1f
7aadc5
Author: Bob Peterson <rpeterso@redhat.com>
7aadc5
Date:   Fri Dec 14 09:16:19 2018 -0500
7aadc5
7aadc5
    gfs2-utils: Wrong hash value used to clean journals
7aadc5
    
7aadc5
    When fsck.gfs2 sees a dirty journal, (one that does not have a
7aadc5
    log header with the UNMOUNT flag set at the wrap-point), it replays
7aadc5
    the journal and writes a log header out to "clean" the journal.
7aadc5
    Unfortunately, before this patch, it was using the wrong hash value.
7aadc5
    So every time fsck.gfs2 was run, it would not recognize its own
7aadc5
    log header because of the wrong hash, and therefore it would always
7aadc5
    see the journal as dirty with every run (until the file system is
7aadc5
    mounted and unmounted, which would write a new correct log header).
7aadc5
    Therefore, multiple runs of fsck.gfs2 would always result in a
7aadc5
    replay of the journal, which remains "dirty."
7aadc5
    
7aadc5
    This patch changes function clean_journal so that it uses the
7aadc5
    correct hash function. Therefore, the journal will be truly clean
7aadc5
    and consecutive runs (or mounts) will find the journal clean.
7aadc5
    
7aadc5
    Resolves: rhbz#1659490
7aadc5
    
7aadc5
    Signed-off-by: Bob Peterson <rpeterso@redhat.com>
7aadc5
    Signed-off-by: Andrew Price <anprice@redhat.com>
7aadc5
7aadc5
diff --git a/gfs2/libgfs2/recovery.c b/gfs2/libgfs2/recovery.c
7aadc5
index 6b14bf94..06f81116 100644
7aadc5
--- a/gfs2/libgfs2/recovery.c
7aadc5
+++ b/gfs2/libgfs2/recovery.c
7aadc5
@@ -241,7 +241,7 @@ int clean_journal(struct gfs2_inode *ip, struct gfs2_log_header *head)
7aadc5
 	lh->lh_sequence = cpu_to_be64(head->lh_sequence + 1);
7aadc5
 	lh->lh_flags = cpu_to_be32(GFS2_LOG_HEAD_UNMOUNT);
7aadc5
 	lh->lh_blkno = cpu_to_be32(lblock);
7aadc5
-	hash = gfs2_disk_hash((const char *)lh, sizeof(struct gfs2_log_header));
7aadc5
+	hash = lgfs2_log_header_hash(bh->b_data);
7aadc5
 	lh->lh_hash = cpu_to_be32(hash);
7aadc5
 	bmodified(bh);
7aadc5
 	brelse(bh);