3 @@ -525,6 +525,11 @@ static void fuse_copy_finish(struct fuse
8 +extern void (*fuse_flush_cache_all)(void);
9 +extern void (*fuse_flush_cache_page)(struct vm_area_struct *vma, unsigned long page, unsigned long pfn);
13 * Get another pagefull of userspace buffer, and map it to kernel
14 * address space, and lock request
15 @@ -533,6 +538,9 @@ static int fuse_copy_fill(struct fuse_co
20 + struct vm_area_struct *vma;
23 unlock_request(cs->fc, cs->req);
25 @@ -544,14 +552,22 @@ static int fuse_copy_fill(struct fuse_co
28 down_read(¤t->mm->mmap_sem);
30 err = get_user_pages(current, current->mm, cs->addr, 1, cs->write, 0,
33 + err = get_user_pages(current, current->mm, cs->addr, 1, cs->write, 0,
36 up_read(¤t->mm->mmap_sem);
40 offset = cs->addr % PAGE_SIZE;
41 cs->mapaddr = kmap_atomic(cs->pg, KM_USER0);
43 + fuse_flush_cache_page(vma, cs->addr, page_to_pfn(cs->pg));
45 cs->buf = cs->mapaddr + offset;
46 cs->len = min(PAGE_SIZE - offset, cs->seglen);
47 cs->seglen -= cs->len;
48 @@ -565,6 +581,11 @@ static int fuse_copy_do(struct fuse_copy
50 unsigned ncpy = min(*size, cs->len);
53 + // patch from mailing list, it is very important, otherwise,
54 + // can't mount, or ls mount point will hang
55 + fuse_flush_cache_all();
58 memcpy(cs->buf, *val, ncpy);
60 --- a/fs/fuse/fuse_i.h
61 +++ b/fs/fuse/fuse_i.h
68 #include <linux/fuse.h>
72 @@ -1038,6 +1038,10 @@ static int __init fuse_init(void)
73 printk("fuse init (API version %i.%i)\n",
74 FUSE_KERNEL_VERSION, FUSE_KERNEL_MINOR_VERSION);
77 +printk("fuse init: DCACHE_BUG enabled\n");
80 INIT_LIST_HEAD(&fuse_conn_list);