ChangeLog, pass1.c, problem.c, problem.h, problemP.h:

pass1.c: Treat inodes with a low dtime (that were from a corrupted
  	orphan list) specially.
  problem.c, problem.h: Add new problem codes PR_1_LOW_DTIME and
  	PR_1_ORPHAN_LIST_REFUGEES, and a new latch group, PR_LATCH_LOW_DTIME.
  problemP.h: Expand the size of the problem flag to be an int instead
  	of a short.  Expand space in the flag word which is reserved for
  	problem latch flags from 3 bits to 8 bits.
ChangeLog, expect.1, expect.2, image.gz, name:
  f_badorphan: New test which verifies corrupted orphan list handling.
bitmap-optimize
Theodore Ts'o 2001-05-14 12:47:41 +00:00
parent 54c637d4d2
commit 21afac096d
10 changed files with 161 additions and 13 deletions

View File

@ -1,5 +1,16 @@
2001-05-14 Theodore Tso <tytso@valinux.com>
* pass1.c: Treat inodes with a low dtime (that were from a
corrupted orphan list) specially.
* problem.c, problem.h: Add new problem codes PR_1_LOW_DTIME and
PR_1_ORPHAN_LIST_REFUGEES, and a new latch group,
PR_LATCH_LOW_DTIME.
* problemP.h: Expand the size of the problem flag to be an int
instead of a short. Expand space in the flag word which
is reserved for problem latch flags from 3 bits to 8 bits.
* e2fsck.h, scantest.c: Change location of ext2_fs.h to be
ext2fs/ext2_fs.h

View File

@ -441,6 +441,33 @@ void e2fsck_pass1(e2fsck_t ctx)
check_blocks(ctx, &pctx, block_buf);
goto next;
}
/*
* Check for inodes who might have been part of the
* orphaned list linked list. They should have gotten
* dealt with by now, unless the list had somehow been
* corrupted.
*
* FIXME: In the future, inodes which are still in use
* (and which are therefore) pending truncation should
* be handled specially. Right now we just clear the
* dtime field, and the normal e2fsck handling of
* inodes where i_size and the inode blocks are
* inconsistent is to fix i_size, instead of releasing
* the extra blocks. This won't catch the inodes that
* was at the end of the orphan list, but it's better
* than nothing. The right answer is that there
* shouldn't be any bugs in the orphan list handling. :-)
*/
if (inode.i_dtime &&
inode.i_dtime < ctx->fs->super->s_inodes_count) {
if (fix_problem(ctx, PR_1_LOW_DTIME, &pctx)) {
inode.i_dtime = inode.i_links_count ?
0 : time(0);
e2fsck_write_inode(ctx, ino, &inode,
"pass1");
}
}
/*
* This code assumes that deleted inodes have
* i_links_count set to 0.

View File

@ -556,6 +556,17 @@ static const struct e2fsck_problem problem_table[] = {
N_("@j is not regular file. "),
PROMPT_FIX, PR_PREEN_OK },
/* Deal with inodes that were part of orphan linked list */
{ PR_1_LOW_DTIME,
N_("@i %i was part of the orphaned @i list. "),
PROMPT_FIX, PR_LATCH_LOW_DTIME, 0 },
/* Deal with inodes that were part of corrupted orphan linked
list (latch question) */
{ PR_1_ORPHAN_LIST_REFUGEES,
N_("@is that were part of a corrupted orphan linked list found. "),
PROMPT_FIX, 0 },
/* Pass 1b errors */
/* Pass 1B: Rescan for duplicate/bad blocks */
@ -1130,6 +1141,7 @@ static struct latch_descr pr_latch_info[] = {
{ PR_LATCH_BBITMAP, PR_5_BLOCK_BITMAP_HEADER, PR_5_BLOCK_BITMAP_END },
{ PR_LATCH_RELOC, PR_0_RELOCATE_HINT, 0 },
{ PR_LATCH_DBLOCK, PR_1B_DUP_BLOCK_HEADER, PR_1B_DUP_BLOCK_END },
{ PR_LATCH_LOW_DTIME, PR_1_ORPHAN_LIST_REFUGEES, 0 },
{ -1, 0, 0 },
};

View File

@ -28,13 +28,14 @@ struct problem_context {
* handled as a set. The user answers once for a particular latch
* group.
*/
#define PR_LATCH_MASK 0x0070 /* Latch mask */
#define PR_LATCH_MASK 0x0ff0 /* Latch mask */
#define PR_LATCH_BLOCK 0x0010 /* Latch for illegal blocks (pass 1) */
#define PR_LATCH_BBLOCK 0x0020 /* Latch for bad block inode blocks (pass 1) */
#define PR_LATCH_IBITMAP 0x0030 /* Latch for pass 5 inode bitmap proc. */
#define PR_LATCH_BBITMAP 0x0040 /* Latch for pass 5 inode bitmap proc. */
#define PR_LATCH_RELOC 0x0050 /* Latch for superblock relocate hint */
#define PR_LATCH_DBLOCK 0x0060 /* Latch for pass 1b dup block headers */
#define PR_LATCH_LOW_DTIME 0x0070 /* Latch for pass1 orphaned list refugees */
#define PR_LATCH(x) ((((x) & PR_LATCH_MASK) >> 4) - 1)
@ -319,6 +320,12 @@ struct problem_context {
/* Journal inode has wrong mode */
#define PR_1_JOURNAL_BAD_MODE 0x010035
/* Inode that was part of orphan linked list */
#define PR_1_LOW_DTIME 0x010036
/* Latch question which asks how to deal with low dtime inodes */
#define PR_1_ORPHAN_LIST_REFUGEES 0x010037
/*
* Pass 1b errors

View File

@ -13,7 +13,7 @@ struct e2fsck_problem {
problem_t e2p_code;
const char * e2p_description;
char prompt;
short flags;
int flags;
problem_t second_code;
};
@ -24,15 +24,18 @@ struct latch_descr {
int flags;
};
#define PR_PREEN_OK 0x0001 /* Don't need to do preenhalt */
#define PR_NO_OK 0x0002 /* If user answers no, don't make fs invalid */
#define PR_NO_DEFAULT 0x0004 /* Default to no */
#define PR_MSG_ONLY 0x0008 /* Print message only */
#define PR_FATAL 0x0080 /* Fatal error */
#define PR_AFTER_CODE 0x0100 /* After asking the first question, */
/* ask another */
#define PR_PREEN_NOMSG 0x0200 /* Don't print a message if we're preening */
#define PR_NOCOLLATE 0x0400 /* Don't collate answers for this latch */
#define PR_NO_NOMSG 0x0800 /* Don't print a message if e2fsck -n */
#define PR_PREEN_NO 0x1000 /* Use No as an answer if preening */
#define PR_PREEN_OK 0x000001 /* Don't need to do preenhalt */
#define PR_NO_OK 0x000002 /* If user answers no, don't make fs invalid */
#define PR_NO_DEFAULT 0x000004 /* Default to no */
#define PR_MSG_ONLY 0x000008 /* Print message only */
/* Bit positions 0x000ff0 are reserved for the PR_LATCH flags */
#define PR_FATAL 0x001000 /* Fatal error */
#define PR_AFTER_CODE 0x002000 /* After asking the first question, */
/* ask another */
#define PR_PREEN_NOMSG 0x004000 /* Don't print a message if we're preening */
#define PR_NOCOLLATE 0x008000 /* Don't collate answers for this latch */
#define PR_NO_NOMSG 0x010000 /* Don't print a message if e2fsck -n */
#define PR_PREEN_NO 0x020000 /* Use No as an answer if preening */

View File

@ -1,3 +1,8 @@
2001-05-14 Theodore Tso <tytso@valinux.com>
* f_badorphan: New test which verifies corrupted orphan list
handling.
2001-05-05 Theodore Tso <tytso@valinux.com>
* d_loaddump: New test which verifies debugfs's dump and load

View File

@ -0,0 +1,75 @@
Clearing orphaned inode 54 (uid=0, gid=0, mode=0100600, size=44610)
Clearing orphaned inode 32 (uid=0, gid=0, mode=040700, size=1024)
Clearing orphaned inode 67 (uid=0, gid=0, mode=040700, size=1024)
Clearing orphaned inode 55 (uid=0, gid=0, mode=040700, size=1024)
Pass 1: Checking inodes, blocks, and sizes
Inodes that were part of a corrupted orphan linked list found. Fix? yes
Inode 13 was part of the orphaned inode list. FIXED.
Inode 17 was part of the orphaned inode list. FIXED.
Deleted inode 18 has zero dtime. Fix? yes
Inode 19 was part of the orphaned inode list. FIXED.
Inode 22 was part of the orphaned inode list. FIXED.
Inode 23 was part of the orphaned inode list. FIXED.
Inode 24 was part of the orphaned inode list. FIXED.
Inode 25 was part of the orphaned inode list. FIXED.
Inode 26 was part of the orphaned inode list. FIXED.
Inode 27 was part of the orphaned inode list. FIXED.
Inode 28 was part of the orphaned inode list. FIXED.
Inode 30 was part of the orphaned inode list. FIXED.
Inode 33 was part of the orphaned inode list. FIXED.
Inode 36 was part of the orphaned inode list. FIXED.
Inode 38 was part of the orphaned inode list. FIXED.
Inode 43 was part of the orphaned inode list. FIXED.
Inode 44 was part of the orphaned inode list. FIXED.
Inode 46 was part of the orphaned inode list. FIXED.
Inode 47 was part of the orphaned inode list. FIXED.
Inode 51 was part of the orphaned inode list. FIXED.
Inode 53 was part of the orphaned inode list. FIXED.
Inode 56 was part of the orphaned inode list. FIXED.
Inode 61 was part of the orphaned inode list. FIXED.
Inode 65 was part of the orphaned inode list. FIXED.
Inode 70 was part of the orphaned inode list. FIXED.
Inode 71 was part of the orphaned inode list. FIXED.
Inode 75 was part of the orphaned inode list. FIXED.
Inode 77 was part of the orphaned inode list. FIXED.
Inode 83 was part of the orphaned inode list. FIXED.
Inode 84 was part of the orphaned inode list. FIXED.
Inode 85 was part of the orphaned inode list. FIXED.
Inode 87 was part of the orphaned inode list. FIXED.
Inode 91 was part of the orphaned inode list. FIXED.
Inode 93 was part of the orphaned inode list. FIXED.
Inode 96 was part of the orphaned inode list. FIXED.
Inode 97 was part of the orphaned inode list. FIXED.
Inode 99 was part of the orphaned inode list. FIXED.
Inode 109 was part of the orphaned inode list. FIXED.
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: -1363 -1364 -1365 -1366 -1367 -1368 -1369 -1370 -1371 -1372 -1373 -1374 -1375 -1376 -1377 -1378 -1379 -1380 -1381 -1382 -1383 -1384 -1385 -1386 -1387 -1388 -1389 -1390 -1391 -1392 -1393 -1394 -1395 -1396 -1397 -1398 -1399 -1401 -1402 -1403 -1404 -1405 -1461 -1505 -1506 -1507 -1508 -1509 -1510 -1511 -1512 -1513 -1514 -1515 -1516 -1517 -1518 -1519 -1520 -1521 -1522 -1523 -1524 -1525 -1526 -1527 -1528 -1529 -1530 -1531 -1532 -1533 -1538 -1539 -1540 -1566 -1567 -1568 -1569 -1570 -1571 -1572 -1573 -1574 -1593 -1594 -1595 -1596 -1597 -1598 -1599 -1600 -1604 -1605 -1654 -1656 -1657 -1658 -1659 -1660 -1661 -1662 -1663 -1664 -1665 -1666 -1667 -1668 -1669 -1670 -1671 -1672 -1673 -1674 -1675 -1676 -1677 -1678 -1679 -1680 -1681 -1682 -1683 -1684 -1685 -1686 -1687 -1688 -1689 -1690 -1691 -1692 -1693 -1694 -1695 -1696 -1697 -1698 -1699 -1700 -1701 -1702 -1703 -1706 -1707 -1708 -1709 -1710 -1711 -1712 -1713 -1714 -1715 -1716 -1717 -1718 -1719 -1720 -1721 -1722 -1723 -1724 -1725 -1726 -1728 -1803 -1804 -1913 -2286 -2287 -2288 -2289 -2290 -2291 -2292 -2293 -2294 -2295 -2392 -2960 -2961 -2962 -2963 -2964 -2965 -2966 -2967 -2968 -2969 -2970 -2971 -2972 -2973 -3118 -3119 -3120 -3121 -3122 -3123 -3124 -3125 -3126 -3127 -3128 -3129 -3130 -3131 -3132 -3133 -3134 -3135 -3136 -3137 -3138 -3139 -3140 -3141 -3142 -3143 -3144 -3145 -3146 -3147 -3148 -3149 -3150 -3151 -3152 -3153 -3154 -3345 -3451 -3452 -3569 -3748 -3749 -4409 -4411 -4412 -4413 -4414 -4435 -4436 -4437 -4438 -4439 -4440 -4441 -4442 -4443 -4444 -4445 -4446 -4447 -4448 -4449 -4450 -4451 -4452 -4453 -4454 -4455 -4456 -4720 -4721 -4722 -4723 -4724 -4725 -4929 -4967 -4968 -4969 -4970 -4971 -4972 -4973 -4974 -4975 -4976 -4977 -4978 -4979 -4980 -4981 -4982 -4983 -4984 -5258 -5259 -5260 -5261 -5262 -5263 -5264 -5265 -5266 -5267 -5268 -5269 -5270 -5271 -5272 -5273 -5274 -5275 -5352 -5353 -5354 -5412 -5413 -5414 -5415 -5416 -5417 -5418 -5419 -5420 -5421 -5422 -5423 -5424 -5425 -5493 -5620 -5621 -5622 -5623 -5624 -5625 -5626 -5627 -5628 -5629 -5630 -5631 -5632 -5633 -5634 -5635 -5636 -5637 -5638 -5639 -5640 -5641 -5642 -5643 -5644 -5645 -5646 -5647 -5676 -5677 -5720 -5721 -5722 -5723 -5724 -5725 -5726 -5727 -5728 -5729 -5730 -5731 -5732 -5733 -5734 -5735 -5736 -5737 -5738 -5739 -5740 -5741 -5742 -5743 -5744 -5760 -5761 -5762 -5763 -5764 -5765 -5766 -5767 -5768 -5769 -5770 -5771 -5772 -5773 -5774 -5775 -5776 -5777 -5778 -5779 -5780 -5781 -5782 -5783 -5784 -5785 -5786 -5787 -5788 -6013
Fix? yes
Free blocks count wrong for group #0 (5801, counted=6210).
Fix? yes
Free blocks count wrong (5801, counted=6210).
Fix? yes
Inode bitmap differences: -13 -17 -18 -19 -22 -23 -24 -25 -26 -27 -28 -30 -33 -36 -38 -43 -44 -46 -47 -51 -53 -56 -61 -65 -70 -71 -75 -77 -83 -84 -85 -87 -91 -93 -96 -97 -99 -109
Fix? yes
Free inodes count wrong for group #0 (1951, counted=1989).
Fix? yes
Directories count wrong for group #0 (41, counted=22).
Fix? yes
Free inodes count wrong (1951, counted=1989).
Fix? yes
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 59/2048 files (22.0% non-contiguous), 1982/8192 blocks
Exit status is 1

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: 59/2048 files (22.0% non-contiguous), 1982/8192 blocks
Exit status is 0

BIN
tests/f_badorphan/image.gz Normal file

Binary file not shown.

1
tests/f_badorphan/name Normal file
View File

@ -0,0 +1 @@
corrupted orphan list