public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org,
	Arnd Bergmann <arnd@arndb.de>, "Theodore Ts'o" <tytso@mit.edu>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC v2a 11/12] net: ceph: use vfs_time data type instead of timespec
Date: Sun, 14 Feb 2016 09:08:47 +1100	[thread overview]
Message-ID: <20160213220847.GQ19486@dastard> (raw)
In-Reply-To: <1455269766-2994-12-git-send-email-deepa.kernel@gmail.com>

On Fri, Feb 12, 2016 at 01:36:05AM -0800, Deepa Dinamani wrote:
> The VFS inode timestamps are not y2038 safe as they use
> struct timespec. These will be changed to use struct timespec64
> instead and that is y2038 safe.
> But, since the above data type conversion will break the end
> file systems, use vfs_time aliases here to access inode times.
> 
> These timestamps are passed in as arguments to functions
> using inode timestamps. Hence, these need to change along
> with vfs to support 64 bit timestamps. vfs_time helps do
> this transition.
> 
> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>

Just a point to highlight the problem with this approach:

> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index f8f2359..1273db6 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -2401,7 +2401,7 @@ bad:
>   */
>  void ceph_osdc_build_request(struct ceph_osd_request *req, u64 off,
>  				struct ceph_snap_context *snapc, u64 snap_id,
> -				struct timespec *mtime)
> +				struct vfs_time *mtime)
>  {
>  	struct ceph_msg *msg = req->r_request;
>  	void *p;

So this change assumes that mtime is not passed by reference to
another function. If we change vfs_time to be a timespec64, then
dereferencing in this function works fine, but passing to another
function will not because that function will be expecting a
timespec.

That, indeed, is what happens here. A few lines into this function:

        if (req->r_flags & CEPH_OSD_FLAG_WRITE)
                ceph_encode_timespec(p, mtime);

And that function:

static inline void ceph_encode_timespec(struct ceph_timespec *tv,
                                        const struct timespec *ts)
{
        tv->tv_sec = cpu_to_le32((u32)ts->tv_sec);
        tv->tv_nsec = cpu_to_le32((u32)ts->tv_nsec);
}

expects a timespec. It will silently lose 64 bit times even if it
did compile. I note in version 2b, the mtime was not passed by
reference as a vfs time, but converted at the call site to
a timespec and so the internal usage of the timestamp remains
unchanged and unaffected by a VFS level timespec->timespec64 change.

I think an approach that requires changes to the API without
actually beign able to verify they are correct, fully propagated or
don't impact on write/disk formats before the final change of the
VFS type is not going to fly. This is the sort of subtle bug that
can occur with type changes, and hence why I think that the fs
developers should be left to do the conversion of their filesystem
to support 64 bit times (i.e. approach 2b).

Any change is going to take a significant amount of testing and
verification, and that's something we don't have yet. Nobody has
written any tests for xfstests to verify correct 64 bit timestamp
behaviour, nor do we have tests to verify 32 bit timestamp behaviour
on a 64 bit time kernel. These are things that we are going to need;
all filesystems should behave the same w.r.t. these configurations,
so we really do need regression tests for this....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2016-02-13 22:08 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-12  9:21 [RFC v2] vfs 64 bit time transition proposals Deepa Dinamani
2016-02-12  9:35 ` [RFC v2a 00/12] vfs 64 bit time transition proposal Deepa Dinamani
2016-02-12  9:35   ` [RFC v2a 01/12] vfs: Add vfs_time abstractions Deepa Dinamani
2016-02-12  9:35   ` [RFC v2a 02/12] fs: cifs: Change cifs_fscache_inode_auxdata to use vfs_time data type Deepa Dinamani
2016-02-12  9:35   ` [RFC v2a 03/12] fs: cifs: Change cifs_fattr timestamps data type to vfs_time Deepa Dinamani
2016-02-12  9:35   ` [RFC v2a 04/12] fs: cifs: Make cnvrtDosUnixTm() y2038 safe Deepa Dinamani
2016-02-12  9:35   ` [RFC v2a 05/12] fs: cifs: Use vfs_time_get_real_* time functions Deepa Dinamani
2016-02-12  9:36   ` [RFC v2a 06/12] fs: btrfs: Change btrfs_inode.i_otime to use vfs_time data type Deepa Dinamani
2016-02-12  9:36   ` [RFC v2a 07/12] fs: btrfs: Use vfs_time data type for btrfs_update_time() Deepa Dinamani
2016-02-12  9:36   ` [RFC v2a 08/12] fs: btrfs: Change timespec data types to use vfs_time Deepa Dinamani
2016-02-12  9:36   ` [RFC v2a 09/12] fs: ceph: Change encode and decode functions " Deepa Dinamani
2016-02-12  9:36   ` [RFC v2a 10/12] fs: ceph: Replace timespec data type with vfs_time Deepa Dinamani
2016-02-12  9:36   ` [RFC v2a 11/12] net: ceph: use vfs_time data type instead of timespec Deepa Dinamani
2016-02-13 22:08     ` Dave Chinner [this message]
2016-02-14  1:46       ` Deepa Dinamani
2016-02-14  2:05         ` Deepa Dinamani
2016-02-14 21:00         ` Dave Chinner
2016-02-17  9:32           ` Arnd Bergmann
2016-02-12  9:36   ` [RFC v2a 12/12] fs: xfs: change inode times to use vfs_time data type Deepa Dinamani
2016-02-12  9:45 ` [RFC v2b 0/5] vfs 64 bit time transition proposal Deepa Dinamani
2016-02-12  9:45   ` [RFC v2b 1/5] vfs: Add vfs_time accessors Deepa Dinamani
2016-02-12  9:45   ` [RFC v2b 2/5] fs: cifs: Use " Deepa Dinamani
2016-02-12  9:45   ` [RFC v2b 3/5] fs: btrfs: " Deepa Dinamani
2016-02-12 13:57     ` Arnd Bergmann
2016-02-13  7:01       ` Deepa Dinamani
2016-02-12  9:45   ` [RFC v2b 4/5] fs: ceph: Use vfs timestamp accessors Deepa Dinamani
2016-02-12  9:45   ` [RFC v2b 5/5] fs: xfs: change inode times to use vfs_time data type Deepa Dinamani
2016-02-13  2:18     ` Dave Chinner
2016-02-13 14:50       ` [Y2038] " Arnd Bergmann
2016-02-13 15:56         ` David F.
2016-02-12  9:52 ` [RFC v2c 0/8] vfs 64 bit time transition proposal Deepa Dinamani
2016-02-12  9:52   ` [RFC v2c 1/8] vfs: Add vfs_time abstractions Deepa Dinamani
2016-02-12  9:52   ` [RFC v2c 2/8] fs: cifs: Change auxdata to struct timespec64 data type Deepa Dinamani
2016-02-12  9:52   ` [RFC v2c 3/8] fs: cifs: Change cifs_fattr timestamps data type to timespec64 Deepa Dinamani
2016-02-12  9:52   ` [RFC v2c 4/8] fs: cifs: Make cnvrtDosUnixTm() y2038 safe Deepa Dinamani
2016-02-12  9:52   ` [RFC v2c 5/8] fs: btrfs: Change btrfs_inode.i_otime to vfs_time data type Deepa Dinamani
2016-02-12  9:52   ` [RFC v2c 6/8] fs: btrfs: Use vfs timestamp abstraction helper Deepa Dinamani
2016-02-12  9:52   ` [RFC v2c 7/8] fs: ceph: Use vfs timestamp abstraction helpers Deepa Dinamani
2016-02-12  9:52   ` [RFC v2c 8/8] fs: xfs: change inode times to use vfs_time data type Deepa Dinamani
2016-02-12 14:03 ` [Y2038] [RFC v2] vfs 64 bit time transition proposals Arnd Bergmann
2016-02-13  6:58   ` Deepa Dinamani
2016-02-13 11:54     ` Deepa Dinamani
2016-02-24 12:19   ` [Y2038] " Thomas Gleixner
2016-02-24 12:26     ` Julia Lawall
2016-02-24 13:56     ` Arnd Bergmann

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=20160213220847.GQ19486@dastard \
    --to=david@fromorbit.com \
    --cc=arnd@arndb.de \
    --cc=deepa.kernel@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=y2038@lists.linaro.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