From 2df1f6aa071e09527d1767e0d5178f29b4e9a73c Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 27 Feb 1998 05:03:48 +0000 Subject: [PATCH] ChangeLog, e2fsck.c, e2fsck.h, pass1.c: e2fsck.c (e2fsck_run): Since E2F_FLAG_SIGNAL_MASK doesn't include EXT2_FLAG_RESTART anymore, we need to adjust this routine so that it *does* return in the case of it seeing EXT2_FLAG_RESTART. pass1.c (e2fsck_pass1): ext2_get_next_inode() may call the group done callback function, which may set context abort flags. So we need to test the context abort flags after we call ext2_get_next_inode(). (process_inodes): If we abort due out of process_inodes, do a clean exit by breaking out of the for loop instead of just returning. e2fsck.h (E2F_FLAG_SIGNAL_MASK): EXT2_FLAG_RESTART shouldn't be considered a SIGNAL mask (i.e., requiring an immediate abort of processing to restart). FLAG_RESTART just means that we want to restart once pass 1 is complete. --- e2fsck/ChangeLog | 20 ++++++++++++++++++++ e2fsck/e2fsck.c | 10 ++++++---- e2fsck/e2fsck.h | 2 +- e2fsck/pass1.c | 5 +++-- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 36dc54a..95cf80d 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,23 @@ +Fri Feb 27 00:01:39 1998 Theodore Ts'o + + * e2fsck.c (e2fsck_run): Since E2F_FLAG_SIGNAL_MASK doesn't + include EXT2_FLAG_RESTART anymore, we need to adjust this + routine so that it *does* return in the case of it seeing + EXT2_FLAG_RESTART. + + * pass1.c (e2fsck_pass1): ext2_get_next_inode() may call the group + done callback function, which may set context abort + flags. So we need to test the context abort flags after + we call ext2_get_next_inode(). + (process_inodes): If we abort due out of process_inodes, + do a clean exit by breaking out of the for loop instead of + just returning. + + * e2fsck.h (E2F_FLAG_SIGNAL_MASK): EXT2_FLAG_RESTART shouldn't be + considered a SIGNAL mask (i.e., requiring an immediate + abort of processing to restart). FLAG_RESTART just means + that we want to restart once pass 1 is complete. + Tue Feb 24 15:19:40 1998 Theodore Ts'o * Change the progress function to return an integer; if returns 1, diff --git a/e2fsck/e2fsck.c b/e2fsck/e2fsck.c index 7d09406..56437d5 100644 --- a/e2fsck/e2fsck.c +++ b/e2fsck/e2fsck.c @@ -135,6 +135,8 @@ pass_t e2fsck_passes[] = { e2fsck_pass1, e2fsck_pass2, e2fsck_pass3, e2fsck_pass4, e2fsck_pass5, 0 }; +#define E2F_FLAG_RUN_RETURN (E2F_FLAG_SIGNAL_MASK|E2F_FLAG_RESTART) + int e2fsck_run(e2fsck_t ctx) { int i; @@ -142,19 +144,19 @@ int e2fsck_run(e2fsck_t ctx) #ifdef HAVE_SETJMP_H if (setjmp(ctx->abort_loc)) - return (ctx->flags & E2F_FLAG_SIGNAL_MASK); + return (ctx->flags & E2F_FLAG_RUN_RETURN); ctx->flags |= E2F_FLAG_SETJMP_OK; #endif for (i=0; (e2fsck_pass = e2fsck_passes[i]); i++) { - if (ctx->flags & E2F_FLAG_SIGNAL_MASK) + if (ctx->flags & E2F_FLAG_RUN_RETURN) break; e2fsck_pass(ctx); } ctx->flags &= ~E2F_FLAG_SETJMP_OK; - if (ctx->flags & E2F_FLAG_SIGNAL_MASK) - return (ctx->flags & E2F_FLAG_SIGNAL_MASK); + if (ctx->flags & E2F_FLAG_RUN_RETURN) + return (ctx->flags & E2F_FLAG_RUN_RETURN); return 0; } diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h index ca08fe3..b8ac30c 100644 --- a/e2fsck/e2fsck.h +++ b/e2fsck/e2fsck.h @@ -95,8 +95,8 @@ struct resource_track { */ #define E2F_FLAG_ABORT 0x0001 /* Abort signaled */ #define E2F_FLAG_CANCEL 0x0002 /* Cancel signaled */ +#define E2F_FLAG_SIGNAL_MASK 0x0003 #define E2F_FLAG_RESTART 0x0004 /* Restart signaled */ -#define E2F_FLAG_SIGNAL_MASK 0x000F #define E2F_FLAG_SETJMP_OK 0x0010 /* Setjmp valid for abort */ diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 4832f69..e2a35f0 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -442,6 +442,8 @@ void e2fsck_pass1(e2fsck_t ctx) } next: pctx.errcode = ext2fs_get_next_inode(scan, &ino, &inode); + if (ctx->flags & E2F_FLAG_SIGNAL_MASK) + return; if (pctx.errcode == EXT2_ET_BAD_BLOCK_IN_INODE_TABLE) { if (!ctx->inode_bb_map) alloc_bb_map(ctx); @@ -545,9 +547,8 @@ static void process_inodes(e2fsck_t ctx, char *block_buf) sprintf(buf, "reading indirect blocks of inode %lu", pctx.ino); ehandler_operation(buf); check_blocks(ctx, &pctx, block_buf); - if (ctx->flags & E2F_FLAG_SIGNAL_MASK) - return; + break; } ctx->stashed_inode = old_stashed_inode; ctx->stashed_ino = old_stashed_ino; -- 1.8.3.1