From: Amir Goldstein <amir73il@gmail.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH 11/14] xfs: widen ondisk timestamps to deal with y2038 problem
Date: Tue, 2 Jun 2020 07:26:57 +0300 [thread overview]
Message-ID: <CAOQ4uxgGNx7jz3v22s2xXYTuPUXNtQZ9UGg4aP50tYqzFBetvQ@mail.gmail.com> (raw)
In-Reply-To: <20200601231751.GD2162697@magnolia>
On Tue, Jun 2, 2020 at 2:17 AM Darrick J. Wong <darrick.wong@oracle.com> wrote:
>
> On Sun, May 31, 2020 at 03:30:42PM +0300, Amir Goldstein wrote:
> > > @@ -265,17 +278,35 @@ xfs_inode_from_disk(
> > > if (to->di_version == 3) {
> > > inode_set_iversion_queried(inode,
> > > be64_to_cpu(from->di_changecount));
> > > - xfs_inode_from_disk_timestamp(&to->di_crtime, &from->di_crtime);
> > > + xfs_inode_from_disk_timestamp(from, &to->di_crtime,
> > > + &from->di_crtime);
> > > to->di_flags2 = be64_to_cpu(from->di_flags2);
> > > to->di_cowextsize = be32_to_cpu(from->di_cowextsize);
> > > + /*
> > > + * Convert this inode's timestamps to bigtime format the next
> > > + * time we write it out to disk.
> > > + */
> > > + if (xfs_sb_version_hasbigtime(&mp->m_sb))
> > > + to->di_flags2 |= XFS_DIFLAG2_BIGTIME;
> > > }
> >
> > This feels wrong.
> > incore inode has a union for timestamp.
> > This flag should indicate how the union should be interpreted
> > otherwise it is going to be very easy to stumble on that in future code.
>
> Hm? I think you've gotten it backwards.
>
> The incore inode (struct xfs_icdinode) has a struct timespec64.
>
> The ondisk inode (struct xfs_dinode) has a union xfs_timestamp.
>
> xfs_inode_from_disk_timestamp uses the ondisk inode (from) to convert
> the ondisk timestamp (&from->di_crtime) to the incore inode
> (&to->di_crtime).
>
> In other words, we use the ondisk flag and union to load the ondisk
> timestamp into a format-agnostic incore structure. Then we set BIGTIME
> in the incore inode (to->di_flags2).
>
> If and when we write the inode back out to disk, we'll see that BIGTIME
> is set in the incore inode, and convert the incore structure into the
> bigtime encoding on disk.
>
> > So either convert incore timestamp now or check hasbigtime when
> > we write to disk.
>
> That's more or less what this is doing. We read the timestamp in from
> disk in whatever format it's in, and then set ourselves up to write it
> back out in bigtime format.
>
I stand corrected. xfs_ictimestamp got me confused.
Everything does look consistent.
Thanks,
Amir.
next prev parent reply other threads:[~2020-06-02 4:27 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-01 1:11 [PATCH 00/14] xfs: widen timestamps to deal with y2038 Darrick J. Wong
2020-01-01 1:11 ` [PATCH 01/14] xfs: explicitly define inode timestamp range Darrick J. Wong
2020-02-12 23:00 ` Eric Sandeen
2020-02-13 1:26 ` Darrick J. Wong
2020-02-13 1:50 ` Eric Sandeen
2020-02-13 1:53 ` Darrick J. Wong
2020-01-01 1:11 ` [PATCH 02/14] xfs: preserve default grace interval during quotacheck Darrick J. Wong
2020-02-12 23:35 ` Eric Sandeen
2020-02-19 4:55 ` Eric Sandeen
2020-03-03 3:03 ` Eric Sandeen
2020-03-03 15:48 ` Darrick J. Wong
2020-03-03 15:52 ` Eric Sandeen
2020-01-01 1:11 ` [PATCH 03/14] xfs: refactor quota exceeded test Darrick J. Wong
2020-02-12 23:51 ` Eric Sandeen
2020-02-13 1:41 ` Darrick J. Wong
2020-02-13 1:52 ` Eric Sandeen
2020-02-13 1:59 ` Darrick J. Wong
2020-05-31 14:04 ` Amir Goldstein
2020-01-01 1:11 ` [PATCH 04/14] xfs: fix quota timer inactivation Darrick J. Wong
2020-05-31 15:04 ` Amir Goldstein
2020-06-01 23:56 ` Darrick J. Wong
2020-01-01 1:11 ` [PATCH 05/14] xfs: refactor quota expiration timer modification Darrick J. Wong
2020-02-12 23:57 ` Eric Sandeen
2020-02-13 1:46 ` Darrick J. Wong
2020-02-13 3:27 ` Eric Sandeen
2020-02-13 3:32 ` Eric Sandeen
2020-02-13 5:33 ` Darrick J. Wong
2020-01-01 1:11 ` [PATCH 06/14] xfs: refactor default quota grace period setting code Darrick J. Wong
2020-02-13 0:15 ` Eric Sandeen
2020-02-13 1:53 ` Darrick J. Wong
2020-02-13 2:03 ` Darrick J. Wong
2020-01-01 1:11 ` [PATCH 07/14] xfs: remove xfs_timestamp_t Darrick J. Wong
2020-01-01 1:11 ` [PATCH 08/14] xfs: move xfs_log_dinode_to_disk to the log code Darrick J. Wong
2020-01-01 1:11 ` [PATCH 09/14] xfs: refactor timestamp coding Darrick J. Wong
2020-01-01 1:12 ` [PATCH 10/14] xfs: convert struct xfs_timestamp to union Darrick J. Wong
2020-01-01 1:12 ` [PATCH 11/14] xfs: widen ondisk timestamps to deal with y2038 problem Darrick J. Wong
2020-05-31 12:30 ` Amir Goldstein
2020-06-01 23:17 ` Darrick J. Wong
2020-06-02 4:26 ` Amir Goldstein [this message]
2020-01-01 1:12 ` [PATCH 12/14] xfs: cache quota grace period expiration times incore Darrick J. Wong
2020-01-01 1:12 ` [PATCH 13/14] xfs: enable bigtime for quota timers Darrick J. Wong
2020-05-31 17:07 ` Amir Goldstein
2020-06-02 0:09 ` Darrick J. Wong
2020-06-02 4:04 ` Amir Goldstein
2020-01-01 1:12 ` [PATCH 14/14] xfs: enable big timestamps Darrick J. Wong
2020-05-26 9:20 ` [PATCH 00/14] xfs: widen timestamps to deal with y2038 Amir Goldstein
2020-05-26 15:57 ` Darrick J. Wong
2020-05-26 16:42 ` Amir Goldstein
2020-05-31 17:31 ` Amir Goldstein
2020-06-02 0:09 ` 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=CAOQ4uxgGNx7jz3v22s2xXYTuPUXNtQZ9UGg4aP50tYqzFBetvQ@mail.gmail.com \
--to=amir73il@gmail.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.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 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).