Re: [RFC 13/32] ext3: convert to struct inode_time

From: Arnd Bergmann
Date: Sat May 31 2014 - 10:33:34 EST


On Saturday 31 May 2014 02:10:45 H. Peter Anvin wrote:
> On 05/30/2014 01:01 PM, Arnd Bergmann wrote:
> > ext3fs uses unsigned 32-bit seconds for inode timestamps, which will work
> > for the next 92 years, but the VFS uses struct timespec for timestamps,
> > which is only good until 2038 on 32-bit CPUs.
> >
> > This gets us one small step closer to lifting the VFS limit by using
> > struct inode_time in ext3. The on-disk format limit is lifted in ext4,
> > which will work until 2514.
> >
>
> This may be what the spec says, but when I experimented with this just
> now it does seem that both ext2 and ext3 actually interpret timestamps
> as *signed* 32-bit seconds.

Right, I can see that in ext3_iget() now:

inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime);

I may have just looked at ext3_do_update_inode(), which uses this
unsigned conversion:

raw_inode->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);

and didn't realize that this is only half of the story, and since it
converts from (potentially 64-bit) long to u32, it doesn't matter
whether that is signed or unsigned.

I may have to go through all of them again to see if I made the same
mistake in other file systems as well.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/