Re: [PATCH] mm: fix cpu hangs on truncating last page of a 16t sparse file

Dave Chinner
2015-09-28T01:06:52Z

On Sun, Sep 27, 2015 at 07:56:55PM -0400, Jeff Layton wrote:
> On Mon, 28 Sep 2015 09:26:45 +1000 Dave Chinner <david@fromorbit.com> wrote:
> > On Sun, Sep 27, 2015 at 10:59:33AM -0700, Hugh Dickins wrote:
> > > > But if s_maxbytes doesn't have to be greater than MAX_LFS_FILESIZE,
> > > > i agree the issue should be fixed in layers above.
> > >
> > > There is a "filesystems should never set s_maxbytes larger than
> > > MAX_LFS_FILESIZE" comment in fs/super.c, but unfortunately its
> > > warning is written with just 64-bit in mind (testing for negative).
> >
> > Yup, introduced here:
> >
> > commit 42cb56ae2ab67390da34906b27bedc3f2ff1393b
> > Author: Jeff Layton <jlayton@redhat.com>
> > Date: Fri Sep 18 13:05:53 2009 -0700
> >
> > vfs: change sb->s_maxbytes to a loff_t
> >
> > sb->s_maxbytes is supposed to indicate the maximum size of a file that can
> > exist on the filesystem. It's declared as an unsigned long long.
> >
> > And yes, that will never fire on a 32bit filesystem, because loff_t
> > is a "long long" type....
> >
>
> Hmm...should we change that to something like this instead?
>
> WARN(((unsigned long long)sb->s_maxbytes > (unsigned long long)MAX_LFS_FILESIZE,
> "%s set sb->s_maxbytes to too large a value (0x%llx)\n", type->name, sb->s_maxbytes);

Well, it doesn't change the fact that we've actually been supporting
sb->s_maxbytes > MAX_LFS_FILESIZE for a long time on 32 bit systems.
And it's pretty unfriendly to start issuing warnings on every mount
of every XFS filesystem on every 32 bit system in existence for
something we've explicitly supported since 2.4 kernels...

I suspect the warning should have been removed back in 2.6.34 like
was originally intended. :)

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com