From: Theodore Ts'o <tytso@mit.edu>
To: David Turner <novalis@novalis.org>
Cc: Andreas Dilger <adilger@dilger.ca>, Mark Harris <mhlk@osj.us>,
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 v7 1/2] e2fsck: Correct ext4 dates generated by old kernels.
Date: Sat, 7 Dec 2013 19:53:57 -0500 [thread overview]
Message-ID: <20131208005357.GB13776@thunk.org> (raw)
In-Reply-To: <1386446560.10748.5.camel@chiang>
On Sat, Dec 07, 2013 at 03:02:40PM -0500, David Turner wrote:
>
> However, as Andreas notes, "we want to verify .. that "debugfs -R
> 'stat testfile'" decodes the times correctly." Unfortunately, it
> does not, and it is not trivial to fix. debugfs uses an internal
> function time_to_string(__u32), which calls gmtime or localtime.
> These functions are defined on time_t, which is 32-bits on 32-bit
> Linux systems. In addition, because time_to_string takes
> an unsigned int, it returns bad results for pre-1970 dates.
We can and should change time_to_string to take an unsigned 64-bit
type; it's an internal interface to debugfs. The question of what to
do if the system time_t is only 32-bit.
What I'd probably suggest is to have a mode (set either by an
environment variable, or a debugfs command) which causes
time_to_string to use an internal version of a 64-bit capable gmtime
function. This will allow for better regression testing, and it in a
way that will be have stable results regardless of whether a
particular platform, or a future version of glibc has a 64-bit time_t
or not.
> Also, while I was making this change, I happened to notice that
> there is no dtime_extra field into which to put the extra bits.
> This means that there is still a year 2038 problem with tools
> that deal with deleted files (including the corner case that the
> system is shut down cleanly at the exact second that the bottom
> 32 bits of the current time are zero, leading fsck to believe
> that there was an unclean shutdown).
I'm not sure we care, since nothing is actually using the dtime. This
was originally intended to make it easy to recover from accident file
deletions, using debugfs's lsdel command. However, ever since ext3,
in order to make sure the file system is consistent if it crashes
during an unlink, we end up truncating the file before we unlink it,
so i_blocks[] is completely cleared for deleted inodes. This makes it
essentially impossible for lsdel to work.
> I want to make an additional change to correct this. Since I
> assume it is impossible to add an additional field, I propose to
> use ctime_extra to store the extra bits of dtime on deletion.
> This is a bit hackish, since it does destroy a bit of data, but
> it is significantly better than dtime being totally broken after
> 2038. What do people think?
Given that we always set ctime when delete a file (which makes sense,
since we are decrementing i_links_count), I think changing debugfs
(which is the only thing that even looks at dtime, BTW) makes a lot of
sense.
Regards,
- Ted
next prev parent reply other threads:[~2013-12-08 0:53 UTC|newest]
Thread overview: 39+ 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 7:19 ` David Turner
2013-11-09 23:51 ` Mark Harris
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
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 [this message]
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
2014-02-14 5:40 ` Andreas Dilger
2014-02-14 22:11 ` Darrick J. Wong
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=20131208005357.GB13776@thunk.org \
--to=tytso@mit.edu \
--cc=adilger@dilger.ca \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhlk@osj.us \
--cc=novalis@novalis.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.