Commit f6d47a17 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Miklos Szeredi

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: default avatarMiklos Szeredi <mszeredi@suse.cz>
parent 26c36791
...@@ -826,16 +826,21 @@ static int fuse_notify_poll(struct fuse_conn *fc, unsigned int size, ...@@ -826,16 +826,21 @@ static int fuse_notify_poll(struct fuse_conn *fc, unsigned int size,
struct fuse_copy_state *cs) struct fuse_copy_state *cs)
{ {
struct fuse_notify_poll_wakeup_out outarg; struct fuse_notify_poll_wakeup_out outarg;
int err; int err = -EINVAL;
if (size != sizeof(outarg)) if (size != sizeof(outarg))
return -EINVAL; goto err;
err = fuse_copy_one(cs, &outarg, sizeof(outarg)); err = fuse_copy_one(cs, &outarg, sizeof(outarg));
if (err) if (err)
return err; goto err;
fuse_copy_finish(cs);
return fuse_notify_poll_wakeup(fc, &outarg); return fuse_notify_poll_wakeup(fc, &outarg);
err:
fuse_copy_finish(cs);
return err;
} }
static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, static 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,6 +851,7 @@ static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code,
return fuse_notify_poll(fc, size, cs); return fuse_notify_poll(fc, size, cs);
default: default:
fuse_copy_finish(cs);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -924,7 +930,6 @@ static ssize_t fuse_dev_write(struct kiocb *iocb, const struct iovec *iov, ...@@ -924,7 +930,6 @@ static ssize_t fuse_dev_write(struct kiocb *iocb, const struct iovec *iov,
*/ */
if (!oh.unique) { if (!oh.unique) {
err = fuse_notify(fc, oh.error, nbytes - sizeof(oh), &cs); err = fuse_notify(fc, oh.error, nbytes - sizeof(oh), &cs);
fuse_copy_finish(&cs);
return err ? err : nbytes; return err ? err : nbytes;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment