Illumos #3805 arc shouldn't cache freed blocks
[zfs.git] / module / zfs / zpl_file.c
index 2e9f72a..db6a72c 100644 (file)
@@ -357,8 +357,16 @@ zpl_putpage(struct page *pp, struct writeback_control *wbc, void *data)
 
        ASSERT(PageLocked(pp));
        ASSERT(!PageWriteback(pp));
-
+       ASSERT(!(current->flags & PF_NOFS));
+
+       /*
+        * Annotate this call path with a flag that indicates that it is
+        * unsafe to use KM_SLEEP during memory allocations due to the
+        * potential for a deadlock.  KM_PUSHPAGE should be used instead.
+        */
+       current->flags |= PF_NOFS;
        (void) zfs_putpage(mapping->host, pp, wbc);
+       current->flags &= ~PF_NOFS;
 
        return (0);
 }
@@ -438,7 +446,6 @@ const struct file_operations zpl_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = zpl_read,
        .write          = zpl_write,
-       .readdir        = zpl_readdir,
        .mmap           = zpl_mmap,
        .fsync          = zpl_fsync,
 #ifdef HAVE_FILE_FALLOCATE