From: Andrew Price Date: Mon, 5 Mar 2018 16:45:29 +0000 Subject: [Cluster-devel] [PATCH] fsck.gfs2: Don't check lh_crc for older filesystems Message-ID: <20180305164529.13775-1-anprice@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit This fixes the case where fsck.gfs2 is built against v2 log headers but the filesystem pre-dates them and so lh_crc is 0. Signed-off-by: Andrew Price --- gfs2/libgfs2/recovery.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gfs2/libgfs2/recovery.c b/gfs2/libgfs2/recovery.c index 51d210e4..b813d698 100644 --- a/gfs2/libgfs2/recovery.c +++ b/gfs2/libgfs2/recovery.c @@ -76,7 +76,10 @@ int get_log_header(struct gfs2_inode *ip, unsigned int blk, #ifdef GFS2_HAS_LH_V2 lh_crc = lh.lh_crc; #endif - if (error || lh.lh_blkno != blk || lh.lh_hash != hash || lh_crc != crc) + if (error || lh.lh_blkno != blk || lh.lh_hash != hash) + return 1; + /* Don't check the crc if it's zero, as it is in pre-v2 log headers */ + if (lh_crc != 0 && lh_crc != crc) return 1; *head = lh; -- 2.14.3