linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J.Bruce Fields" <bfields@citi.umich.edu>
To: Harshula Jayasuriya <harshula@redhat.com>
Cc: linux-nfs@vger.kernel.org, NeilBrown <neilb@suse.de>,
	Jeff Layton <jlayton@redhat.com>
Subject: Re: [PATCH] sunrpc: prepare NFS for 2038
Date: Thu, 15 Aug 2013 13:52:58 -0400	[thread overview]
Message-ID: <20130815175258.GS17781@fieldses.org> (raw)
In-Reply-To: <1376588800.17754.14.camel@serendib>

On Fri, Aug 16, 2013 at 03:46:40AM +1000, Harshula Jayasuriya wrote:
> 1) The kernel sunrpc code needs to handle seconds since epoch
> greater than 2147483647. This means functions that parse time
> as an int need to handle it as time_t.

Anyone expecting not to have to upgrade their nfs server once between
now and 2038 is interesting, but... yes, may as well get it fixed now,
OK.

> 2) The kernel changes must be accompanied by userspace changes
> in nfs-utils.

This all looks backwards-compatible, so I assume that "must" is only if
you want this particular bug fixed.

Applying for 3.12 absent any objections.

--b.

> 
> Signed-off-by: Harshula Jayasuriya <harshula@redhat.com>
> ---
>  include/linux/sunrpc/cache.h | 22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
> index 6ce690d..437ddb6 100644
> --- a/include/linux/sunrpc/cache.h
> +++ b/include/linux/sunrpc/cache.h
> @@ -264,12 +264,30 @@ static inline int get_uint(char **bpp, unsigned int *anint)
>  	return 0;
>  }
>  
> +static inline int get_time(char **bpp, time_t *time)
> +{
> +	char buf[50];
> +	long long ll;
> +	int len = qword_get(bpp, buf, sizeof(buf));
> +
> +	if (len < 0)
> +		return -EINVAL;
> +	if (len == 0)
> +		return -ENOENT;
> +
> +	if (kstrtoll(buf, 0, &ll))
> +		return -EINVAL;
> +
> +	*time = (time_t)ll;
> +	return 0;
> +}
> +
>  static inline time_t get_expiry(char **bpp)
>  {
> -	int rv;
> +	time_t rv;
>  	struct timespec boot;
>  
> -	if (get_int(bpp, &rv))
> +	if (get_time(bpp, &rv))
>  		return 0;
>  	if (rv < 0)
>  		return 0;
> -- 
> 1.8.3.1
> 

  reply	other threads:[~2013-08-15 17:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-15 17:46 [PATCH] sunrpc: prepare NFS for 2038 Harshula Jayasuriya
2013-08-15 17:52 ` J.Bruce Fields [this message]
2013-11-11  7:20   ` [PATCH] exportfs: modify can_test() to use LONG_MAX when appropriate Harshula Jayasuriya
2013-11-11  7:53     ` NeilBrown
2013-11-11 11:20       ` Harshula Jayasuriya
2013-11-15  6:15         ` Harshula Jayasuriya
2013-11-15  6:38           ` NeilBrown
2013-11-15 10:39             ` Harshula Jayasuriya
2013-11-17 23:45               ` [PATCH v2] " Harshula Jayasuriya
2013-11-20 21:20                 ` Steve Dickson

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=20130815175258.GS17781@fieldses.org \
    --to=bfields@citi.umich.edu \
    --cc=harshula@redhat.com \
    --cc=jlayton@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    /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).