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 PATCH] gfs2-utils: Wrong hash value used to clean journals
Date: Fri, 14 Dec 2018 15:26:25 +0000	[thread overview]
Message-ID: <e7f50c2f-1cc2-bfd0-c13e-a7b3d0cccfd8@redhat.com> (raw)
In-Reply-To: <865189051.52191081.1544796979685.JavaMail.zimbra@redhat.com>

On 14/12/2018 14:16, Bob Peterson wrote:
> Hi,
> 
> When fsck.gfs2 sees a dirty journal, (one that does not have a
> log header with the UNMOUNT flag set at the wrap-point), it replays
> the journal and writes a log header out to "clean" the journal.
> Unfortunately, before this patch, it was using the wrong hash value.
> So every time fsck.gfs2 was run, it would not recognize its own
> log header because of the wrong hash, and therefore it would always
> see the journal as dirty with every run (until the file system is
> mounted and unmounted, which would write a new correct log header).
> Therefore, multiple runs of fsck.gfs2 would always result in a
> replay of the journal, which remains "dirty."
> 
> This patch changes function clean_journal so that it uses the
> correct hash function. Therefore, the journal will be truly clean
> and consecutive runs (or mounts) will find the journal clean.
> 
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> ---
>   gfs2/libgfs2/recovery.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gfs2/libgfs2/recovery.c b/gfs2/libgfs2/recovery.c
> index 6b14bf94..06f81116 100644
> --- a/gfs2/libgfs2/recovery.c
> +++ b/gfs2/libgfs2/recovery.c
> @@ -241,7 +241,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 = lgfs2_log_header_hash(bh->b_data);
>   	lh->lh_hash = cpu_to_be32(hash);
>   	bmodified(bh);
>   	brelse(bh);
> 

Thanks Bob, I've pushed the patch as it's a clear fix.

Andy



      reply	other threads:[~2018-12-14 15:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1020823401.52190420.1544796956864.JavaMail.zimbra@redhat.com>
2018-12-14 14:16 ` [Cluster-devel] [gfs2-utils PATCH] gfs2-utils: Wrong hash value used to clean journals Bob Peterson
2018-12-14 15:26   ` Andrew Price [this message]

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=e7f50c2f-1cc2-bfd0-c13e-a7b3d0cccfd8@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).