diff mbox

[07/24] e2fsck: skip clearing bad extents if bitmaps are unreadable

Message ID 20140718225304.31374.95208.stgit@birch.djwong.org
State Accepted, archived
Headers show

Commit Message

Darrick Wong July 18, 2014, 10:53 p.m. UTC
If the bitmaps are known to be unreadable, don't bother clearing them;
just mark fsck to restart itself after pass 5, by which time the
bitmaps should be fixed.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 e2fsck/pass1.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)



--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Theodore Ts'o July 22, 2014, 5:58 p.m. UTC | #1
On Fri, Jul 18, 2014 at 03:53:04PM -0700, Darrick J. Wong wrote:
> If the bitmaps are known to be unreadable, don't bother clearing them;
> just mark fsck to restart itself after pass 5, by which time the
> bitmaps should be fixed.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Thanks, applied.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index ba60029..5c628a3 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -1980,6 +1980,26 @@  report_problem:
 			pctx->blkcount = extent.e_lblk + extent.e_len;
 			if (fix_problem(ctx, problem, pctx)) {
 fix_problem_now:
+				if (ctx->invalid_bitmaps) {
+					/*
+					 * If fsck knows the bitmaps are bad,
+					 * skip to the next extent and
+					 * try to clear this extent again
+					 * after fixing the bitmaps, by
+					 * restarting fsck.
+					 */
+					pctx->errcode = ext2fs_extent_get(
+							  ehandle,
+							  EXT2_EXTENT_NEXT_SIB,
+							  &extent);
+					ctx->flags |= E2F_FLAG_RESTART_LATER;
+					if (pctx->errcode ==
+						    EXT2_ET_NO_CURRENT_NODE) {
+						pctx->errcode = 0;
+						break;
+					}
+					continue;
+				}
 				e2fsck_read_bitmaps(ctx);
 				pctx->errcode =
 					ext2fs_extent_delete(ehandle, 0);