On 13/05/18 10:13, Valentin Vidic wrote:
On Wed, May 09, 2018 at 05:53:19PM +0100, Andrew Price wrote:
You should be able to fix this by using the configure.ac and
gfs2/libgfs2/meta.c files from master. The diff should be very small. It'll
need an ./autogen.sh to rebuild the configure script.
The downside of that approach is that the new fields will be recognised but
not used in the utils. The next release of gfs2-utils will add that
functionality.
As I feared, the gfs2 kernel module does not want to mount the
filesystem created with patched gfs2-utils. I guess that I will
need to take the current master branch to get it working again?
We can still keep this minimal if that's better for the Debian package.
The issue is due to the log header checksum (lh_hash) being calculated
using sizeof(struct gfs2_log_header) and that size has increased in the
latest kernel gfs2_ondisk.h.
For the purposes of the package we can fix that by replacing those
sizeof's with the correct value, as below.
Andy
diff --git a/gfs2/libgfs2/recovery.c b/gfs2/libgfs2/recovery.c
index cad723f0..7326574f 100644
--- a/gfs2/libgfs2/recovery.c
+++ b/gfs2/libgfs2/recovery.c
@@ -66,7 +66,7 @@ int get_log_header(struct gfs2_inode *ip, unsigned int
blk,
tmp = (struct gfs2_log_header *)bh->b_data;
saved_hash = tmp->lh_hash;
tmp->lh_hash = 0;
- hash = gfs2_disk_hash(bh->b_data, sizeof(struct gfs2_log_header));
+ hash = gfs2_disk_hash(bh->b_data, 48);
tmp->lh_hash = saved_hash;
gfs2_log_header_in(&lh, bh);
brelse(bh);
@@ -234,7 +234,7 @@ int clean_journal(struct gfs2_inode *ip, struct
gfs2_log_header *head)
lh->lh_sequence = cpu_to_be64(head->lh_sequence + 1);
lh->lh_flags = cpu_to_be32(GFS2_LOG_HEAD_UNMOUNT);
lh->lh_blkno = cpu_to_be32(lblock);
- hash = gfs2_disk_hash((const char *)lh, sizeof(struct
gfs2_log_header));
+ hash = gfs2_disk_hash((const char *)lh, 48);
lh->lh_hash = cpu_to_be32(hash);
bmodified(bh);
brelse(bh);
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index 1cc88b50..a8da4a0c 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -133,7 +133,7 @@ int lgfs2_write_journal_data(struct gfs2_inode *ip)
lh.lh_sequence = seq;
lh.lh_blkno = bh->b_blocknr - jext0;
gfs2_log_header_out(&lh, bh);
- hash = gfs2_disk_hash(bh->b_data, sizeof(struct
gfs2_log_header));
+ hash = gfs2_disk_hash(bh->b_data, 48);
((struct gfs2_log_header *)bh->b_data)->lh_hash =
cpu_to_be32(hash);
if (bwrite(bh)) {
@@ -185,7 +185,7 @@ int write_journal(struct gfs2_inode *jnl, unsigned
bsize, unsigned int blocks)
lh.lh_sequence = seq;
lh.lh_blkno = x;
gfs2_log_header_out(&lh, bh);
- hash = gfs2_disk_hash(bh->b_data, sizeof(struct
gfs2_log_header));
+ hash = gfs2_disk_hash(bh->b_data, 48);
((struct gfs2_log_header *)bh->b_data)->lh_hash =
cpu_to_be32(hash);
bmodified(bh);