| 1 | --- a/fs/fuse/dev.c |
| 2 | +++ b/fs/fuse/dev.c |
| 3 | @@ -647,11 +647,20 @@ static int fuse_copy_fill(struct fuse_co |
| 4 | return lock_request(cs->fc, cs->req); |
| 5 | } |
| 6 | |
| 7 | +#ifdef DCACHE_BUG |
| 8 | +extern void (*fuse_flush_cache_all)(void); |
| 9 | +#endif |
| 10 | + |
| 11 | /* Do as much copy to/from userspace buffer as we can */ |
| 12 | static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size) |
| 13 | { |
| 14 | unsigned ncpy = min(*size, cs->len); |
| 15 | if (val) { |
| 16 | +#ifdef DCACHE_BUG |
| 17 | + // patch from mailing list, it is very important, otherwise, |
| 18 | + // can't mount, or ls mount point will hang |
| 19 | + fuse_flush_cache_all(); |
| 20 | +#endif |
| 21 | if (cs->write) |
| 22 | memcpy(cs->buf, *val, ncpy); |
| 23 | else |
| 24 | --- a/fs/fuse/fuse_i.h |
| 25 | +++ b/fs/fuse/fuse_i.h |
| 26 | @@ -8,6 +8,7 @@ |
| 27 | |
| 28 | #ifndef _FS_FUSE_I_H |
| 29 | #define _FS_FUSE_I_H |
| 30 | +#define DCACHE_BUG |
| 31 | |
| 32 | #include <linux/fuse.h> |
| 33 | #include <linux/fs.h> |
| 34 | --- a/fs/fuse/inode.c |
| 35 | +++ b/fs/fuse/inode.c |
| 36 | @@ -1200,6 +1200,10 @@ static int __init fuse_init(void) |
| 37 | printk(KERN_INFO "fuse init (API version %i.%i)\n", |
| 38 | FUSE_KERNEL_VERSION, FUSE_KERNEL_MINOR_VERSION); |
| 39 | |
| 40 | +#ifdef DCACHE_BUG |
| 41 | + printk("fuse init DCACHE_BUG workaround enabled\n"); |
| 42 | +#endif |
| 43 | + |
| 44 | INIT_LIST_HEAD(&fuse_conn_list); |
| 45 | res = fuse_fs_init(); |
| 46 | if (res) |
| 47 | |