Re: Kernels v4.9+ cause short reads of block devices

From: Linus Torvalds
Date: Sun Aug 27 2017 - 15:47:12 EST


On Wed, Aug 23, 2017 at 2:01 PM, Andreas Dilger <adilger@xxxxxxxxx> wrote:
>
> Doug,
> I noticed while checking for other implications of changing MAX_LFS_FILESIZE
> that fs/jfs/super.c is also working around this limit.

Note to people: I just committed the patch to update MAX_LFS_FILESIZE.

I made it use the simpler (and clearer) calculation of

((loff_t)ULONG_MAX << PAGE_SHIFT)

for the 32-bit case, and I did *not* change any other users.

The jfs comment was a bit confusing, and talks about "wraps around" at
8TB, when that actually happens at 16TB. Yes, if you use a signed
number for the index, it does wrap at 8TB, but you really shouldn't
(and the code the jfs comment points to doesn't).

So I didn't touch that. Nor did I touch:

> it also makes sense to fix jfs_fill_super() to
> use MAX_LFS_FILESIZE instead of JFS rolling its own, something like:
>
> /* logical blocks are represented by 40 bits in pxd_t, etc.
> * and page cache is indexed by long. */
> sb->s_maxbytes = min((u64)sb->s_blocksize) << 40,
> MAX_LFS_FILESIZE);

which I agree should be modified. The new MAX_LFS_FILESIZE should be
the right size, but the difference now is only one page less one byte.

Linus