summaryrefslogtreecommitdiff
path: root/e2fsck/e2fsck.h
diff options
context:
space:
mode:
authorAndreas Dilger <andreas.dilger@intel.com>2015-11-13 18:10:27 -0700
committerTheodore Ts'o <tytso@mit.edu>2015-11-16 06:20:56 -0500
commitdb3d8718be6ad3bdd252b242827fa54914b8ec2e (patch)
tree009dede036baaae55445450b255c33161e205b8d /e2fsck/e2fsck.h
parent7dce0c06e56d0f661126bd1ee1e5d70c174c2500 (diff)
downloade2fsprogs-db3d8718be6ad3bdd252b242827fa54914b8ec2e.tar.gz
e2fsck: skip quota update when interrupted
There is a bug in how e2fsck handles being interrupted by CTRL-C. If CTRL-C is pressed to kill e2fsck rather than e.g. kill -9, then the interrupt handler sets E2F_FLAG_CANCEL in the context but doesn't actually kill the process. Instead, e2fsck_pass1() checks this flag before processing the next inode. If a filesystem is running in fix mode (e2fsck -fy) is interrupted, and the quota feature is enabled, then the quota file will still be written to disk even though the inode scan was not complete and the quota information is totally inaccurate. Even worse, if the Pass 1 inode and block scan was not finished, then the in-memory block bitmaps (which are used for block allocation during e2fsck) are also invalid, so any blocks allocated to the quota files may corrupt other files if those blocks were actually used. e2fsck 1.42.13.wc3 (28-Aug-2015) Pass 1: Checking inodes, blocks, and sizes ^C[QUOTA WARNING] Usage inconsistent for ID 0: actual (6455296, 168) != expected (8568832, 231) [QUOTA WARNING] Usage inconsistent for ID 695: actual (614932320256, 63981) != expected (2102405386240, 176432) Update quota info for quota type 0? yes [QUOTA WARNING] Usage inconsistent for ID 0: actual (6455296, 168) != expected (8568832, 231) [QUOTA WARNING] Usage inconsistent for ID 538: actual (614932320256, 63981) != expected (2102405386240, 176432) Update quota info for quota type 1? yes myth-OST0001: e2fsck canceled. myth-OST0001: ***** FILE SYSTEM WAS MODIFIED ***** There may be a desire to flush out modified inodes and such that have been repaired, so that restarting an interrupted e2fsck will make progress, but the quota file update is plain wrong unless at least pass1 has finished, and the journal recreation is also dangerous if the block bitmaps have not been fully updated. Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'e2fsck/e2fsck.h')
-rw-r--r--e2fsck/e2fsck.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index f904026f..810030e2 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -173,10 +173,10 @@ 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_SIGNAL_MASK (E2F_FLAG_ABORT | E2F_FLAG_CANCEL)
#define E2F_FLAG_RESTART 0x0004 /* Restart signaled */
+#define E2F_FLAG_RUN_RETURN (E2F_FLAG_SIGNAL_MASK | E2F_FLAG_RESTART)
#define E2F_FLAG_RESTART_LATER 0x0008 /* Restart after all iterations done */
-
#define E2F_FLAG_SETJMP_OK 0x0010 /* Setjmp valid for abort */
#define E2F_FLAG_PROG_BAR 0x0020 /* Progress bar on screen */