Skip to content

Commit 038c170

Browse files
Kirk McKusickKirk McKusick
authored andcommitted
Properly recover from superblock check-hash failures. Specifically,
report the check-hash failure and offer to search for and use alternate superblocks. Prior to this fix fsck_ffs would simply report the check-hash failure and exit. Reported by: Julian H. Stacey <jhs@berklix.com> Tested by: Peter Holm Sponsored by: Netflix
1 parent ade67b5 commit 038c170

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

sbin/fsck_ffs/setup.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ setup(char *dev)
127127
}
128128
}
129129
if ((fsreadfd = open(dev, O_RDONLY)) < 0 ||
130-
ufs_disk_fillout(&disk, dev) < 0) {
130+
ufs_disk_fillout_blank(&disk, dev) < 0) {
131131
if (bkgrdflag) {
132132
unlink(snapname);
133133
bkgrdflag = 0;
@@ -325,10 +325,8 @@ readsb(int listerr)
325325
if ((ret = sbget(fsreadfd, &fs, super)) != 0) {
326326
switch (ret) {
327327
case EINVAL:
328-
fprintf(stderr, "The previous newfs operation "
329-
"on this volume did not complete.\nYou must "
330-
"complete newfs before using this volume.\n");
331-
exit(11);
328+
/* Superblock check-hash failed */
329+
return (0);
332330
case ENOENT:
333331
if (bflag)
334332
fprintf(stderr, "%jd is not a file system "

0 commit comments

Comments
 (0)