linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Harris <mhlk@osj.us>
To: David Turner <novalis@novalis.org>
Cc: Andreas Dilger <adilger@dilger.ca>,
	"Theodore Ts'o" <tytso@mit.edu>, Jan Kara <jack@suse.cz>,
	Ext4 Developers List <linux-ext4@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 2/2] e2fsck: Correct ext4 dates generated by old kernels.
Date: Thu, 14 Nov 2013 02:15:06 -0800	[thread overview]
Message-ID: <CADQUmxVEyV796xTuy6LytketqEDsCQYH0vOpH79FSfo9mhgsEw@mail.gmail.com> (raw)
In-Reply-To: <1384418641.1957.1.camel@chiang>

> +/* When today's date is earlier than 2242, we assume that atimes,
> + * ctimes, and mtimes greater than 2242 are actually pre-1970 dates

...mtimes with years in the range 2310..2378 are...

> + * mis-encoded.
> + */
> +#define EXT4_EXTRA_NEGATIVE_DATE_CUTOFF 5 * (1ULL << 32)

Wouldn't 2242 be 0x200000000ULL, i.e. 2 * (1ULL << 32)?


> +
> +       /*
> +        * If the inode's extended atime (ctime, mtime) is stored in
> +        * the old, invalid format, the inode is corrupt.
> +        */
> +       if (sizeof(time_t) > 4 && ctx->now < EXT4_EXTRA_NEGATIVE_DATE_CUTOFF &&

Needs parentheses (

> +           CHECK_INODE_EXTRA_NEGATIVE_EPOCH(inode, atime) ||
> +           CHECK_INODE_EXTRA_NEGATIVE_EPOCH(inode, ctime) ||
> +           CHECK_INODE_EXTRA_NEGATIVE_EPOCH(inode, mtime)) {

)

> +
> +               if (!fix_problem(ctx, PR_1_EA_TIME_OUT_OF_RANGE, pctx))
> +                       return;
> +
> +               inode->i_atime_extra &= ~EXT4_EPOCH_MASK;
> +               inode->i_ctime_extra &= ~EXT4_EPOCH_MASK;
> +               inode->i_mtime_extra &= ~EXT4_EPOCH_MASK;

With e.g. 2039 atime and 1968 mtime, shouldn't only i_mtime_extra be altered?

> +               e2fsck_write_inode_full(ctx, pctx->ino, pctx->inode,
> +                                       EXT2_INODE_SIZE(sb), "pass1");
> +       }

 - Mark

  reply	other threads:[~2013-11-14 10:15 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-07  7:16 [PATCH] ext4: Fix reading of extended tv_sec (bug 23732) David Turner
2013-11-07 16:03 ` Jan Kara
2013-11-07 22:54   ` [PATCH v2] " David Turner
2013-11-07 23:14     ` Jan Kara
2013-11-07 23:26       ` [PATCH v3] " David Turner
2013-11-08  5:17         ` Theodore Ts'o
2013-11-08 21:37         ` Andreas Dilger
2013-11-09  7:19           ` [PATCH] ext4: explain encoding of 34-bit a,c,mtime values David Turner
2013-11-09 23:51             ` Mark Harris
2013-11-10  7:56               ` David Turner
2013-11-12  0:30                 ` Theodore Ts'o
2013-11-12 21:35                   ` Andreas Dilger
2013-11-13  7:00                     ` [PATCH v4 1/2] ext4: Fix handling of extended tv_sec (bug 23732) David Turner
2013-11-13  8:19                       ` Darrick J. Wong
2013-11-13  7:00                     ` [PATCH v4 2/2] e2fsck: Correct ext4 dates generated by old kernels David Turner
2013-11-13  7:56                       ` Andreas Dilger
2013-11-14  8:38                         ` [PATCH v5 1/2] ext4: Fix handling of extended tv_sec (bug 23732) David Turner
2013-11-14  8:44                         ` [PATCH v5 2/2] e2fsck: Correct ext4 dates generated by old kernels David Turner
2013-11-14 10:15                           ` Mark Harris [this message]
2013-11-14 21:06                             ` [PATCH v6] " David Turner
2013-11-29 21:54                               ` David Turner
2013-11-29 22:11                                 ` Andreas Dilger
2013-12-07 20:02                                   ` [PATCH v7 1/2] " David Turner
2013-12-07 22:33                                     ` Andreas Dilger
2013-12-08  0:53                                     ` Theodore Ts'o
2013-12-08  2:58                                       ` David Turner
2013-12-08  3:21                                         ` Theodore Ts'o
2013-12-07 20:02                                   ` [PATCH v7 2/2] debugfs: Decode {a,c,cr,m}time_extra fields in stat David Turner
2013-11-12 23:03                   ` [PATCH] ext4: explain encoding of 34-bit a,c,mtime values Darrick J. Wong
2013-11-13  2:36                     ` David Turner
2014-01-22  6:22                   ` Darrick J. Wong
2014-02-11  5:12                     ` David Turner
2014-02-11  7:07                       ` Andreas Dilger
2014-02-14  3:47                         ` [PATCH v8 1/2] ext4: Fix handling of extended tv_sec (bug 23732) David Turner
2014-02-14  3:47                         ` [PATCH v8 2/2] e2fsck: Correct ext4 dates generated by old kernels David Turner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADQUmxVEyV796xTuy6LytketqEDsCQYH0vOpH79FSfo9mhgsEw@mail.gmail.com \
    --to=mhlk@osj.us \
    --cc=adilger@dilger.ca \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=novalis@novalis.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).