diff options
author | Daniel Schultz <d.schultz@phytec.de> | 2017-04-05 14:48:57 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-08-29 16:50:52 +0100 |
commit | e6a1c94eef5fd6ce74806fe6bd64a05941add9cb (patch) | |
tree | 35430bff90583aa87e7eea0b31abe73d11245fb8 /meta/recipes-devtools | |
parent | 604b2b2c6c0a9c09098fccf958c94ea7ba8b082b (diff) | |
download | poky-e6a1c94eef5fd6ce74806fe6bd64a05941add9cb.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: 34ccb6b66162400c3a3164cbdcca02fc1b42c92b)
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r-- | meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-e2fsck-exit-with-exit-status-0-if-no-errors-were-fix.patch | 285 | ||||
-rw-r--r-- | meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb | 1 |
2 files changed, 286 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..44f3888b1c --- /dev/null +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-e2fsck-exit-with-exit-status-0-if-no-errors-were-fix.patch | |||
@@ -0,0 +1,285 @@ | |||
1 | From b9bb77a0dd712f06b262a12766972b99cd801269 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 | Conflicts: | ||
18 | e2fsck/e2fsck.conf.5.in | ||
19 | --- | ||
20 | e2fsck/e2fsck.conf.5.in | 34 +++++++++++++++++++++++++++++ | ||
21 | e2fsck/journal.c | 1 + | ||
22 | e2fsck/problem.c | 8 ++++--- | ||
23 | e2fsck/problemP.h | 1 + | ||
24 | e2fsck/unix.c | 20 +++++++++++++---- | ||
25 | tests/f_collapse_extent_tree/expect.1 | 2 +- | ||
26 | tests/f_compress_extent_tree_level/expect.1 | 2 +- | ||
27 | tests/f_convert_bmap/expect.1 | 2 +- | ||
28 | tests/f_convert_bmap_and_extent/expect.1 | 2 +- | ||
29 | tests/f_extent_htree/expect.1 | 2 +- | ||
30 | tests/f_jnl_errno/expect.1 | 2 +- | ||
31 | tests/f_journal/expect.1 | 2 +- | ||
32 | tests/f_orphan/expect.1 | 2 +- | ||
33 | tests/f_orphan_extents_inode/expect.1 | 2 +- | ||
34 | tests/f_rehash_dir/expect.1 | 2 +- | ||
35 | tests/f_unsorted_EAs/expect.1 | 2 +- | ||
36 | 16 files changed, 68 insertions(+), 18 deletions(-) | ||
37 | |||
38 | diff --git a/e2fsck/e2fsck.conf.5.in b/e2fsck/e2fsck.conf.5.in | ||
39 | index 1f80a04..6a205ce 100644 | ||
40 | --- a/e2fsck/e2fsck.conf.5.in | ||
41 | +++ b/e2fsck/e2fsck.conf.5.in | ||
42 | @@ -326,6 +326,40 @@ defaults to true. | ||
43 | This relation controls whether or not the scratch file directory is used | ||
44 | instead of an in-memory data structure when tracking inode counts. It | ||
45 | defaults to true. | ||
46 | +.TP | ||
47 | +.I not_a_fix | ||
48 | +This boolean option, it set to true, marks the problem as | ||
49 | +one where if the user gives permission to make the requested change, | ||
50 | +it does not mean that the file system had a problem which has since | ||
51 | +been fixed. This is used for requests to optimize the file system's | ||
52 | +data structure, such as pruning an extent tree. | ||
53 | +@TDB_MAN_COMMENT@.SH THE [scratch_files] STANZA | ||
54 | +@TDB_MAN_COMMENT@The following relations are defined in the | ||
55 | +@TDB_MAN_COMMENT@.I [scratch_files] | ||
56 | +@TDB_MAN_COMMENT@stanza. | ||
57 | +@TDB_MAN_COMMENT@.TP | ||
58 | +@TDB_MAN_COMMENT@.I directory | ||
59 | +@TDB_MAN_COMMENT@If the directory named by this relation exists and is | ||
60 | +@TDB_MAN_COMMENT@writeable, then e2fsck will attempt to use this | ||
61 | +@TDB_MAN_COMMENT@directory to store scratch files instead of using | ||
62 | +@TDB_MAN_COMMENT@in-memory data structures. | ||
63 | +@TDB_MAN_COMMENT@.TP | ||
64 | +@TDB_MAN_COMMENT@.I numdirs_threshold | ||
65 | +@TDB_MAN_COMMENT@If this relation is set, then in-memory data structures | ||
66 | +@TDB_MAN_COMMENT@be used if the number of directories in the filesystem | ||
67 | +@TDB_MAN_COMMENT@are fewer than amount specified. | ||
68 | +@TDB_MAN_COMMENT@.TP | ||
69 | +@TDB_MAN_COMMENT@.I dirinfo | ||
70 | +@TDB_MAN_COMMENT@This relation controls whether or not the scratch file | ||
71 | +@TDB_MAN_COMMENT@directory is used instead of an in-memory data | ||
72 | +@TDB_MAN_COMMENT@structure for directory information. It defaults to | ||
73 | +@TDB_MAN_COMMENT@true. | ||
74 | +@TDB_MAN_COMMENT@.TP | ||
75 | +@TDB_MAN_COMMENT@.I icount | ||
76 | +@TDB_MAN_COMMENT@This relation controls whether or not the scratch file | ||
77 | +@TDB_MAN_COMMENT@directory is used instead of an in-memory data | ||
78 | +@TDB_MAN_COMMENT@structure when tracking inode counts. It defaults to | ||
79 | +@TDB_MAN_COMMENT@true. | ||
80 | .SH LOGGING | ||
81 | E2fsck has the facility to save the information from an e2fsck run in a | ||
82 | directory so that a system administrator can review its output at their | ||
83 | diff --git a/e2fsck/journal.c b/e2fsck/journal.c | ||
84 | index c8ac57d..b4cf329 100644 | ||
85 | --- a/e2fsck/journal.c | ||
86 | +++ b/e2fsck/journal.c | ||
87 | @@ -572,6 +572,7 @@ static void clear_v2_journal_fields(journal_t *journal) | ||
88 | if (!fix_problem(ctx, PR_0_CLEAR_V2_JOURNAL, &pctx)) | ||
89 | return; | ||
90 | |||
91 | + ctx->flags |= E2F_FLAG_PROBLEMS_FIXED; | ||
92 | memset(((char *) journal->j_superblock) + V1_SB_SIZE, 0, | ||
93 | ctx->fs->blocksize-V1_SB_SIZE); | ||
94 | mark_buffer_dirty(journal->j_sb_buffer); | ||
95 | diff --git a/e2fsck/problem.c b/e2fsck/problem.c | ||
96 | index 1e645e4..2b01ffc 100644 | ||
97 | --- a/e2fsck/problem.c | ||
98 | +++ b/e2fsck/problem.c | ||
99 | @@ -1261,12 +1261,12 @@ static struct e2fsck_problem problem_table[] = { | ||
100 | /* Inode extent tree could be shorter */ | ||
101 | { PR_1E_CAN_COLLAPSE_EXTENT_TREE, | ||
102 | N_("@i %i @x tree (at level %b) could be shorter. "), | ||
103 | - PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK }, | ||
104 | + PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK | PR_NOT_A_FIX }, | ||
105 | |||
106 | /* Inode extent tree could be narrower */ | ||
107 | { PR_1E_CAN_NARROW_EXTENT_TREE, | ||
108 | N_("@i %i @x tree (at level %b) could be narrower. "), | ||
109 | - PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK }, | ||
110 | + PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK | PR_NOT_A_FIX }, | ||
111 | |||
112 | /* Pass 2 errors */ | ||
113 | |||
114 | @@ -2146,6 +2146,7 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx) | ||
115 | reconfigure_bool(ctx, ptr, key, PR_NO_NOMSG, "no_nomsg"); | ||
116 | reconfigure_bool(ctx, ptr, key, PR_PREEN_NOHDR, "preen_noheader"); | ||
117 | reconfigure_bool(ctx, ptr, key, PR_FORCE_NO, "force_no"); | ||
118 | + reconfigure_bool(ctx, ptr, key, PR_NOT_A_FIX, "not_a_fix"); | ||
119 | profile_get_integer(ctx->profile, "options", | ||
120 | "max_count_problems", 0, 0, | ||
121 | &ptr->max_count); | ||
122 | @@ -2263,7 +2264,8 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx) | ||
123 | if (ptr->flags & PR_AFTER_CODE) | ||
124 | answer = fix_problem(ctx, ptr->second_code, pctx); | ||
125 | |||
126 | - if (answer && (ptr->prompt != PROMPT_NONE)) | ||
127 | + if (answer && (ptr->prompt != PROMPT_NONE) && | ||
128 | + !(ptr->flags & PR_NOT_A_FIX)) | ||
129 | ctx->flags |= E2F_FLAG_PROBLEMS_FIXED; | ||
130 | |||
131 | return answer; | ||
132 | diff --git a/e2fsck/problemP.h b/e2fsck/problemP.h | ||
133 | index 7944cd6..63bb8df 100644 | ||
134 | --- a/e2fsck/problemP.h | ||
135 | +++ b/e2fsck/problemP.h | ||
136 | @@ -44,3 +44,4 @@ struct latch_descr { | ||
137 | #define PR_CONFIG 0x080000 /* This problem has been customized | ||
138 | from the config file */ | ||
139 | #define PR_FORCE_NO 0x100000 /* Force the answer to be no */ | ||
140 | +#define PR_NOT_A_FIX 0x200000 /* Yes doesn't mean a problem was fixed */ | ||
141 | diff --git a/e2fsck/unix.c b/e2fsck/unix.c | ||
142 | index 004a6e5..d33d7fd 100644 | ||
143 | --- a/e2fsck/unix.c | ||
144 | +++ b/e2fsck/unix.c | ||
145 | @@ -1896,11 +1896,23 @@ no_journal: | ||
146 | fix_problem(ctx, PR_6_IO_FLUSH, &pctx); | ||
147 | |||
148 | if (was_changed) { | ||
149 | - exit_value |= FSCK_NONDESTRUCT; | ||
150 | - if (!(ctx->options & E2F_OPT_PREEN)) | ||
151 | - log_out(ctx, _("\n%s: ***** FILE SYSTEM WAS " | ||
152 | - "MODIFIED *****\n"), | ||
153 | + int fs_fixed = (ctx->flags & E2F_FLAG_PROBLEMS_FIXED); | ||
154 | + | ||
155 | + if (fs_fixed) | ||
156 | + exit_value |= FSCK_NONDESTRUCT; | ||
157 | + if (!(ctx->options & E2F_OPT_PREEN)) { | ||
158 | +#if 0 /* Do this later; it breaks too many tests' golden outputs */ | ||
159 | + log_out(ctx, fs_fixed ? | ||
160 | + _("\n%s: ***** FILE SYSTEM ERRORS " | ||
161 | + "CORRECTED *****\n") : | ||
162 | + _("%s: File system was modified.\n"), | ||
163 | ctx->device_name); | ||
164 | +#else | ||
165 | + log_out(ctx, | ||
166 | + _("\n%s: ***** FILE SYSTEM WAS MODIFIED *****\n"), | ||
167 | + ctx->device_name); | ||
168 | +#endif | ||
169 | + } | ||
170 | if (ctx->mount_flags & EXT2_MF_ISROOT) { | ||
171 | log_out(ctx, _("%s: ***** REBOOT SYSTEM *****\n"), | ||
172 | ctx->device_name); | ||
173 | diff --git a/tests/f_collapse_extent_tree/expect.1 b/tests/f_collapse_extent_tree/expect.1 | ||
174 | index e2eb65e..8165a58 100644 | ||
175 | --- a/tests/f_collapse_extent_tree/expect.1 | ||
176 | +++ b/tests/f_collapse_extent_tree/expect.1 | ||
177 | @@ -13,4 +13,4 @@ Pass 5: Checking group summary information | ||
178 | |||
179 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
180 | test_filesys: 12/128 files (0.0% non-contiguous), 19/512 blocks | ||
181 | -Exit status is 1 | ||
182 | +Exit status is 0 | ||
183 | diff --git a/tests/f_compress_extent_tree_level/expect.1 b/tests/f_compress_extent_tree_level/expect.1 | ||
184 | index a359c99..dd33f63 100644 | ||
185 | --- a/tests/f_compress_extent_tree_level/expect.1 | ||
186 | +++ b/tests/f_compress_extent_tree_level/expect.1 | ||
187 | @@ -20,4 +20,4 @@ Pass 5: Checking group summary information | ||
188 | |||
189 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
190 | test_filesys: 12/128 files (8.3% non-contiguous), 26/512 blocks | ||
191 | -Exit status is 1 | ||
192 | +Exit status is 0 | ||
193 | diff --git a/tests/f_convert_bmap/expect.1 b/tests/f_convert_bmap/expect.1 | ||
194 | index 7d2ca86..c387962 100644 | ||
195 | --- a/tests/f_convert_bmap/expect.1 | ||
196 | +++ b/tests/f_convert_bmap/expect.1 | ||
197 | @@ -23,4 +23,4 @@ Pass 5: Checking group summary information | ||
198 | |||
199 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
200 | test_filesys: 12/128 files (8.3% non-contiguous), 570/2048 blocks | ||
201 | -Exit status is 1 | ||
202 | +Exit status is 0 | ||
203 | diff --git a/tests/f_convert_bmap_and_extent/expect.1 b/tests/f_convert_bmap_and_extent/expect.1 | ||
204 | index 7af91aa..c86c571 100644 | ||
205 | --- a/tests/f_convert_bmap_and_extent/expect.1 | ||
206 | +++ b/tests/f_convert_bmap_and_extent/expect.1 | ||
207 | @@ -30,4 +30,4 @@ Pass 5: Checking group summary information | ||
208 | |||
209 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
210 | test_filesys: 13/128 files (15.4% non-contiguous), 574/2048 blocks | ||
211 | -Exit status is 1 | ||
212 | +Exit status is 0 | ||
213 | diff --git a/tests/f_extent_htree/expect.1 b/tests/f_extent_htree/expect.1 | ||
214 | index 223ca69..ea48405 100644 | ||
215 | --- a/tests/f_extent_htree/expect.1 | ||
216 | +++ b/tests/f_extent_htree/expect.1 | ||
217 | @@ -26,4 +26,4 @@ test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
218 | 0 sockets | ||
219 | ------------ | ||
220 | 343 files | ||
221 | -Exit status is 1 | ||
222 | +Exit status is 0 | ||
223 | diff --git a/tests/f_jnl_errno/expect.1 b/tests/f_jnl_errno/expect.1 | ||
224 | index c572951..4134234 100644 | ||
225 | --- a/tests/f_jnl_errno/expect.1 | ||
226 | +++ b/tests/f_jnl_errno/expect.1 | ||
227 | @@ -6,4 +6,4 @@ Pass 5: Checking group summary information | ||
228 | |||
229 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
230 | test_filesys: 11/2048 files (9.1% non-contiguous), 1330/8192 blocks | ||
231 | -Exit status is 1 | ||
232 | +Exit status is 0 | ||
233 | diff --git a/tests/f_journal/expect.1 b/tests/f_journal/expect.1 | ||
234 | index a202c80..0a18654 100644 | ||
235 | --- a/tests/f_journal/expect.1 | ||
236 | +++ b/tests/f_journal/expect.1 | ||
237 | @@ -59,4 +59,4 @@ Pass 5: Checking group summary information | ||
238 | |||
239 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
240 | test_filesys: 53/2048 files (1.9% non-contiguous), 1409/8192 blocks | ||
241 | -Exit status is 1 | ||
242 | +Exit status is 0 | ||
243 | diff --git a/tests/f_orphan/expect.1 b/tests/f_orphan/expect.1 | ||
244 | index eddc1f8..087ebee 100644 | ||
245 | --- a/tests/f_orphan/expect.1 | ||
246 | +++ b/tests/f_orphan/expect.1 | ||
247 | @@ -11,4 +11,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), 1303/8192 blocks | ||
251 | -Exit status is 1 | ||
252 | +Exit status is 0 | ||
253 | diff --git a/tests/f_orphan_extents_inode/expect.1 b/tests/f_orphan_extents_inode/expect.1 | ||
254 | index 2eaab78..5d713b3 100644 | ||
255 | --- a/tests/f_orphan_extents_inode/expect.1 | ||
256 | +++ b/tests/f_orphan_extents_inode/expect.1 | ||
257 | @@ -7,4 +7,4 @@ Pass 5: Checking group summary information | ||
258 | |||
259 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
260 | test_filesys: 12/16 files (0.0% non-contiguous), 21/100 blocks | ||
261 | -Exit status is 1 | ||
262 | +Exit status is 0 | ||
263 | diff --git a/tests/f_rehash_dir/expect.1 b/tests/f_rehash_dir/expect.1 | ||
264 | index 6076765..c1449ba 100644 | ||
265 | --- a/tests/f_rehash_dir/expect.1 | ||
266 | +++ b/tests/f_rehash_dir/expect.1 | ||
267 | @@ -7,4 +7,4 @@ Pass 5: Checking group summary information | ||
268 | |||
269 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
270 | test_filesys: 105/2048 files (2.9% non-contiguous), 336/512 blocks | ||
271 | -Exit status is 1 | ||
272 | +Exit status is 0 | ||
273 | diff --git a/tests/f_unsorted_EAs/expect.1 b/tests/f_unsorted_EAs/expect.1 | ||
274 | index 7d588d7..64b9045 100644 | ||
275 | --- a/tests/f_unsorted_EAs/expect.1 | ||
276 | +++ b/tests/f_unsorted_EAs/expect.1 | ||
277 | @@ -8,4 +8,4 @@ Pass 5: Checking group summary information | ||
278 | |||
279 | test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** | ||
280 | test_filesys: 12/2048 files (0.0% non-contiguous), 1294/2048 blocks | ||
281 | -Exit status is 1 | ||
282 | +Exit status is 0 | ||
283 | -- | ||
284 | 1.9.1 | ||
285 | |||
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb index 5e30ec90b0..dcfb564a4b 100644 --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb | |||
@@ -10,6 +10,7 @@ SRC_URI += "file://acinclude.m4 \ | |||
10 | file://mkdir.patch \ | 10 | file://mkdir.patch \ |
11 | file://Revert-mke2fs-enable-the-metadata_csum-and-64bit-fea.patch \ | 11 | file://Revert-mke2fs-enable-the-metadata_csum-and-64bit-fea.patch \ |
12 | file://mkdir_p.patch \ | 12 | file://mkdir_p.patch \ |
13 | file://0001-e2fsck-exit-with-exit-status-0-if-no-errors-were-fix.patch \ | ||
13 | " | 14 | " |
14 | 15 | ||
15 | SRC_URI_append_class-native = " file://e2fsprogs-fix-missing-check-for-permission-denied.patch" | 16 | SRC_URI_append_class-native = " file://e2fsprogs-fix-missing-check-for-permission-denied.patch" |