this patches fixes iproute2 parallel build.
[openwrt-10.03/.git] / package / fuse24 / patches / 113-DCACHE_BUG.patch
1 --- a/kernel/dev.c
2 +++ b/kernel/dev.c
3 @@ -512,6 +512,9 @@ static int fuse_copy_fill(struct fuse_co
4  {
5         unsigned long offset;
6         int err;
7 +#ifdef DCACHE_BUG
8 +       struct vm_area_struct *vma;
9 +#endif
10  
11         unlock_request(cs->req);
12         fuse_copy_finish(cs);
13 @@ -523,14 +526,22 @@ static int fuse_copy_fill(struct fuse_co
14                 cs->nr_segs --;
15         }
16         down_read(&current->mm->mmap_sem);
17 +#ifndef DCACHE_BUG
18         err = get_user_pages(current, current->mm, cs->addr, 1, cs->write, 0,
19                              &cs->pg, NULL);
20 +#else
21 +       err = get_user_pages(current, current->mm, cs->addr, 1, cs->write, 0,
22 +                            &cs->pg, &vma);
23 +#endif
24         up_read(&current->mm->mmap_sem);
25         if (err < 0)
26                 return err;
27         BUG_ON(err != 1);
28         offset = cs->addr % PAGE_SIZE;
29         cs->mapaddr = kmap_atomic(cs->pg, KM_USER0);
30 +#ifdef DCACHE_BUG
31 +       r4k_flush_cache_page(vma, cs->addr); 
32 +#endif
33         cs->buf = cs->mapaddr + offset;
34         cs->len = min(PAGE_SIZE - offset, cs->seglen);
35         cs->seglen -= cs->len;
36 @@ -545,6 +556,11 @@ static inline int fuse_copy_do(struct fu
37  {
38         unsigned ncpy = min(*size, cs->len);
39         if (val) {
40 +#ifdef DCACHE_BUG
41 +               // patch from mailing list, it is very important, otherwise,
42 +               // can't mount, or ls mount point will hang
43 +               flush_cache_all();
44 +#endif
45                 if (cs->write)
46                         memcpy(cs->buf, *val, ncpy);
47                 else
48 --- a/kernel/fuse_i.h
49 +++ b/kernel/fuse_i.h
50 @@ -45,6 +45,10 @@
51  #  endif
52  #endif
53  
54 +//#if defined(__arm__) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
55 +#define DCACHE_BUG
56 +//#endif
57 +
58  #include "config.h"
59  #ifndef KERNEL_2_6
60  #  include <linux/config.h>
61 --- a/kernel/inode.c
62 +++ b/kernel/inode.c
63 @@ -739,6 +739,10 @@ static int __init fuse_init(void)
64         printk("fuse distribution version: %s\n", FUSE_VERSION);
65  #endif
66  
67 +#ifdef DCACHE_BUG
68 +printk("fuse init: DCACHE_BUG enabled\n");
69 +#endif
70 +
71         spin_lock_init(&fuse_lock);
72         res = fuse_fs_init();
73         if (res)