302-kmod-fuse-dcache-bug-fuse.patch 1.2 KB

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