X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fzpl_file.c;h=9c27b7f1d3b2f614a0e996f980da858780ab8548;hb=36f86f73f68548f46eb3229c8adf583d59fa9988;hp=5ac41c9d24e9747a649e7e28e1a8bb5fb731e577;hpb=cb2d19010d8fbcf6c22585cd8763fad3ba7db724;p=zfs.git diff --git a/module/zfs/zpl_file.c b/module/zfs/zpl_file.c index 5ac41c9..9c27b7f 100644 --- a/module/zfs/zpl_file.c +++ b/module/zfs/zpl_file.c @@ -357,21 +357,16 @@ zpl_putpage(struct page *pp, struct writeback_control *wbc, void *data) ASSERT(PageLocked(pp)); ASSERT(!PageWriteback(pp)); + ASSERT(!(current->flags & PF_NOFS)); /* - * 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. + * 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. */ - 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; - } + current->flags |= PF_NOFS; + (void) zfs_putpage(mapping->host, pp, wbc); + current->flags &= ~PF_NOFS; return (0); }