Whamcloud - gitweb
e2fsck: reserve blocks for root/lost+found directory repair
authorDarrick J. Wong <darrick.wong@oracle.com>
Sat, 26 Jul 2014 00:33:45 +0000 (17:33 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 26 Jul 2014 19:45:42 +0000 (15:45 -0400)
commitb729b7dfabace52fb5c76d621f900e578e73bf12
tree36d6a2fc351253513dd94d756382c538badb5101
parent97c607b1a25e1f4e83bf246c76b679d91470f5dc
e2fsck: reserve blocks for root/lost+found directory repair

If we think we're going to need to repair either the root directory or
the lost+found directory, reserve a block at the end of pass 1 to
reduce the likelihood of an e2fsck abort while reconstructing
root/lost+found during pass 3.

If / and/or /lost+found are corrupt and duplicate processing in pass
1b allocates all the free blocks in the FS, fsck aborts with an
unusable FS since pass 3 can't recreate / or /lost+found.  If either
of those directories are missing, an admin can't easily mount the FS
and access the directory tree to move files off the injured FS and
free up space; this in turn prevents subsequent runs of e2fsck from
being able to continue repairs of the FS.

(One could migrate files manually with debugfs without the help of
path names, but it seems easier if users can simply mount the FS and
use regular FS management tools.)

[ Fixed up an obvious C trap: const char * and const char [] are not
  the same thing when you are taking the size of the parameter.
  People, run your regression tests!  Like spinach, it's good for you.  :-)
  -- tytso ]

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/e2fsck.h
e2fsck/pass1.c
e2fsck/pass3.c
tests/f_illitable/expect.1