X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fzpl_file.c;h=c2e3a6bdcf489811b03035a1fc7f39bb060967c2;hb=0da78696904f6e0e7cfedd2a0296879f47717f4f;hp=0e90b78036ca05961be3c1f6e5cc05d25ae22bd7;hpb=dde471ef5a07bd569deeadd3e9a88655db3e10ab;p=zfs.git diff --git a/module/zfs/zpl_file.c b/module/zfs/zpl_file.c index 0e90b78..c2e3a6b 100644 --- a/module/zfs/zpl_file.c +++ b/module/zfs/zpl_file.c @@ -240,9 +240,15 @@ zpl_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos) static int zpl_mmap(struct file *filp, struct vm_area_struct *vma) { - znode_t *zp = ITOZ(filp->f_mapping->host); + struct inode *ip = filp->f_mapping->host; + znode_t *zp = ITOZ(ip); int error; + error = -zfs_map(ip, vma->vm_pgoff, (caddr_t *)vma->vm_start, + (size_t)(vma->vm_end - vma->vm_start), vma->vm_flags); + if (error) + return (error); + error = generic_file_mmap(filp, vma); if (error) return (error); @@ -348,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);