Fix bug in e2fsck: When reconnecting a directory, we may

need to create a lost+found directory.  This may
invalidate our pointer to the directory information, so we
must look it up again after calling
e2fsck_reconnect_file().  (Addresses Debian bug #219640).
bitmap-optimize
Theodore Ts'o 2003-12-12 03:00:56 -05:00
parent 2d9f0804bf
commit 2e5fcce05e
7 changed files with 64 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2003-12-12 Theodore Ts'o <tytso@mit.edu>
* pass3.c (check_directory): When reconnecting a directory, we may
need to create a lost+found directory. This may
invalidate our pointer to the directory information, so we
must look it up again after calling
e2fsck_reconnect_file(). (Addresses Debian bug #219640).
2003-12-10 Theodore Ts'o <tytso@mit.edu>
* e2fsck.h (E2F_FLAG_RESTARTED): Assign a unique flag bitfield to

View File

@ -302,9 +302,10 @@ static int check_directory(e2fsck_t ctx, struct dir_info *dir,
p->parent)))) {
pctx->ino = p->ino;
if (fix_problem(ctx, PR_3_UNCONNECTED_DIR, pctx)) {
if (e2fsck_reconnect_file(ctx, p->ino))
if (e2fsck_reconnect_file(ctx, pctx->ino))
ext2fs_unmark_valid(fs);
else {
p = e2fsck_get_dir_info(ctx, pctx->ino);
p->parent = ctx->lost_and_found;
fix_dotdot(ctx, p, ctx->lost_and_found);
}

View File

@ -1,3 +1,8 @@
2003-12-12 Theodore Ts'o <tytso@mit.edu>
* f_lpf2: New test case to validate reconnecting a directory after
creating /lost+found.
2003-09-03 Theodore Ts'o <tytso@mit.edu>
* m_meta_bg: New test case to test the meta block group feature.

41
tests/f_lpf2/expect.1 Normal file
View File

@ -0,0 +1,41 @@
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Unconnected directory inode 12 (/???)
Connect to /lost+found? yes
/lost+found not found. Create? yes
Unconnected directory inode 13 (/???)
Connect to /lost+found? yes
Pass 4: Checking reference counts
Inode 2 ref count is 4, should be 3. Fix? yes
Inode 12 ref count is 3, should be 2. Fix? yes
Inode 13 ref count is 3, should be 2. Fix? yes
Pass 5: Checking group summary information
Block bitmap differences: -(9--19)
Fix? yes
Free blocks count wrong for group #0 (77, counted=89).
Fix? yes
Free blocks count wrong (77, counted=89).
Fix? yes
Free inodes count wrong for group #0 (2, counted=3).
Fix? yes
Directories count wrong for group #0 (5, counted=4).
Fix? yes
Free inodes count wrong (2, counted=3).
Fix? yes
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 13/16 files (0.0% non-contiguous), 11/100 blocks
Exit status is 1

7
tests/f_lpf2/expect.2 Normal file
View File

@ -0,0 +1,7 @@
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 13/16 files (0.0% non-contiguous), 11/100 blocks
Exit status is 0

BIN
tests/f_lpf2/image.gz Normal file

Binary file not shown.

1
tests/f_lpf2/name Normal file
View File

@ -0,0 +1 @@
create lost+found and reconnect lost directory