]> Git Repo - linux.git/commit - mm/shmem.c
tmpfs: fix regressions from wider use of ZERO_PAGE
authorHugh Dickins <[email protected]>
Fri, 15 Apr 2022 02:13:27 +0000 (19:13 -0700)
committerLinus Torvalds <[email protected]>
Fri, 15 Apr 2022 21:49:54 +0000 (14:49 -0700)
commit1bdec44b1eee32e311b44b5b06144bb7d9b33938
tree67349dd5de85a8db47093ac128cea601f2b628eb
parent7fbd166a8f2d697c3e2b4c8432d33253f00266b3
tmpfs: fix regressions from wider use of ZERO_PAGE

Chuck Lever reported fsx-based xfstests generic 075 091 112 127 failing
when 5.18-rc1 NFS server exports tmpfs: bisected to recent tmpfs change.

Whilst nfsd_splice_action() does contain some questionable handling of
repeated pages, and Chuck was able to work around there, history from
Mark Hemment makes clear that there might be similar dangers elsewhere:
it was not a good idea for me to pass ZERO_PAGE down to unknown actors.

Revert shmem_file_read_iter() to using ZERO_PAGE for holes only when
iter_is_iovec(); in other cases, use the more natural iov_iter_zero()
instead of copy_page_to_iter().

We would use iov_iter_zero() throughout, but the x86 clear_user() is not
nearly so well optimized as copy to user (dd of 1T sparse tmpfs file
takes 57 seconds rather than 44 seconds).

And now pagecache_init() does not need to SetPageUptodate(ZERO_PAGE(0)):
which had caused boot failure on arm noMMU STM32F7 and STM32H7 boards

Link: https://lkml.kernel.org/r/[email protected]
Fixes: 56a8c8eb1eaf ("tmpfs: do not allocate pages on read")
Signed-off-by: Hugh Dickins <[email protected]>
Reported-by: Patrice CHOTARD <[email protected]>
Reported-by: Chuck Lever III <[email protected]>
Tested-by: Chuck Lever III <[email protected]>
Cc: Mark Hemment <[email protected]>
Cc: Patrice CHOTARD <[email protected]>
Cc: Mikulas Patocka <[email protected]>
Cc: Lukas Czerner <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: "Darrick J. Wong" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/filemap.c
mm/shmem.c
This page took 0.053371 seconds and 4 git commands to generate.