summaryrefslogtreecommitdiff
path: root/e2fsck/pass3.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2014-08-02 22:18:30 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-08-02 22:18:30 -0400
commit0991896720917b467e573a5fae38539d950d0617 (patch)
tree4f988a96654147b502ebbe0c796c503c83e7b4d4 /e2fsck/pass3.c
parent409f3884b54092c4b160e33d731b2218e48dbec3 (diff)
downloade2fsprogs-0991896720917b467e573a5fae38539d950d0617.tar.gz
e2fsck: use root dir for lost+found when really desperate
If we're totally unable to allocate a lost+found directory, ask the user if he would like to dump orphaned files in the root directory. Hopefully this enables the user to delete enough files so that a subsequent run of e2fsck will make more progress. Better to cram lost files in the rootdir than the current behavior, which is to fail at linking them in, thereby leaving them as lost files. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'e2fsck/pass3.c')
-rw-r--r--e2fsck/pass3.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/e2fsck/pass3.c b/e2fsck/pass3.c
index 31131ab5..e6142ad5 100644
--- a/e2fsck/pass3.c
+++ b/e2fsck/pass3.c
@@ -450,6 +450,12 @@ unlink:
goto skip_new_block;
}
retval = ext2fs_new_block2(fs, 0, ctx->block_found_map, &blk);
+ if (retval == EXT2_ET_BLOCK_ALLOC_FAIL &&
+ fix_problem(ctx, PR_3_LPF_NO_SPACE, &pctx)) {
+ printf("Delete some files and re-run e2fsck.\n\n");
+ ctx->lost_and_found = EXT2_ROOT_INO;
+ return 0;
+ }
if (retval) {
pctx.errcode = retval;
fix_problem(ctx, PR_3_ERR_LPF_NEW_BLOCK, &pctx);
@@ -464,6 +470,12 @@ skip_new_block:
*/
retval = ext2fs_new_inode(fs, EXT2_ROOT_INO, 040700,
ctx->inode_used_map, &ino);
+ if (retval == EXT2_ET_INODE_ALLOC_FAIL &&
+ fix_problem(ctx, PR_3_LPF_NO_SPACE, &pctx)) {
+ printf("Delete some files and re-run e2fsck.\n\n");
+ ctx->lost_and_found = EXT2_ROOT_INO;
+ return 0;
+ }
if (retval) {
pctx.errcode = retval;
fix_problem(ctx, PR_3_ERR_LPF_NEW_INODE, &pctx);