mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 11:18:52 +03:00
Mark IO pipeline with PF_FSTRANS
In order to avoid deadlocking in the IO pipeline it is critical that pageout be avoided during direct memory reclaim. This ensures that the pipeline threads can always make forward progress and never end up blocking on a DMU transaction. For this very reason Linux now provides the PF_FSTRANS flag which may be set in the process context. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
@@ -161,6 +161,17 @@ vdev_file_io_strategy(void *arg)
|
||||
zio_interrupt(zio);
|
||||
}
|
||||
|
||||
static void
|
||||
vdev_file_io_fsync(void *arg)
|
||||
{
|
||||
zio_t *zio = (zio_t *)arg;
|
||||
vdev_file_t *vf = zio->io_vd->vdev_tsd;
|
||||
|
||||
zio->io_error = VOP_FSYNC(vf->vf_vnode, FSYNC | FDSYNC, kcred, NULL);
|
||||
|
||||
zio_interrupt(zio);
|
||||
}
|
||||
|
||||
static int
|
||||
vdev_file_io_start(zio_t *zio)
|
||||
{
|
||||
@@ -180,6 +191,19 @@ vdev_file_io_start(zio_t *zio)
|
||||
if (zfs_nocacheflush)
|
||||
break;
|
||||
|
||||
/*
|
||||
* We cannot safely call vfs_fsync() when PF_FSTRANS
|
||||
* is set in the current context. Filesystems like
|
||||
* XFS include sanity checks to verify it is not
|
||||
* already set, see xfs_vm_writepage(). Therefore
|
||||
* the sync must be dispatched to a different context.
|
||||
*/
|
||||
if (spl_fstrans_check()) {
|
||||
VERIFY3U(taskq_dispatch(vdev_file_taskq,
|
||||
vdev_file_io_fsync, zio, TQ_SLEEP), !=, 0);
|
||||
return (ZIO_PIPELINE_STOP);
|
||||
}
|
||||
|
||||
zio->io_error = VOP_FSYNC(vf->vf_vnode, FSYNC | FDSYNC,
|
||||
kcred, NULL);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user