iter = e2fsck_dir_info_iter_begin(ctx);
while ((dir = e2fsck_dir_info_iter(ctx, iter)) != 0) {
- if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
+ if (ctx->flags & E2F_FLAG_SIGNAL_MASK ||
+ ctx->flags & E2F_FLAG_RESTART)
goto abort_exit;
if (ctx->progress && (ctx->progress)(ctx, 3, count++, maxdirs))
goto abort_exit;
goto unlink;
}
+ if (fix && (inode.i_flags & EXT4_ENCRYPT_FL)) {
+ if (!fix_problem(ctx, PR_3_LPF_ENCRYPTED, &pctx))
+ return 0;
+ goto unlink;
+ }
+
if (ext2fs_check_directory(fs, ino) == 0) {
ctx->lost_and_found = ino;
return ino;
}
(void) e2fsck_dir_info_set_parent(ctx, ino, 0);
e2fsck_adjust_inode_count(ctx, ino, -1);
+ /*
+ * If the old lost+found was a directory, we've just
+ * disconnected it from the directory tree, which
+ * means we need to restart the directory tree scan.
+ * The simplest way to do this is restart the whole
+ * e2fsck operation.
+ */
+ if (LINUX_S_ISDIR(inode.i_mode))
+ ctx->flags |= E2F_FLAG_RESTART;
} else if (retval != EXT2_ET_FILE_NOT_FOUND) {
pctx.errcode = retval;
fix_problem(ctx, PR_3_ERR_FIND_LPF, &pctx);
N_("Insufficient space to recover lost files!\nMove data off the @f and re-run e2fsck.\n\n"),
PROMPT_NONE, 0 },
+ /* Lost+found is encrypted */
+ { PR_3_LPF_ENCRYPTED,
+ N_("/@l is encrypted\n"),
+ PROMPT_CLEAR, 0 },
+
/* Pass 3A Directory Optimization */
/* Pass 3A: Optimizing directories */
/* Insufficient space to recover lost files */
#define PR_3_NO_SPACE_TO_RECOVER 0x03001A
+/* Lost+found is encrypted */
+#define PR_3_LPF_ENCRYPTED 0x03001B
+
/*
* Pass 3a --- rehashing diretories
*/
--- /dev/null
+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 is encrypted
+Clear? yes
+
+/lost+found not found. Create? yes
+
+Restarting e2fsck from the beginning...
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Unconnected directory inode 11 (/???)
+Connect to /lost+found? yes
+
+Pass 3A: Optimizing directories
+Pass 4: Checking reference counts
+Inode 12 ref count is 3, should be 2. Fix? yes
+
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 13/64 files (0.0% non-contiguous), 13/100 blocks
+Exit status is 1
--- /dev/null
+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/64 files (0.0% non-contiguous), 13/100 blocks
+Exit status is 0
--- /dev/null
+encrypted lost+found directory