summaryrefslogtreecommitdiffstats
path: root/e2fsprogs-1.41.9-broken_system_clock.patch
blob: d3ee5c4a43d8cacbbf103d27abbd242fc2953794 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
From: Theodore Ts'o <tytso@mit.edu>
Date: Mon, 4 Jan 2010 18:59:04 +0000 (-0500)
Subject: e2fsck: Add new e2fsck.conf option: broken_system_clock
X-Git-Tag: v1.41.10~5
X-Git-Url: http://git.kernel.org/?p=fs%2Fext2%2Fe2fsprogs.git;a=commitdiff_plain;h=c70674387ee0c038bca16098f7869181beeabe0a

e2fsck: Add new e2fsck.conf option: broken_system_clock

The broken_system_clock allows the time to be in the future when in
preen mode.  It's useful for people who have, as the name implies,
broken system clocks.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---

diff --git a/e2fsck/e2fsck.conf.5.in b/e2fsck/e2fsck.conf.5.in
index a5021bd..64aafd7 100644
--- a/e2fsck/e2fsck.conf.5.in
+++ b/e2fsck/e2fsck.conf.5.in
@@ -109,6 +109,19 @@ This can be disabled by setting
 to the
 boolean value of false.  This setting defaults to true.
 .TP
+.I broken_system_clock
+The
+.BR e2fsck (8)
+program has some hueristics that assume that the system clock is
+correct.  In addition, many system programs make similar assumptions.
+For example, the UUID library depends on time not going backwards in
+order for it to be able to make its guarantees about issuing universally
+unique ID's.  Systems with broken system clocks, are well, broken.
+However, broken system clocks, particularly in embedded systems, do
+exist.  If true, e2fsck will not abort a preen check if it detects a
+last mounted or last write time in the superblock in the future.  This
+setting defaults to false.
+.TP
 .I clear_test_fs_flag
 This boolean relation controls whether or not 
 .BR e2fsck (8)
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index a713f1b..9043281 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -1741,7 +1741,7 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
 	struct e2fsck_problem *ptr;
 	struct latch_descr *ldesc = 0;
 	const char *message;
-	int		def_yn, answer, ans;
+	int		def_yn, answer, ans, broken_system_clock;
 	int		print_answer = 0;
 	int		suppress = 0;
 
@@ -1753,6 +1753,15 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
 	if (!(ptr->flags & PR_CONFIG)) {
 		char	key[9], *new_desc;
 
+		if ((code == PR_0_FUTURE_SB_LAST_MOUNT) ||
+		    (code == PR_0_FUTURE_SB_LAST_WRITE)) {
+			profile_get_boolean(ctx->profile, "options",
+					    "broken_system_clock", 0, 0,
+					    &broken_system_clock);
+			if (broken_system_clock)
+				ptr->flags |= PR_PREEN_OK;
+		}
+
 		sprintf(key, "0x%06x", code);
 
 		profile_get_string(ctx->profile, "problems", key,