[package] fuse24: introduce fuse package for brcm-2.4 (#5186)
[openwrt/svn-archive/archive.git] / package / fuse24 / patches / 113-DCACHE_BUG.patch
1 diff -ruN fuse-2.5.3.orig/kernel/dev.c fuse-2.5.3/kernel/dev.c
2 --- fuse-2.5.3.orig/kernel/dev.c 2006-02-02 19:04:52.000000000 +0200
3 +++ fuse-2.5.3/kernel/dev.c 2008-10-23 10:27:53.000000000 +0300
4 @@ -512,6 +512,9 @@
5 {
6 unsigned long offset;
7 int err;
8 +#ifdef DCACHE_BUG
9 + struct vm_area_struct *vma;
10 +#endif
11
12 unlock_request(cs->req);
13 fuse_copy_finish(cs);
14 @@ -523,14 +526,22 @@
15 cs->nr_segs --;
16 }
17 down_read(&current->mm->mmap_sem);
18 +#ifndef DCACHE_BUG
19 err = get_user_pages(current, current->mm, cs->addr, 1, cs->write, 0,
20 &cs->pg, NULL);
21 +#else
22 + err = get_user_pages(current, current->mm, cs->addr, 1, cs->write, 0,
23 + &cs->pg, &vma);
24 +#endif
25 up_read(&current->mm->mmap_sem);
26 if (err < 0)
27 return err;
28 BUG_ON(err != 1);
29 offset = cs->addr % PAGE_SIZE;
30 cs->mapaddr = kmap_atomic(cs->pg, KM_USER0);
31 +#ifdef DCACHE_BUG
32 + r4k_flush_cache_page(vma, cs->addr);
33 +#endif
34 cs->buf = cs->mapaddr + offset;
35 cs->len = min(PAGE_SIZE - offset, cs->seglen);
36 cs->seglen -= cs->len;
37 @@ -545,6 +556,11 @@
38 {
39 unsigned ncpy = min(*size, cs->len);
40 if (val) {
41 +#ifdef DCACHE_BUG
42 + // patch from mailing list, it is very important, otherwise,
43 + // can't mount, or ls mount point will hang
44 + flush_cache_all();
45 +#endif
46 if (cs->write)
47 memcpy(cs->buf, *val, ncpy);
48 else
49 diff -ruN fuse-2.5.3.orig/kernel/fuse_i.h fuse-2.5.3/kernel/fuse_i.h
50 --- fuse-2.5.3.orig/kernel/fuse_i.h 2006-02-02 19:04:52.000000000 +0200
51 +++ fuse-2.5.3/kernel/fuse_i.h 2008-10-22 18:03:50.000000000 +0300
52 @@ -45,6 +45,10 @@
53 # endif
54 #endif
55
56 +//#if defined(__arm__) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
57 +#define DCACHE_BUG
58 +//#endif
59 +
60 #include "config.h"
61 #ifndef KERNEL_2_6
62 # include <linux/config.h>
63