aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2009-01-26 09:00:59 -0500
committerMiklos Szeredi <mszeredi@suse.de>2009-01-26 09:00:59 -0500
commitf6d47a1761896dcd89e3184399a8962dff17267d (patch)
tree60a7f1eee203f07db6f2a9d890b8ec78f190ea57
parent26c3679101dbccc054dcf370143941844ba70531 (diff)
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>
-rw-r--r--fs/fuse/dev.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index c4a3d9bbdaa8..ba76b68c52ff 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -826,16 +826,21 @@ static int fuse_notify_poll(struct fuse_conn *fc, unsigned int size,
826 struct fuse_copy_state *cs) 826 struct fuse_copy_state *cs)
827{ 827{
828 struct fuse_notify_poll_wakeup_out outarg; 828 struct fuse_notify_poll_wakeup_out outarg;
829 int err; 829 int err = -EINVAL;
830 830
831 if (size != sizeof(outarg)) 831 if (size != sizeof(outarg))
832 return -EINVAL; 832 goto err;
833 833
834 err = fuse_copy_one(cs, &outarg, sizeof(outarg)); 834 err = fuse_copy_one(cs, &outarg, sizeof(outarg));
835 if (err) 835 if (err)
836 return err; 836 goto err;
837 837
838 fuse_copy_finish(cs);
838 return fuse_notify_poll_wakeup(fc, &outarg); 839 return fuse_notify_poll_wakeup(fc, &outarg);
840
841err:
842 fuse_copy_finish(cs);
843 return err;
839} 844}
840 845
841static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, 846static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code,
@@ -846,6 +851,7 @@ static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code,
846 return fuse_notify_poll(fc, size, cs); 851 return fuse_notify_poll(fc, size, cs);
847 852
848 default: 853 default:
854 fuse_copy_finish(cs);
849 return -EINVAL; 855 return -EINVAL;
850 } 856 }
851} 857}
@@ -924,7 +930,6 @@ static ssize_t fuse_dev_write(struct kiocb *iocb, const struct iovec *iov,
924 */ 930 */
925 if (!oh.unique) { 931 if (!oh.unique) {
926 err = fuse_notify(fc, oh.error, nbytes - sizeof(oh), &cs); 932 err = fuse_notify(fc, oh.error, nbytes - sizeof(oh), &cs);
927 fuse_copy_finish(&cs);
928 return err ? err : nbytes; 933 return err ? err : nbytes;
929 } 934 }
930 935