linux/fs/ntfs
Linus Torvalds c03098d4b9 gfs2: Fix mmap + page fault deadlocks
Functions gfs2_file_read_iter and gfs2_file_write_iter are both
 accessing the user buffer to write to or read from while holding the
 inode glock.  In the most basic scenario, that buffer will not be
 resident and it will be mapped to the same file.  Accessing the buffer
 will trigger a page fault, and gfs2 will deadlock trying to take the
 same inode glock again while trying to handle that fault.
 
 Fix that and similar, more complex scenarios by disabling page faults
 while accessing user buffers.  To make this work, introduce a small
 amount of new infrastructure and fix some bugs that didn't trigger so
 far, with page faults enabled.
 -----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCAAyFiEEJZs3krPW0xkhLMTc1b+f6wMTZToFAmGBPisUHGFncnVlbmJh
 QHJlZGhhdC5jb20ACgkQ1b+f6wMTZTpE6A/7BezUnGuNJxJrR8pC+vcLYA7xAgUU
 6STQ6IN7w5UHRlSkNzZxZ2XPxW4uVQ4SxSEeaLqBsHZihepjcLNFZ/8MhQ6UPSD0
 8noHOi7CoIcp6IuWQtCpxRM/xjjm2SlMt2XbVJZaiJcdzCV9gB6TU9EkBRq7Zm/X
 9WFBbv1xZF0skn9ISCJvNtiiI+VyWKgMDUKxJUiTQjmJcklyyqHcVGmQi9BjqPz4
 4s3F+WH6CoGbDKlmNk/6Y9wZ/2+sbvGswVscUxPwJVPoZWsR1xBBUdAeAmEMD1P4
 BgE/Y1J8JXyVPYtyvZKq70XUhKdQkxB7RfX87YasOk9mY4Kjd5rIIGEykh+o2vC9
 kDhCHvf2Mnw5I6Rum3B7UXyB1vemY+fECIHsXhgBnS+ztabRtcAdpCuWoqb43ymw
 yEX1KwXyU4FpRYbrRvdZT42Fmh6ty8TW+N4swg8S2TrffirvgAi5yrcHZ4mPupYv
 lyzvsCW7Wv8hPXn/twNObX+okRgJnsxcCdBXARdCnRXfA8tH23xmu88u8RA1Vdxh
 nzTvv6Dx2EowwojuDWMx29Mw3fA2IqIfbOV+4FaRU7NZ2ZKtknL8yGl27qQUsMoJ
 vYsHTmagasjQr+NDJ3vQRLCw+JQ6B1hENpdkmixFD9moo7X1ZFW3HBi/UL973Bv6
 5CmgeXto8FRUFjI=
 =WeNd
 -----END PGP SIGNATURE-----

Merge tag 'gfs2-v5.15-rc5-mmap-fault' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2

Pull gfs2 mmap + page fault deadlocks fixes from Andreas Gruenbacher:
 "Functions gfs2_file_read_iter and gfs2_file_write_iter are both
  accessing the user buffer to write to or read from while holding the
  inode glock.

  In the most basic deadlock scenario, that buffer will not be resident
  and it will be mapped to the same file. Accessing the buffer will
  trigger a page fault, and gfs2 will deadlock trying to take the same
  inode glock again while trying to handle that fault.

  Fix that and similar, more complex scenarios by disabling page faults
  while accessing user buffers. To make this work, introduce a small
  amount of new infrastructure and fix some bugs that didn't trigger so
  far, with page faults enabled"

* tag 'gfs2-v5.15-rc5-mmap-fault' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
  gfs2: Fix mmap + page fault deadlocks for direct I/O
  iov_iter: Introduce nofault flag to disable page faults
  gup: Introduce FOLL_NOFAULT flag to disable page faults
  iomap: Add done_before argument to iomap_dio_rw
  iomap: Support partial direct I/O on user copy failures
  iomap: Fix iomap_dio_rw return value for user copies
  gfs2: Fix mmap + page fault deadlocks for buffered I/O
  gfs2: Eliminate ip->i_gh
  gfs2: Move the inode glock locking to gfs2_file_buffered_write
  gfs2: Introduce flag for glock holder auto-demotion
  gfs2: Clean up function may_grant
  gfs2: Add wrapper for iomap_file_buffered_write
  iov_iter: Introduce fault_in_iov_iter_writeable
  iov_iter: Turn iov_iter_fault_in_readable into fault_in_iov_iter_readable
  gup: Turn fault_in_pages_{readable,writeable} into fault_in_{readable,writeable}
  powerpc/kvm: Fix kvm_use_magic_page
  iov_iter: Fix iov_iter_get_pages{,_alloc} page fault return value
2021-11-02 12:25:03 -07:00
..
aops.c ntfs: replace attach_page_buffers with attach_page_private 2020-06-02 10:59:07 -07:00
aops.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
attrib.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
attrib.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
bitmap.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
bitmap.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
collate.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
collate.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
compress.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
debug.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
debug.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
dir.c ntfs: fix ntfs_test_inode and ntfs_init_locked_inode function type 2020-08-07 11:33:21 -07:00
dir.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
endian.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
file.c gfs2: Fix mmap + page fault deadlocks 2021-11-02 12:25:03 -07:00
index.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
index.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
inode.c ntfs: fix validity check for file name attribute 2021-06-29 10:53:45 -07:00
inode.h fs: make helpers idmap mount aware 2021-01-24 14:27:20 +01:00
Kconfig docs: filesystems: fix renamed references 2020-04-20 15:45:22 -06:00
layout.h ntfs: layout.h: delete duplicated words 2021-02-24 13:38:26 -08:00
lcnalloc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
lcnalloc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
logfile.c fs/ntfs: remove unused varibles 2020-12-15 12:13:37 -08:00
logfile.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
malloc.h mm: remove the pgprot argument to __vmalloc 2020-06-02 10:59:11 -07:00
mft.c ntfs: fix ntfs_test_inode and ntfs_init_locked_inode function type 2020-08-07 11:33:21 -07:00
mft.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
mst.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
namei.c ntfs: remove (un)?likely() from IS_ERR() conditions 2019-09-26 10:10:44 -07:00
ntfs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
quota.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
quota.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
runlist.c ntfs: remove (un)?likely() from IS_ERR() conditions 2019-09-26 10:10:44 -07:00
runlist.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
super.c ntfs: use sb_bdev_nr_blocks 2021-10-18 14:43:23 -06:00
sysctl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
sysctl.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
time.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
types.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
unistr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
upcase.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 97 2019-05-24 17:37:53 +02:00
usnjrnl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
usnjrnl.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00
volume.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 96 2019-05-24 17:37:53 +02:00