Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Nov 2018 00:07:36 +0000
From:      Rick Macklem <rmacklem@uoguelph.ca>
To:        Kirk McKusick <mckusick@mckusick.com>
Cc:        "soralx@cydem.org" <soralx@cydem.org>, "freebsd-fs@freebsd.org" <freebsd-fs@freebsd.org>, "Julian H. Stacey" <jhs@berklix.com>, Konstantin Belousov <kostikbel@gmail.com>
Subject:   Re: [bug] fsck refuses to repair damaged UFS using backup superblock
Message-ID:  <YTOPR0101MB1162D82F0211BF1FE7D6A4E1DDD60@YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM>
In-Reply-To: <YTOPR0101MB1162816FC7EFC4E5150A7692DDD60@YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM>
References:  <YTOPR0101MB1162E62A2BA4D92D215C8983DDD60@YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM>, <201811251842.wAPIgEpW053136@chez.mckusick.com>, <YTOPR0101MB1162816FC7EFC4E5150A7692DDD60@YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM>

next in thread | previous in thread | raw e-mail | index | archive | help

________________________________________
From: Rick Macklem
Sent: Sunday, November 25, 2018 6:45 PM
To: Kirk McKusick
Cc: soralx@cydem.org; freebsd-fs@freebsd.org; Julian H. Stacey; Konstantin =
Belousov
Subject: Re: [bug] fsck refuses to repair damaged UFS using backup superblo=
ck

Rick Macklem wrote:
[stuff snipped]
>Maybe setting all elements of fs_sparecon32[] to zeros before writing the
>superblock out would minimize these issues for the future and could be MFC=
'd.
>(I'm not claiming that a new FFS2 should be movable between stable/11 and
> head, but it might be a nice feature?)
Ok, it looks like the FS_METACKHASH flag was meant to handle the old->new
kernel transition. However, if I am reading the code correctly, it needs to=
 be
checked for sooner. Here's the code snippet:
      /* fetch the superblock and summary information */
812        if ((error =3D ffs_sbget(devvp, &fs, -1, M_UFSMNT, ffs_use_bread=
)) !=3D 0)
813                goto out;
814        fs->fs_fmod =3D 0;
815        /* if we ran on a kernel without metadata check hashes, disable =
them */
816        if ((fs->fs_flags & FS_METACKHASH) =3D=3D 0)
817                fs->fs_metackhash =3D 0;
I think ffs_sbget() calls readsuper() which calls calc_sbhash(), so lines 8=
15-817
need to be near the top of readsuper(), I think?

rick
[more stuff snipped]



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YTOPR0101MB1162D82F0211BF1FE7D6A4E1DDD60>