diff options
author | scottl <scottl@FreeBSD.org> | 2013-07-30 22:57:12 +0000 |
---|---|---|
committer | scottl <scottl@FreeBSD.org> | 2013-07-30 22:57:12 +0000 |
commit | d13c0062851638685f23ad2a414ca3b0e71ba340 (patch) | |
tree | d9647feaaaa44c41d2ce4450a5c48b8d34e7edba /sbin/fsck_ffs/fsutil.c | |
parent | aac8087bead638965fd8df72ec05b082185fa599 (diff) | |
download | FreeBSD-src-d13c0062851638685f23ad2a414ca3b0e71ba340.zip FreeBSD-src-d13c0062851638685f23ad2a414ca3b0e71ba340.tar.gz |
Add a 'surrender' mode to fsck_ffs. With the -S flag, once hard read errors
are encountered, the fsck will stop instead of wasting time chewing through
possibly other errors.
Obtained from: Netflix
MFC after: 3 days
Diffstat (limited to 'sbin/fsck_ffs/fsutil.c')
-rw-r--r-- | sbin/fsck_ffs/fsutil.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index f177408..abc987a 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -549,7 +549,18 @@ blread(int fd, char *buf, ufs2_daddr_t blk, long size) slowio_end(); return (0); } - rwerror("READ BLK", blk); + + /* + * This is handled specially here instead of in rwerror because + * rwerror is used for all sorts of errors, not just true read/write + * errors. It should be refactored and fixed. + */ + if (surrender) { + pfatal("CANNOT READ_BLK: %ld", (long)blk); + errx(EEXIT, "ABORTING DUE TO READ ERRORS"); + } else + rwerror("READ BLK", blk); + if (lseek(fd, offset, 0) < 0) rwerror("SEEK BLK", blk); errs = 0; |