cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] gfs2-utils: mkfs segfault with 4.16 kernel
Date: Mon, 14 May 2018 14:24:38 +0100	[thread overview]
Message-ID: <20ae5602-fd01-0d89-f6d3-4dbf0175d9ec@redhat.com> (raw)
In-Reply-To: <20180513091319.GV28554@gavran.carpriv.carnet.hr>

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);



  reply	other threads:[~2018-05-14 13:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-04  9:42 [Cluster-devel] gfs2-utils: mkfs segfault with 4.16 kernel Valentin Vidic
2018-05-04  9:50 ` Valentin Vidic
2018-05-04 10:06   ` Andrew Price
2018-05-04 10:21     ` Valentin Vidic
2018-05-04 10:27       ` Andrew Price
2018-05-04 10:42         ` Valentin Vidic
2018-05-04 10:46           ` Andrew Price
2018-05-04 10:54             ` Valentin Vidic
2018-05-04 11:07               ` Andrew Price
2018-05-04 12:01                 ` Valentin Vidic
2018-05-04 13:01                   ` Andrew Price
2018-05-04 13:16                     ` Andrew Price
2018-05-04 14:00                       ` Valentin Vidic
2018-05-09 16:53                         ` Andrew Price
2018-05-10 19:47                           ` Valentin Vidic
2018-05-13  9:13                           ` Valentin Vidic
2018-05-14 13:24                             ` Andrew Price [this message]
2018-05-14 13:48                               ` Valentin Vidic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20ae5602-fd01-0d89-f6d3-4dbf0175d9ec@redhat.com \
    --to=anprice@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).