summaryrefslogtreecommitdiff
path: root/e2fsck
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2014-07-18 15:55:21 -0700
committerTheodore Ts'o <tytso@mit.edu>2014-07-25 08:50:23 -0400
commit57b7fabc2e06e145811977b88b46239267bbd1e6 (patch)
tree94a96b5f55314d1b1897be74f00c8e1c4dc16f7a /e2fsck
parentc28c2741ba5af0fde93b50f992c525fea5b05cf6 (diff)
downloade2fsprogs-57b7fabc2e06e145811977b88b46239267bbd1e6.tar.gz
e2fsck: clear uninit flag on directory extents
Directories can't have uninitialized extents, so offer to clear the uninit flag when we find this situation. The actual directory blocks will be checked in pass 2 and 3 regardless of the uninit flag. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'e2fsck')
-rw-r--r--e2fsck/pass1.c15
-rw-r--r--e2fsck/problem.c5
-rw-r--r--e2fsck/problem.h19
3 files changed, 36 insertions, 3 deletions
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index e05bf6f9..dc15db29 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -1806,6 +1806,21 @@ static void scan_extent_node(e2fsck_t ctx, struct problem_context *pctx,
(1 << (21 - ctx->fs->super->s_log_block_size))))
problem = PR_1_TOOBIG_DIR;
+ /*
+ * Uninitialized blocks in a directory? Clear the flag and
+ * we'll interpret the blocks later.
+ */
+ if (is_dir && problem == 0 &&
+ (extent.e_flags & EXT2_EXTENT_FLAGS_UNINIT) &&
+ fix_problem(ctx, PR_1_UNINIT_DBLOCK, pctx)) {
+ extent.e_flags &= ~EXT2_EXTENT_FLAGS_UNINIT;
+ pb->inode_modified = 1;
+ pctx->errcode = ext2fs_extent_replace(ehandle, 0,
+ &extent);
+ if (pctx->errcode)
+ return;
+ }
+
if (problem) {
report_problem:
pctx->blk = extent.e_pblk;
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index 837d1110..a7291e55 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -972,6 +972,11 @@ static struct e2fsck_problem problem_table[] = {
N_("@d @i %i @b %b should be at @b %c. "),
PROMPT_FIX, 0 },
+ /* Extents/inlinedata flag set on a device or socket inode */
+ { PR_1_UNINIT_DBLOCK,
+ N_("@d @i %i has @x marked uninitialized at @b %c. "),
+ PROMPT_FIX, PR_PREEN_OK },
+
/* Pass 1b errors */
/* Pass 1B: Rescan for duplicate/bad blocks */
diff --git a/e2fsck/problem.h b/e2fsck/problem.h
index d3e66ad6..0a3347f9 100644
--- a/e2fsck/problem.h
+++ b/e2fsck/problem.h
@@ -565,6 +565,22 @@ struct problem_context {
#define PR_1_EXTENT_INDEX_START_INVALID 0x01006D
#define PR_1_EXTENT_END_OUT_OF_BOUNDS 0x01006E
+
+/* Inode has inline data, but superblock is missing INLINE_DATA feature. */
+#define PR_1_INLINE_DATA_FEATURE 0x01006F
+
+/* INLINE_DATA feature is set in a non-inline-data filesystem */
+#define PR_1_INLINE_DATA_SET 0x010070
+
+/* file metadata collides with critical metadata */
+#define PR_1_CRITICAL_METADATA_COLLISION 0x010071
+
+/* Directory inode has a missing block (hole) */
+#define PR_1_COLLAPSE_DBLOCK 0x010072
+
+/* uninit directory block */
+#define PR_1_UNINIT_DBLOCK 0x010073
+
/*
* Pass 1b errors
*/
@@ -624,9 +640,6 @@ struct problem_context {
/* Couldn't clone file (error) */
#define PR_1D_CLONE_ERROR 0x013008
-/* Directory inode has a missing block (hole) */
-#define PR_1_COLLAPSE_DBLOCK 0x010072
-
/*
* Pass 2 errors
*/