kernel - Attempt to fix cluster pbuf deadlock on recursive filesystems
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 8 Nov 2016 02:56:34 +0000 (18:56 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 8 Nov 2016 02:56:34 +0000 (18:56 -0800)
commitd84f6fa13c474015da98ec341ce61ed6d737bcae
tree99b9c67c0289065f962bdc8e3e6edc7ee8348fbb
parent743e39a36cb64ab7b295cec62ca998c4ac3ac7a1
kernel - Attempt to fix cluster pbuf deadlock on recursive filesystems

* Change global pbuf count limits (used primarily for clustered I/O) to
  per-mount and per-device limits.  The per-mount / per-device limit
  is set to nswbuf_kva / 10, allowing 10 different entities to obtain
  pbufs concurrently without interference.

* This change goes a long way towards fixing deadlocks that could occur
  with the old global system (a global limit of nswbuf_kva / 2) when
  the I/O system recurses through a virtual block device or filesystem.
  Two examples of virtual block devices are the 'vn' device and the crypto
  layer.

* We also note that even normal filesystem read and write I/O strategy calls
  will recurse at least once to dive the underlying block device.  DFly also
  had issues with pbuf hogging by one mount causing unnecessary stalls
  in other mounts.  This fix also prevents pbuf hogging.

* Remove unused internal O_MAPONREAD flag.

Reported-by: htse, multiple
Testing-by: htse, dillon
12 files changed:
sys/kern/vfs_cluster.c
sys/kern/vfs_conf.c
sys/kern/vfs_lock.c
sys/kern/vfs_mount.c
sys/kern/vfs_syscalls.c
sys/kern/vfs_vnops.c
sys/sys/buf.h
sys/sys/fcntl.h
sys/sys/mount.h
sys/sys/vnode.h
sys/vfs/ufs/ffs_rawread.c
sys/vm/vm_pager.c