diff options
author | Daniel Schultz <d.schultz@phytec.de> | 2017-03-20 13:18:51 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-22 11:35:21 +0000 |
commit | f38c551e6e890dd997aba96b4e43736798bd4424 (patch) | |
tree | c62c98bcb88768582a08240f378dbebae8829a73 /meta/recipes-devtools/e2fsprogs | |
parent | ab34d087727cc393fe276bfca64a2a6afd80eed2 (diff) | |
download | poky-f38c551e6e890dd997aba96b4e43736798bd4424.tar.gz |
e2fsprogs: Fix wrong error code after optimization
fsck.ext will return an error code of 1 if a file systems was checked
and successfully repaired. Even when an optimization was performed it
will return this error code.
This patch will change the error code to 0 if only optimizations had
changed the file systems.
The reason for this patch is a question I asked at the ext4 ML:
http://www.spinics.net/lists/linux-ext4/msg55700.html
Backport from git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
Based on commit bf9f3b6d5b10d19218b4ed904c12b22e36ec57dd
(From OE-Core rev: 8341ee45d721cf07b19d50c249bb3a77ef1bf100)
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/e2fsprogs')
-rw-r--r-- | meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-e2fsck-exit-with-exit-status-0-if-no-errors-were-fix.patch | 255 | ||||
-rw-r--r-- | meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.4.bb | 1 |
2 files changed, 256 insertions, 0 deletions
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-e2fsck-exit-with-exit-status-0-if-no-errors-were-fix.patch b/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-e2fsck-exit-with-exit-status-0-if-no-errors-were-fix.patch new file mode 100644 index 0000000000..1d17520252 --- /dev/null +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-e2fsck-exit-with-exit-status-0-if-no-errors-were-fix.patch | |||
@@ -0,0 +1,255 @@ | |||
1 | From bf9f3b6d5b10d19218b4ed904c12b22e36ec57dd Mon Sep 17 00:00:00 2001 | ||
2 | From: Theodore Ts'o <tytso@mit.edu> | ||
3 | Date: Thu, 16 Feb 2017 22:02:35 -0500 | ||
4 | Subject: [PATCH] e2fsck: exit with exit status 0 if no errors were fixed | ||
5 | |||
6 | Previously, e2fsck would exit with a status code of 1 even though the | ||
7 | only changes that it made to the file system were various | ||
8 | optimziations and not fixing file system corruption. Since the man | ||
9 | page states that an exit status of 1 means "file system errors | ||
10 | corrupted", fix e2fsck to return an exit status of 0. | ||
11 | |||
12 | Upstream-Status: Backport | ||
13 | |||
14 | Signed-off-by: Theodore Ts'o <tytso@mit.edu> | ||
15 | Signed-off-by: Daniel Schultz <d.schultz@phytec.de> | ||
16 | --- | ||
17 | e2fsck/e2fsck.conf.5.in | 7 +++++++ | ||
18 | e2fsck/journal.c | 1 + | ||
19 | e2fsck/problem.c | 8 +++++--- | ||
20 | e2fsck/problemP.h | 1 + | ||
21 | e2fsck/unix.c | 20 ++++++++++++++++---- | ||
22 | tests/f_collapse_extent_tree/expect.1 | 2 +- | ||
23 | tests/f_compress_extent_tree_level/expect.1 | 2 +- | ||
24 | tests/f_convert_bmap/expect.1 | 2 +- | ||
25 | tests/f_convert_bmap_and_extent/expect.1 | 2 +- | ||
26 | tests/f_extent_htree/expect.1 | 2 +- | ||
27 | tests/f_jnl_errno/expect.1 | 2 +- | ||
28 | tests/f_journal/expect.1 | 2 +- | ||
29 | tests/f_orphan/expect.1 | 2 +- | ||
30 | tests/f_orphan_extents_inode/expect.1 | 2 +- | ||
31 | tests/f_rehash_dir/expect.1 | 2 +- | ||
32 | tests/f_unsorted_EAs/expect.1 | 2 +- | ||
33 | 16 files changed, 41 insertions(+), 18 deletions(-) | ||
34 | |||
35 | diff --git a/e2fsck/e2fsck.conf.5.in b/e2fsck/e2fsck.conf.5.in | ||
36 | index 1848bdb..0bfc76a 100644 | ||
37 | --- a/e2fsck/e2fsck.conf.5.in | ||
38 | +++ b/e2fsck/e2fsck.conf.5.in | ||
39 | @@ -303,6 +303,13 @@ of 'should this problem be fixed?'. The | ||
40 | option even overrides the | ||
41 | .B -y | ||
42 | option given on the command-line (just for the specific problem, of course). | ||
43 | +.TP | ||
44 | +.I not_a_fix | ||
45 | +This boolean option, it set to true, marks the problem as | ||
46 | +one where if the user gives permission to make the requested change, | ||
47 | +it does not mean that the file system had a problem which has since | ||
48 | +been fixed. This is used for requests to optimize the file system's | ||
49 | +data structure, such as pruning an extent tree. | ||
50 | @TDB_MAN_COMMENT@.SH THE [scratch_files] STANZA | ||
51 | @TDB_MAN_COMMENT@The following relations are defined in the | ||
52 | @TDB_MAN_COMMENT@.I [scratch_files] | ||
53 | diff --git a/e2fsck/journal.c b/e2fsck/journal.c | ||
54 | index 46fe7b4..c4f58f1 100644 | ||
55 | --- a/e2fsck/journal.c | ||
56 | +++ b/e2fsck/journal.c | ||
57 | @@ -572,6 +572,7 @@ static void clear_v2_journal_fields(journal_t *journal) | ||
58 | if (!fix_problem(ctx, PR_0_CLEAR_V2_JOURNAL, &pctx)) | ||
59 | return; | ||
60 | |||
61 | + ctx->flags |= E2F_FLAG_PROBLEMS_FIXED; | ||
62 | memset(((char *) journal->j_superblock) + V1_SB_SIZE, 0, | ||
63 | ctx->fs->blocksize-V1_SB_SIZE); | ||
64 | mark_buffer_dirty(journal->j_sb_buffer); | ||
65 | diff --git a/e2fsck/problem.c b/e2fsck/problem.c | ||
66 | index 34a671e..4b25069 100644 | ||
67 | --- a/e2fsck/problem.c | ||
68 | +++ b/e2fsck/problem.c | ||
69 | @@ -1276,12 +1276,12 @@ static struct e2fsck_problem problem_table[] = { | ||
70 | /* Inode extent tree could be shorter */ | ||
71 | { PR_1E_CAN_COLLAPSE_EXTENT_TREE, | ||
72 | N_("@i %i @x tree (at level %b) could be shorter. "), | ||
73 | - PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK }, | ||
74 | + PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK | PR_NOT_A_FIX }, | ||
75 | |||
76 | /* Inode extent tree could be narrower */ | ||
77 | { PR_1E_CAN_NARROW_EXTENT_TREE, | ||
78 | N_("@i %i @x tree (at level %b) could be narrower. "), | ||
79 | - PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK }, | ||
80 | + PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK | PR_NOT_A_FIX }, | ||
81 | |||
82 | /* Pass 2 errors */ | ||
83 | |||
84 | @@ -2166,6 +2166,7 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx) | ||
85 | reconfigure_bool(ctx, ptr, key, PR_NO_NOMSG, "no_nomsg"); | ||
86 | reconfigure_bool(ctx, ptr, key, PR_PREEN_NOHDR, "preen_noheader"); | ||
87 | reconfigure_bool(ctx, ptr, key, PR_FORCE_NO, "force_no"); | ||
88 | + reconfigure_bool(ctx, ptr, key, PR_NOT_A_FIX, "not_a_fix"); | ||
89 | profile_get_integer(ctx->profile, "options", | ||
90 | "max_count_problems", 0, 0, | ||
91 | &ptr->max_count); | ||
92 | @@ -2283,7 +2284,8 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx) | ||
93 | if (ptr->flags & PR_AFTER_CODE) | ||
94 | answer = fix_problem(ctx, ptr->second_code, pctx); | ||
95 | |||
96 | - if (answer && (ptr->prompt != PROMPT_NONE)) | ||
97 | + if (answer && (ptr->prompt != PROMPT_NONE) && | ||
98 | + !(ptr->flags & PR_NOT_A_FIX)) | ||
99 | ctx->flags |= E2F_FLAG_PROBLEMS_FIXED; | ||
100 | |||
101 | return answer; | ||
102 | diff --git a/e2fsck/problemP.h b/e2fsck/problemP.h | ||
103 | index 7944cd6..63bb8df 100644 | ||
104 | --- a/e2fsck/problemP.h | ||
105 | +++ b/e2fsck/problemP.h | ||
106 | @@ -44,3 +44,4 @@ struct latch_descr { | ||
107 | #define PR_CONFIG 0x080000 /* This problem has been customized | ||
108 | from the config file */ | ||
109 | #define PR_FORCE_NO 0x100000 /* Force the answer to be no */ | ||
110 | +#define PR_NOT_A_FIX 0x200000 /* Yes doesn't mean a problem was fixed */ | ||
111 | diff --git a/e2fsck/unix.c b/e2fsck/unix.c | ||
112 | index eb9f311..9e4d31a 100644 | ||
113 | --- a/e2fsck/unix.c | ||
114 | +++ b/e2fsck/unix.c | ||
115 | @@ -1901,11 +1901,23 @@ no_journal: | ||
116 | fix_problem(ctx, PR_6_IO_FLUSH, &pctx); | ||
117 | |||
118 | if (was_changed) { | ||
119 | - exit_value |= FSCK_NONDESTRUCT; | ||
120 | - if (!(ctx->options & E2F_OPT_PREEN)) | ||
121 | - log_out(ctx, _("\n%s: ***** FILE SYSTEM WAS " | ||
122 | - "MODIFIED *****\n"), | ||
123 | + int fs_fixed = (ctx->flags & E2F_FLAG_PROBLEMS_FIXED); | ||
124 | + | ||
125 | + if (fs_fixed) | ||
126 | + exit_value |= FSCK_NONDESTRUCT; | ||
127 | + if (!(ctx->options & E2F_OPT_PREEN)) { | ||
128 | +#if 0 /* Do this later; it breaks too many tests' golden outputs */ | ||
129 | + log_out(ctx, fs_fixed ? | ||
130 | + _("\n%s: ***** FILE SYSTEM ERRORS " | ||
131 | + "CORRECTED *****\n") : | ||
132 | + _("%s: File system was modified.\n"), | ||
133 | ctx->device_name); | ||
134 | +#else | ||
135 | + log_out(ctx, | ||
136 | + _("\n%s: ***** FILE SYSTEM WAS MODIFIED *****\n"), | ||
137 | + ctx->device_name); | ||
138 | +#endif | ||
139 | + } | ||
140 | if (ctx->mount_flags & EXT2_MF_ISROOT) { | ||
141 | log_out(ctx, _("%s: ***** REBOOT SYSTEM *****\n"), | ||
142 | ctx->device_name); | ||
143 | diff --git a/tests/f_collapse_extent_tree/expect.1 b/tests/f_collapse_extent_tree/expect.1 | ||
144 | index e2eb65e..8165a58 100644 | ||
145 | --- a/tests/f_collapse_extent_tree/expect.1 | ||
146 | +++ b/tests/f_collapse_extent_tree/expect.1 | ||
147 | @@ -13,4 +13,4 @@ Pass 5: Checking group summary information | ||
148 | |||
149 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
150 | test_filesys: 12/128 files (0.0% non-contiguous), 19/512 blocks | ||
151 | -Exit status is 1 | ||
152 | +Exit status is 0 | ||
153 | diff --git a/tests/f_compress_extent_tree_level/expect.1 b/tests/f_compress_extent_tree_level/expect.1 | ||
154 | index a359c99..dd33f63 100644 | ||
155 | --- a/tests/f_compress_extent_tree_level/expect.1 | ||
156 | +++ b/tests/f_compress_extent_tree_level/expect.1 | ||
157 | @@ -20,4 +20,4 @@ Pass 5: Checking group summary information | ||
158 | |||
159 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
160 | test_filesys: 12/128 files (8.3% non-contiguous), 26/512 blocks | ||
161 | -Exit status is 1 | ||
162 | +Exit status is 0 | ||
163 | diff --git a/tests/f_convert_bmap/expect.1 b/tests/f_convert_bmap/expect.1 | ||
164 | index 7d2ca86..c387962 100644 | ||
165 | --- a/tests/f_convert_bmap/expect.1 | ||
166 | +++ b/tests/f_convert_bmap/expect.1 | ||
167 | @@ -23,4 +23,4 @@ Pass 5: Checking group summary information | ||
168 | |||
169 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
170 | test_filesys: 12/128 files (8.3% non-contiguous), 570/2048 blocks | ||
171 | -Exit status is 1 | ||
172 | +Exit status is 0 | ||
173 | diff --git a/tests/f_convert_bmap_and_extent/expect.1 b/tests/f_convert_bmap_and_extent/expect.1 | ||
174 | index 7af91aa..c86c571 100644 | ||
175 | --- a/tests/f_convert_bmap_and_extent/expect.1 | ||
176 | +++ b/tests/f_convert_bmap_and_extent/expect.1 | ||
177 | @@ -30,4 +30,4 @@ Pass 5: Checking group summary information | ||
178 | |||
179 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
180 | test_filesys: 13/128 files (15.4% non-contiguous), 574/2048 blocks | ||
181 | -Exit status is 1 | ||
182 | +Exit status is 0 | ||
183 | diff --git a/tests/f_extent_htree/expect.1 b/tests/f_extent_htree/expect.1 | ||
184 | index 223ca69..ea48405 100644 | ||
185 | --- a/tests/f_extent_htree/expect.1 | ||
186 | +++ b/tests/f_extent_htree/expect.1 | ||
187 | @@ -26,4 +26,4 @@ test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
188 | 0 sockets | ||
189 | ------------ | ||
190 | 343 files | ||
191 | -Exit status is 1 | ||
192 | +Exit status is 0 | ||
193 | diff --git a/tests/f_jnl_errno/expect.1 b/tests/f_jnl_errno/expect.1 | ||
194 | index c572951..4134234 100644 | ||
195 | --- a/tests/f_jnl_errno/expect.1 | ||
196 | +++ b/tests/f_jnl_errno/expect.1 | ||
197 | @@ -6,4 +6,4 @@ Pass 5: Checking group summary information | ||
198 | |||
199 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
200 | test_filesys: 11/2048 files (9.1% non-contiguous), 1330/8192 blocks | ||
201 | -Exit status is 1 | ||
202 | +Exit status is 0 | ||
203 | diff --git a/tests/f_journal/expect.1 b/tests/f_journal/expect.1 | ||
204 | index a202c80..0a18654 100644 | ||
205 | --- a/tests/f_journal/expect.1 | ||
206 | +++ b/tests/f_journal/expect.1 | ||
207 | @@ -59,4 +59,4 @@ Pass 5: Checking group summary information | ||
208 | |||
209 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
210 | test_filesys: 53/2048 files (1.9% non-contiguous), 1409/8192 blocks | ||
211 | -Exit status is 1 | ||
212 | +Exit status is 0 | ||
213 | diff --git a/tests/f_orphan/expect.1 b/tests/f_orphan/expect.1 | ||
214 | index eddc1f8..087ebee 100644 | ||
215 | --- a/tests/f_orphan/expect.1 | ||
216 | +++ b/tests/f_orphan/expect.1 | ||
217 | @@ -11,4 +11,4 @@ Pass 5: Checking group summary information | ||
218 | |||
219 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
220 | test_filesys: 12/2048 files (0.0% non-contiguous), 1303/8192 blocks | ||
221 | -Exit status is 1 | ||
222 | +Exit status is 0 | ||
223 | diff --git a/tests/f_orphan_extents_inode/expect.1 b/tests/f_orphan_extents_inode/expect.1 | ||
224 | index 2eaab78..5d713b3 100644 | ||
225 | --- a/tests/f_orphan_extents_inode/expect.1 | ||
226 | +++ b/tests/f_orphan_extents_inode/expect.1 | ||
227 | @@ -7,4 +7,4 @@ Pass 5: Checking group summary information | ||
228 | |||
229 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
230 | test_filesys: 12/16 files (0.0% non-contiguous), 21/100 blocks | ||
231 | -Exit status is 1 | ||
232 | +Exit status is 0 | ||
233 | diff --git a/tests/f_rehash_dir/expect.1 b/tests/f_rehash_dir/expect.1 | ||
234 | index 6076765..c1449ba 100644 | ||
235 | --- a/tests/f_rehash_dir/expect.1 | ||
236 | +++ b/tests/f_rehash_dir/expect.1 | ||
237 | @@ -7,4 +7,4 @@ Pass 5: Checking group summary information | ||
238 | |||
239 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
240 | test_filesys: 105/2048 files (2.9% non-contiguous), 336/512 blocks | ||
241 | -Exit status is 1 | ||
242 | +Exit status is 0 | ||
243 | diff --git a/tests/f_unsorted_EAs/expect.1 b/tests/f_unsorted_EAs/expect.1 | ||
244 | index 7d588d7..64b9045 100644 | ||
245 | --- a/tests/f_unsorted_EAs/expect.1 | ||
246 | +++ b/tests/f_unsorted_EAs/expect.1 | ||
247 | @@ -8,4 +8,4 @@ Pass 5: Checking group summary information | ||
248 | |||
249 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
250 | test_filesys: 12/2048 files (0.0% non-contiguous), 1294/2048 blocks | ||
251 | -Exit status is 1 | ||
252 | +Exit status is 0 | ||
253 | -- | ||
254 | 1.9.1 | ||
255 | |||
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.4.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.4.bb index 153b3a15ce..5216c7027c 100644 --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.4.bb +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.4.bb | |||
@@ -9,6 +9,7 @@ SRC_URI += "file://acinclude.m4 \ | |||
9 | file://Revert-mke2fs-enable-the-metadata_csum-and-64bit-fea.patch \ | 9 | file://Revert-mke2fs-enable-the-metadata_csum-and-64bit-fea.patch \ |
10 | file://e2fsprogs-1.43-sysmacros.patch \ | 10 | file://e2fsprogs-1.43-sysmacros.patch \ |
11 | file://mkdir_p.patch \ | 11 | file://mkdir_p.patch \ |
12 | file://0001-e2fsck-exit-with-exit-status-0-if-no-errors-were-fix.patch \ | ||
12 | " | 13 | " |
13 | 14 | ||
14 | SRC_URI_append_class-native = " file://e2fsprogs-fix-missing-check-for-permission-denied.patch" | 15 | SRC_URI_append_class-native = " file://e2fsprogs-fix-missing-check-for-permission-denied.patch" |