Commit f6d47a1761896dcd89e3184399a8962dff17267d

Authored by Miklos Szeredi
Committed by Miklos Szeredi
1 parent 26c3679101

fuse: fix poll notify

Move fuse_copy_finish() to before calling fuse_notify_poll_wakeup().
This is not a big issue because fuse_notify_poll_wakeup() should be
atomic, but it's cleaner this way, and later uses of notification will
need to be able to finish the copying before performing some actions.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>

Showing 1 changed file with 9 additions and 4 deletions Side-by-side Diff

... ... @@ -826,16 +826,21 @@
826 826 struct fuse_copy_state *cs)
827 827 {
828 828 struct fuse_notify_poll_wakeup_out outarg;
829   - int err;
  829 + int err = -EINVAL;
830 830  
831 831 if (size != sizeof(outarg))
832   - return -EINVAL;
  832 + goto err;
833 833  
834 834 err = fuse_copy_one(cs, &outarg, sizeof(outarg));
835 835 if (err)
836   - return err;
  836 + goto err;
837 837  
  838 + fuse_copy_finish(cs);
838 839 return fuse_notify_poll_wakeup(fc, &outarg);
  840 +
  841 +err:
  842 + fuse_copy_finish(cs);
  843 + return err;
839 844 }
840 845  
841 846 static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code,
... ... @@ -846,6 +851,7 @@
846 851 return fuse_notify_poll(fc, size, cs);
847 852  
848 853 default:
  854 + fuse_copy_finish(cs);
849 855 return -EINVAL;
850 856 }
851 857 }
... ... @@ -924,7 +930,6 @@
924 930 */
925 931 if (!oh.unique) {
926 932 err = fuse_notify(fc, oh.error, nbytes - sizeof(oh), &cs);
927   - fuse_copy_finish(&cs);
928 933 return err ? err : nbytes;
929 934 }
930 935