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@xxxxxxxxx> > --- > > 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@xxxxxxxx> > 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 > -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html