aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2017-02-28 01:21:49 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-02-28 01:21:49 +0000
commita9f981de18ca7c0d58f6c280f746aeb76dde776c (patch)
treef7e5b0394faab871be64d388ec50b77b9d3ebf38
parenta091d1cfbf342009be0de9f92e3905646a4683a2 (diff)
parentba0844f8c734aa33714ef5d7086b7f6de0943fc1 (diff)
downloade2fsprogs-a9f981de18ca7c0d58f6c280f746aeb76dde776c.tar.gz
Merge "e2fsck: exit with exit status 0 if no errors were fixed" am: 82f3d0584c
am: ba0844f8c7 Change-Id: I4f4faf0007fa8a59e447013d0d2c2323f5713d0d
-rw-r--r--e2fsck/e2fsck.conf.5.in7
-rw-r--r--e2fsck/journal.c1
-rw-r--r--e2fsck/problem.c8
-rw-r--r--e2fsck/problemP.h1
-rw-r--r--e2fsck/unix.c20
-rw-r--r--tests/f_collapse_extent_tree/expect.12
-rw-r--r--tests/f_compress_extent_tree_level/expect.12
-rw-r--r--tests/f_convert_bmap/expect.12
-rw-r--r--tests/f_convert_bmap_and_extent/expect.12
-rw-r--r--tests/f_extent_htree/expect.12
-rw-r--r--tests/f_jnl_errno/expect.12
-rw-r--r--tests/f_journal/expect.12
-rw-r--r--tests/f_orphan/expect.12
-rw-r--r--tests/f_orphan_extents_inode/expect.12
-rw-r--r--tests/f_rehash_dir/expect.12
-rw-r--r--tests/f_unsorted_EAs/expect.12
16 files changed, 41 insertions, 18 deletions
diff --git a/e2fsck/e2fsck.conf.5.in b/e2fsck/e2fsck.conf.5.in
index 1848bdb8..0bfc76ab 100644
--- a/e2fsck/e2fsck.conf.5.in
+++ b/e2fsck/e2fsck.conf.5.in
@@ -303,6 +303,13 @@ of 'should this problem be fixed?'. The
option even overrides the
.B -y
option given on the command-line (just for the specific problem, of course).
+.TP
+.I not_a_fix
+This boolean option, it set to true, marks the problem as
+one where if the user gives permission to make the requested change,
+it does not mean that the file system had a problem which has since
+been fixed. This is used for requests to optimize the file system's
+data structure, such as pruning an extent tree.
@TDB_MAN_COMMENT@.SH THE [scratch_files] STANZA
@TDB_MAN_COMMENT@The following relations are defined in the
@TDB_MAN_COMMENT@.I [scratch_files]
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index 46fe7b4c..c4f58f1b 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -572,6 +572,7 @@ static void clear_v2_journal_fields(journal_t *journal)
if (!fix_problem(ctx, PR_0_CLEAR_V2_JOURNAL, &pctx))
return;
+ ctx->flags |= E2F_FLAG_PROBLEMS_FIXED;
memset(((char *) journal->j_superblock) + V1_SB_SIZE, 0,
ctx->fs->blocksize-V1_SB_SIZE);
mark_buffer_dirty(journal->j_sb_buffer);
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index 34a671e5..4b250692 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -1276,12 +1276,12 @@ static struct e2fsck_problem problem_table[] = {
/* Inode extent tree could be shorter */
{ PR_1E_CAN_COLLAPSE_EXTENT_TREE,
N_("@i %i @x tree (at level %b) could be shorter. "),
- PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK },
+ PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK | PR_NOT_A_FIX },
/* Inode extent tree could be narrower */
{ PR_1E_CAN_NARROW_EXTENT_TREE,
N_("@i %i @x tree (at level %b) could be narrower. "),
- PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK },
+ PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK | PR_NOT_A_FIX },
/* Pass 2 errors */
@@ -2166,6 +2166,7 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
reconfigure_bool(ctx, ptr, key, PR_NO_NOMSG, "no_nomsg");
reconfigure_bool(ctx, ptr, key, PR_PREEN_NOHDR, "preen_noheader");
reconfigure_bool(ctx, ptr, key, PR_FORCE_NO, "force_no");
+ reconfigure_bool(ctx, ptr, key, PR_NOT_A_FIX, "not_a_fix");
profile_get_integer(ctx->profile, "options",
"max_count_problems", 0, 0,
&ptr->max_count);
@@ -2283,7 +2284,8 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
if (ptr->flags & PR_AFTER_CODE)
answer = fix_problem(ctx, ptr->second_code, pctx);
- if (answer && (ptr->prompt != PROMPT_NONE))
+ if (answer && (ptr->prompt != PROMPT_NONE) &&
+ !(ptr->flags & PR_NOT_A_FIX))
ctx->flags |= E2F_FLAG_PROBLEMS_FIXED;
return answer;
diff --git a/e2fsck/problemP.h b/e2fsck/problemP.h
index 7944cd6c..63bb8df6 100644
--- a/e2fsck/problemP.h
+++ b/e2fsck/problemP.h
@@ -44,3 +44,4 @@ struct latch_descr {
#define PR_CONFIG 0x080000 /* This problem has been customized
from the config file */
#define PR_FORCE_NO 0x100000 /* Force the answer to be no */
+#define PR_NOT_A_FIX 0x200000 /* Yes doesn't mean a problem was fixed */
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index e00fa166..6029cc34 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -1908,11 +1908,23 @@ no_journal:
fix_problem(ctx, PR_6_IO_FLUSH, &pctx);
if (was_changed) {
- exit_value |= FSCK_NONDESTRUCT;
- if (!(ctx->options & E2F_OPT_PREEN))
- log_out(ctx, _("\n%s: ***** FILE SYSTEM WAS "
- "MODIFIED *****\n"),
+ int fs_fixed = (ctx->flags & E2F_FLAG_PROBLEMS_FIXED);
+
+ if (fs_fixed)
+ exit_value |= FSCK_NONDESTRUCT;
+ if (!(ctx->options & E2F_OPT_PREEN)) {
+#if 0 /* Do this later; it breaks too many tests' golden outputs */
+ log_out(ctx, fs_fixed ?
+ _("\n%s: ***** FILE SYSTEM ERRORS "
+ "CORRECTED *****\n") :
+ _("%s: File system was modified.\n"),
ctx->device_name);
+#else
+ log_out(ctx,
+ _("\n%s: ***** FILE SYSTEM WAS MODIFIED *****\n"),
+ ctx->device_name);
+#endif
+ }
if (ctx->mount_flags & EXT2_MF_ISROOT) {
log_out(ctx, _("%s: ***** REBOOT SYSTEM *****\n"),
ctx->device_name);
diff --git a/tests/f_collapse_extent_tree/expect.1 b/tests/f_collapse_extent_tree/expect.1
index e2eb65e0..8165a589 100644
--- a/tests/f_collapse_extent_tree/expect.1
+++ b/tests/f_collapse_extent_tree/expect.1
@@ -13,4 +13,4 @@ Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 12/128 files (0.0% non-contiguous), 19/512 blocks
-Exit status is 1
+Exit status is 0
diff --git a/tests/f_compress_extent_tree_level/expect.1 b/tests/f_compress_extent_tree_level/expect.1
index a359c997..dd33f63d 100644
--- a/tests/f_compress_extent_tree_level/expect.1
+++ b/tests/f_compress_extent_tree_level/expect.1
@@ -20,4 +20,4 @@ Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 12/128 files (8.3% non-contiguous), 26/512 blocks
-Exit status is 1
+Exit status is 0
diff --git a/tests/f_convert_bmap/expect.1 b/tests/f_convert_bmap/expect.1
index 7d2ca86e..c387962f 100644
--- a/tests/f_convert_bmap/expect.1
+++ b/tests/f_convert_bmap/expect.1
@@ -23,4 +23,4 @@ Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 12/128 files (8.3% non-contiguous), 570/2048 blocks
-Exit status is 1
+Exit status is 0
diff --git a/tests/f_convert_bmap_and_extent/expect.1 b/tests/f_convert_bmap_and_extent/expect.1
index 7af91aa3..c86c5715 100644
--- a/tests/f_convert_bmap_and_extent/expect.1
+++ b/tests/f_convert_bmap_and_extent/expect.1
@@ -30,4 +30,4 @@ Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 13/128 files (15.4% non-contiguous), 574/2048 blocks
-Exit status is 1
+Exit status is 0
diff --git a/tests/f_extent_htree/expect.1 b/tests/f_extent_htree/expect.1
index 223ca697..ea484053 100644
--- a/tests/f_extent_htree/expect.1
+++ b/tests/f_extent_htree/expect.1
@@ -26,4 +26,4 @@ test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
0 sockets
------------
343 files
-Exit status is 1
+Exit status is 0
diff --git a/tests/f_jnl_errno/expect.1 b/tests/f_jnl_errno/expect.1
index c5729512..41342344 100644
--- a/tests/f_jnl_errno/expect.1
+++ b/tests/f_jnl_errno/expect.1
@@ -6,4 +6,4 @@ Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 11/2048 files (9.1% non-contiguous), 1330/8192 blocks
-Exit status is 1
+Exit status is 0
diff --git a/tests/f_journal/expect.1 b/tests/f_journal/expect.1
index a202c80c..0a18654d 100644
--- a/tests/f_journal/expect.1
+++ b/tests/f_journal/expect.1
@@ -59,4 +59,4 @@ Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 53/2048 files (1.9% non-contiguous), 1409/8192 blocks
-Exit status is 1
+Exit status is 0
diff --git a/tests/f_orphan/expect.1 b/tests/f_orphan/expect.1
index eddc1f8b..087ebee2 100644
--- a/tests/f_orphan/expect.1
+++ b/tests/f_orphan/expect.1
@@ -11,4 +11,4 @@ Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 12/2048 files (0.0% non-contiguous), 1303/8192 blocks
-Exit status is 1
+Exit status is 0
diff --git a/tests/f_orphan_extents_inode/expect.1 b/tests/f_orphan_extents_inode/expect.1
index 2eaab78a..5d713b36 100644
--- a/tests/f_orphan_extents_inode/expect.1
+++ b/tests/f_orphan_extents_inode/expect.1
@@ -7,4 +7,4 @@ Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 12/16 files (0.0% non-contiguous), 21/100 blocks
-Exit status is 1
+Exit status is 0
diff --git a/tests/f_rehash_dir/expect.1 b/tests/f_rehash_dir/expect.1
index 60767651..c1449ba0 100644
--- a/tests/f_rehash_dir/expect.1
+++ b/tests/f_rehash_dir/expect.1
@@ -7,4 +7,4 @@ Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 105/2048 files (2.9% non-contiguous), 336/512 blocks
-Exit status is 1
+Exit status is 0
diff --git a/tests/f_unsorted_EAs/expect.1 b/tests/f_unsorted_EAs/expect.1
index 7d588d7a..64b9045e 100644
--- a/tests/f_unsorted_EAs/expect.1
+++ b/tests/f_unsorted_EAs/expect.1
@@ -8,4 +8,4 @@ Pass 5: Checking group summary information
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 12/2048 files (0.0% non-contiguous), 1294/2048 blocks
-Exit status is 1
+Exit status is 0