Skip to content
  • Jeff Layton's avatar
    vfs: change sb->s_maxbytes to a loff_t · 42cb56ae
    Jeff Layton authored
    
    
    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.
    
    Even if a filesystem has no inherent limit that prevents it from using
    every bit in that unsigned long long, it's still problematic to set it to
    anything larger than MAX_LFS_FILESIZE.  There are places in the kernel
    that cast s_maxbytes to a signed value.  If it's set too large then this
    cast makes it a negative number and generally breaks the comparison.
    
    Change s_maxbytes to be loff_t instead.  That should help eliminate the
    temptation to set it too large by making it a signed value.
    
    Also, add a warning for couple of releases to help catch filesystems that
    set s_maxbytes too large.  Eventually we can either convert this to a
    BUG() or just remove it and in the hope that no one will get it wrong now
    that it's a signed value.
    
    Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Robert Love <rlove@google.com>
    Cc: Mandeep Singh Baines <msb@google.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
    42cb56ae