Re: [PATCH v2 00/11] xfs: widen timestamps to deal with y2038

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 18, 2020 at 04:10:33PM -0700, Darrick J. Wong wrote:
> On Wed, Aug 19, 2020 at 09:01:21AM +1000, Dave Chinner wrote:
> > On Mon, Aug 17, 2020 at 03:56:48PM -0700, Darrick J. Wong wrote:
> > > Hi all,
> > > 
> > > This series performs some refactoring of our timestamp and inode
> > > encoding functions, then retrofits the timestamp union to handle
> > > timestamps as a 64-bit nanosecond counter.  Next, it adds bit shifting
> > > to the non-root dquot timer fields to boost their effective size to 34
> > > bits.  These two changes enable correct time handling on XFS through the
> > > year 2486.
> > 
> > A bit more detail would be nice :)
> 
> Heh, ok.
> 
> > Like, the inode timestamp has a range of slightly greater than 2^34
> > because 10^9 < 2^30. i.e.
> > 
> > Inode timestamp range in days:
> > 
> > $ echo $(((2**62 / (1000*1000*1000) / 86400) * 2**2))
> > 213500
> > $
> > 
> > While the quota timer range in days is:
> > $ echo $(((2**34 / 86400)))
> > 198841
> > $
> > 
> > There's ~15,000 days difference in range here, which in years is
> > about 40 years. Hence the inodes have a timestamp range out to
> > ~2485 from the 1901 epoch start, while quota timers have a range
> > out to only 2445 from the epoch start.
> 
> Quota timers have always treated the d_{b,i,rtb}timer value as an
> unsigned 32-bit integer, which means that it has /never/ been possible
> to set a timer expiration before 1/1/1970.  The quota timer range is
> therefore 198,841 days *after* 1970, not after 1901.
> 
> Therefore, the quota timer range in days is:
> 
> $ echo $(( ((2**34) + (2**31)) / 86400) ))
> 223696
> 
> So, technically speaking, the quota timers could go beyond 2486, but the
> current patchset clamps the quota counters to the same max as the
> inodes.  I guess I just proved the need for more details upfront.

Yeah, little things like quota timers and inode timestamps having a
different epoch value are kinda important to understand. :)

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux