summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/zfs/zpl_file.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/module/zfs/zpl_file.c b/module/zfs/zpl_file.c
index af46afddf..298c0b62d 100644
--- a/module/zfs/zpl_file.c
+++ b/module/zfs/zpl_file.c
@@ -324,9 +324,13 @@ zpl_putpage(struct page *pp, struct writeback_control *wbc, void *data)
* the VM might try to write out additional pages by calling
* zpl_putpage() again resulting in a deadlock.
*/
- current->flags |= PF_MEMALLOC;
- (void) zfs_putpage(mapping->host, pp, wbc);
- current->flags &= ~PF_MEMALLOC;
+ if (current->flags & PF_MEMALLOC) {
+ (void) zfs_putpage(mapping->host, pp, wbc);
+ } else {
+ current->flags |= PF_MEMALLOC;
+ (void) zfs_putpage(mapping->host, pp, wbc);
+ current->flags &= ~PF_MEMALLOC;
+ }
return (0);
}