]> err.no Git - linux-2.6/blobdiff - fs/ocfs2/mmap.c
ocfs2: Force use of GFP_NOFS in ocfs2_write()
[linux-2.6] / fs / ocfs2 / mmap.c
index 69f85ae392dcc9ab0a830a71c576dabda1f779b0..af01158b39f553fd7f04f7970ce0a88d4293953c 100644 (file)
@@ -83,10 +83,15 @@ static struct vm_operations_struct ocfs2_file_vm_ops = {
 int ocfs2_mmap(struct file *file, struct vm_area_struct *vma)
 {
        int ret = 0, lock_level = 0;
+       struct ocfs2_super *osb = OCFS2_SB(file->f_dentry->d_inode->i_sb);
 
-       /* We don't want to support shared writable mappings yet. */
-       if (((vma->vm_flags & VM_SHARED) || (vma->vm_flags & VM_MAYSHARE))
-           && ((vma->vm_flags & VM_WRITE) || (vma->vm_flags & VM_MAYWRITE))) {
+       /*
+        * Only support shared writeable mmap for local mounts which
+        * don't know about holes.
+        */
+       if ((!ocfs2_mount_local(osb) || ocfs2_sparse_alloc(osb)) &&
+           ((vma->vm_flags & VM_SHARED) || (vma->vm_flags & VM_MAYSHARE)) &&
+           ((vma->vm_flags & VM_WRITE) || (vma->vm_flags & VM_MAYWRITE))) {
                mlog(0, "disallow shared writable mmaps %lx\n", vma->vm_flags);
                /* This is -EINVAL because generic_file_readonly_mmap
                 * returns it in a similar situation. */