Whamcloud - gitweb
e2fsck: check inline_data in pass3
authorZheng Liu <wenqing.lz@taobao.com>
Mon, 3 Mar 2014 06:02:52 +0000 (01:02 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 4 Mar 2014 13:46:15 +0000 (08:46 -0500)
In e2fsck_expand_directory() we don't handle a dir with inline data
because when this function is called the directory inode shouldn't
contains inline data.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
e2fsck/pass3.c
e2fsck/problem.c
e2fsck/problem.h
e2fsck/rehash.c

index aaf177c..6f7f855 100644 (file)
@@ -376,6 +376,17 @@ ext2_ino_t e2fsck_get_lost_and_found(e2fsck_t ctx, int fix)
        if (retval && !fix)
                return 0;
        if (!retval) {
+               /* Lost+found shouldn't have inline data */
+               retval = ext2fs_read_inode(fs, ino, &inode);
+               if (fix && retval)
+                       return 0;
+
+               if (fix && (inode.i_flags & EXT4_INLINE_DATA_FL)) {
+                       if (!fix_problem(ctx, PR_3_LPF_INLINE_DATA, &pctx))
+                               return 0;
+                       goto unlink;
+               }
+
                if (ext2fs_check_directory(fs, ino) == 0) {
                        ctx->lost_and_found = ino;
                        return ino;
@@ -388,6 +399,7 @@ ext2_ino_t e2fsck_get_lost_and_found(e2fsck_t ctx, int fix)
                if (!fix_problem(ctx, PR_3_LPF_NOTDIR, &pctx))
                        return 0;
 
+unlink:
                /* OK, unlink the old /lost+found file. */
                pctx.errcode = ext2fs_unlink(fs, EXT2_ROOT_INO, name, ino, 0);
                if (pctx.errcode) {
index dbbbe99..1282858 100644 (file)
@@ -1599,6 +1599,11 @@ static struct e2fsck_problem problem_table[] = {
          N_("/@l is not a @d (ino=%i)\n"),
          PROMPT_UNLINK, 0 },
 
+       /* Lost+found has inline data */
+       { PR_3_LPF_INLINE_DATA,
+         N_("/@l has inline data\n"),
+         PROMPT_CLEAR, 0 },
+
        /* Pass 3A Directory Optimization       */
 
        /* Pass 3A: Optimizing directories */
index 52c9898..61cbbef 100644 (file)
@@ -955,6 +955,9 @@ struct problem_context {
 /* Lost+found is not a directory */
 #define PR_3_LPF_NOTDIR                        0x030017
 
+/* Lost+found has inline data */
+#define PR_3_LPF_INLINE_DATA           0x030018
+
 /*
  * Pass 3a --- rehashing diretories
  */
index 9b90353..8a99453 100644 (file)
@@ -822,6 +822,8 @@ retry_nohash:
        /* Read in the entire directory into memory */
        retval = ext2fs_block_iterate3(fs, ino, 0, 0,
                                       fill_dir_block, &fd);
+       if (retval == EXT2_ET_INLINE_DATA_CANT_ITERATE)
+               goto errout;
        if (fd.err) {
                retval = fd.err;
                goto errout;