diff mbox series

e2fsck: warn if checkinterval and broken_system_clock both set

Message ID 6e050ac3-443f-a38b-8831-92ca6ac2a240@redhat.com
State Accepted, archived
Headers show
Series e2fsck: warn if checkinterval and broken_system_clock both set | expand

Commit Message

Eric Sandeen March 30, 2018, 3:31 p.m. UTC
If broken_system_clock is set in e2fsck.conf and this causes
the check interval to be ignored, make that clear to the user:

# e2fsck /dev/sda1 
e2fsck 1.44.1 (24-Mar-2018)
/dev/sda1: ignoring check interval, broken_system_clock set
/dev/sda1: clean, 11/65536 files, 12955/262144 blocks

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

(I wasn't sure, maybe this test should go outside all the reason-
setting, since this is a not-checking case?  But in the end it seemed
to make most sense along with all the other tests for these states.)

Comments

Lukas Czerner April 9, 2018, 2:34 p.m. UTC | #1
On Fri, Mar 30, 2018 at 10:31:37AM -0500, Eric Sandeen wrote:
> If broken_system_clock is set in e2fsck.conf and this causes
> the check interval to be ignored, make that clear to the user:

Looks good.

Reviewed-by: Lukas Czerner <lczerner@redhat.com>

> 
> # e2fsck /dev/sda1 
> e2fsck 1.44.1 (24-Mar-2018)
> /dev/sda1: ignoring check interval, broken_system_clock set
> /dev/sda1: clean, 11/65536 files, 12955/262144 blocks
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> (I wasn't sure, maybe this test should go outside all the reason-
> setting, since this is a not-checking case?  But in the end it seemed
> to make most sense along with all the other tests for these states.)
> 
> diff --git a/e2fsck/unix.c b/e2fsck/unix.c
> index faf5af9..3a76be1 100644
> --- a/e2fsck/unix.c
> +++ b/e2fsck/unix.c
> @@ -396,7 +396,12 @@ static void check_if_skip(e2fsck_t ctx)
>  		if (batt && ((ctx->now - fs->super->s_lastcheck) <
>  			     fs->super->s_checkinterval*2))
>  			reason = 0;
> +	} else if (broken_system_clock && fs->super->s_checkinterval) {
> +		log_out(ctx, "%s: ", ctx->device_name);
> +		log_out(ctx, "%s",
> +			_("ignoring check interval, broken_system_clock set\n"));
>  	}
> +
>  	if (reason) {
>  		log_out(ctx, "%s", ctx->device_name);
>  		log_out(ctx, reason, reason_arg);
>
Theodore Ts'o April 9, 2018, 8:10 p.m. UTC | #2
On Mon, Apr 09, 2018 at 04:34:15PM +0200, Lukas Czerner wrote:
> On Fri, Mar 30, 2018 at 10:31:37AM -0500, Eric Sandeen wrote:
> > If broken_system_clock is set in e2fsck.conf and this causes
> > the check interval to be ignored, make that clear to the user:
> 
> Looks good.
> 
> Reviewed-by: Lukas Czerner <lczerner@redhat.com>

Applied, thanks.

				- Ted
diff mbox series

Patch

diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index faf5af9..3a76be1 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -396,7 +396,12 @@  static void check_if_skip(e2fsck_t ctx)
 		if (batt && ((ctx->now - fs->super->s_lastcheck) <
 			     fs->super->s_checkinterval*2))
 			reason = 0;
+	} else if (broken_system_clock && fs->super->s_checkinterval) {
+		log_out(ctx, "%s: ", ctx->device_name);
+		log_out(ctx, "%s",
+			_("ignoring check interval, broken_system_clock set\n"));
 	}
+
 	if (reason) {
 		log_out(ctx, "%s", ctx->device_name);
 		log_out(ctx, reason, reason_arg);