fsck.gfs2: Don't check lh_crc for older filesystems
PATCH 1/1 fsck.gfs2: Don't check lh_crc for older filesystems
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 <[email protected]>
--- gfs2/libgfs2/recovery.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
gfs2/libgfs2/recovery.c +4 -1
@@ -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;
Signature · 1 line
2.14.3
PATCH 1/1 fsck.gfs2: Don't check lh_crc for older filesystems
----- Original Message -----
| 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 <[email protected]> | ---
Hi,
Yes, that looks right. ACK.
Regards,
Bob Peterson
Red Hat File Systems