Date: Mon, 7 Aug 2017 21:23:54 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322200 - head/sbin/fsck_ffs Message-ID: <201708072123.v77LNsfC005748@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Mon Aug 7 21:23:54 2017 New Revision: 322200 URL: https://svnweb.freebsd.org/changeset/base/322200 Log: Make it possible to ignore superblock mismatch. This will not fix such a mismatch, but will allow fsck to continue when the last alternate superblock gets corrupted somehow. Also, remove searching for alternate super blocks. It should have been removed two years ago with r276737 by imp@. Leave minor vestiges in place in case someone wants to solve the hard problem of knowing where altnernate superblocks live without access to data formerly stored in disklabels. Differential Revision: https://reviews.freebsd.org/D11589 Modified: head/sbin/fsck_ffs/setup.c Modified: head/sbin/fsck_ffs/setup.c ============================================================================== --- head/sbin/fsck_ffs/setup.c Mon Aug 7 21:12:43 2017 (r322199) +++ head/sbin/fsck_ffs/setup.c Mon Aug 7 21:23:54 2017 (r322200) @@ -68,10 +68,9 @@ static void badsb(int listerr, const char *s); int setup(char *dev) { - long cg, asked, i, j; + long asked, i, j; long bmapsize; struct stat statb; - struct fs proto; size_t size; havesb = 0; @@ -178,26 +177,8 @@ setup(char *dev) skipclean = 0; if (bflag || preen) return(0); - if (reply("LOOK FOR ALTERNATE SUPERBLOCKS") == 0) - return (0); - for (cg = 0; cg < proto.fs_ncg; cg++) { - bflag = fsbtodb(&proto, cgsblock(&proto, cg)); - if (readsb(0) != 0) - break; - } - if (cg >= proto.fs_ncg) { - printf("%s %s\n%s %s\n%s %s\n", - "SEARCH FOR ALTERNATE SUPER-BLOCK", - "FAILED. YOU MUST USE THE", - "-b OPTION TO FSCK TO SPECIFY THE", - "LOCATION OF AN ALTERNATE", - "SUPER-BLOCK TO SUPPLY NEEDED", - "INFORMATION; SEE fsck_ffs(8)."); - bflag = 0; - return(0); - } - pwarn("USING ALTERNATE SUPERBLOCK AT %jd\n", bflag); - bflag = 0; + /* Looking for alternates is hard punt for now but retain structure */ + return (0); } if (skipclean && ckclean && sblock.fs_clean) { pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n"); @@ -393,9 +374,16 @@ readsb(int listerr) altsblock.fs_ipg != sblock.fs_ipg || altsblock.fs_fpg != sblock.fs_fpg || altsblock.fs_magic != sblock.fs_magic) { - badsb(listerr, - "VALUES IN SUPER BLOCK DISAGREE WITH THOSE IN FIRST ALTERNATE"); - return (0); + if (listerr == 0) + return (0); + if (preen) + printf("%s: ", cdevname); + printf( + "VALUES IN SUPER BLOCK LSB=%jd DISAGREE WITH THOSE IN\n" + "FIRST ALTERNATE LSB=%jd\n", + sblk.b_bno, asblk.b_bno); + if (reply("IGNORE ALTERNATE SUPER BLOCK") == 0) + return (0); } out: /* @@ -415,17 +403,6 @@ out: } havesb = 1; return (1); -} - -static void -badsb(int listerr, const char *s) -{ - - if (!listerr) - return; - if (preen) - printf("%s: ", cdevname); - pfatal("BAD SUPER BLOCK: %s\n", s); } void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708072123.v77LNsfC005748>