public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: y2038@lists.linaro.org
Cc: Deepa Dinamani <deepa.kernel@gmail.com>,
	linux-fsdevel@vger.kernel.org, tglx@linutronix.de,
	viro@zeniv.linux.org.uk
Subject: Re: [Y2038] [PATCH] vfs: Add support to check max and min inode times
Date: Wed, 02 Mar 2016 17:26:31 +0100	[thread overview]
Message-ID: <1747527.k1uOVsRRbx@wuerfel> (raw)
In-Reply-To: <1456933894-17001-1-git-send-email-deepa.kernel@gmail.com>

On Wednesday 02 March 2016 07:51:34 Deepa Dinamani wrote:
> This is a preparation patch to add range checking for inode
> timestamps.
> 
> These range checks will be used to clamp timestamps to filesystem
> allowed ranges.
> 
> Individual filesystems do not have the same on disk format as
> the in memory inodes. Range checking and clamping times assigned
> to inodes will help keep in memory and on-disk timestamps to be
> in sync.
> 
> Extend struct super_block to include information about the max
> and min inode times each filesystem can hold. These are dependent
> on the on-disk format of filesystems.
> 
> Every time a new superblock is created, make sure that the superblock
> max and min timestamp fields are assigned invalid values.
> 
> Another series will initialize these fields to appropriate values for
> every filesystem.
> 
> The values are currently ignored. The exact policy and behavior will be
> decided in a separate patch.
> 
> MAX_INVALID_VFS_TIME and MIN_INVALID_VFS_TIME are initialized to S64_MIN
> and S64_MAX respectively so that even if one of the fields is
> uninitialized, it can be detected by using the condition
> max_time < min_time.
> 
> The original idea for the feature comes from the discussion:
> https://lkml.org/lkml/2014/5/30/669
> 
> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
> ---
> 
> The intention is to include this as part of 4.6 so that the follow on
> patches can go into 4.7.
> 
> The series and the plan have been discussed with Arnd Bergmann.
> 
> 

Acked-by: Arnd Bergmann <arnd@arndb.de>

> fs/super.c         |  2 ++
>  include/linux/fs.h | 13 ++++++++++++-
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/super.c b/fs/super.c
> index 1182af8..d70a8f6 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -239,6 +239,8 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
>  	s->s_maxbytes = MAX_NON_LFS;
>  	s->s_op = &default_op;
>  	s->s_time_gran = 1000000000;
> +	s->s_time_max = MAX_INVALID_VFS_TIME;
> +	s->s_time_min = MIN_INVALID_VFS_TIME;
>  	s->cleancache_poolid = CLEANCACHE_NO_POOL;
>  
>  	s->s_shrink.seeks = DEFAULT_SEEKS;
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 1af4727..15b41e6 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -927,6 +927,12 @@ static inline struct file *get_file(struct file *f)
>  #define MAX_LFS_FILESIZE 	((loff_t)0x7fffffffffffffffLL)
>  #endif
>  
> +#define MAX_VFS_TIME	S64_MAX
> +#define MIN_VFS_TIME	S64_MIN
> +
> +#define MAX_INVALID_VFS_TIME	S64_MIN
> +#define MIN_INVALID_VFS_TIME	S64_MAX
> +
>  #define FL_POSIX	1
>  #define FL_FLOCK	2
>  #define FL_DELEG	4	/* NFSv4 delegation */
> @@ -1343,7 +1349,12 @@ struct super_block {
>  
>  	/* Granularity of c/m/atime in ns.
>  	   Cannot be worse than a second */
> -	u32		   s_time_gran;
> +	u32		s_time_gran;
> +	/* Max and min values for timestamps
> +	 * according to the range supported by filesystems.
> +	 */
> +	time64_t	s_time_max;
> +	time64_t	s_time_min;
>  
>  	/*
>  	 * The next field is for VFS *only*. No filesystems have any business
> 


  reply	other threads:[~2016-03-02 16:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02 15:51 [PATCH] vfs: Add support to check max and min inode times Deepa Dinamani
2016-03-02 16:26 ` Arnd Bergmann [this message]
2016-03-02 22:19 ` Dave Chinner
2016-03-02 23:07   ` Arnd Bergmann
2016-03-02 23:45     ` Dave Chinner
2016-03-03  6:24       ` Deepa Dinamani
2016-03-03 14:08       ` [Y2038] " Arnd Bergmann
2016-03-04  1:10         ` Dave Chinner
2016-03-04  7:49           ` Deepa Dinamani
2016-03-04 16:54           ` Arnd Bergmann
2016-03-04  6:31         ` Steve French
2016-03-04 16:21           ` 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=1747527.k1uOVsRRbx@wuerfel \
    --to=arnd@arndb.de \
    --cc=deepa.kernel@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=viro@zeniv.linux.org.uk \
    --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