summaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/zpl_file.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/module/zfs/zpl_file.c b/module/zfs/zpl_file.c
index fc2b81329..c2e3a6bdc 100644
--- a/module/zfs/zpl_file.c
+++ b/module/zfs/zpl_file.c
@@ -354,7 +354,16 @@ zpl_putpage(struct page *pp, struct writeback_control *wbc, void *data)
{
int error;
+ /*
+ * Disable the normal reclaim path for zpl_putpage(). This
+ * ensures that all memory allocations under this call path
+ * will never enter direct reclaim. If this were to happen
+ * the VM might try to write out additional pages by calling
+ * zpl_putpage() again resulting in a deadlock.
+ */
+ current->flags |= PF_MEMALLOC;
error = -zfs_putpage(pp, wbc, data);
+ current->flags &= ~PF_MEMALLOC;
if (error) {
SetPageError(pp);