From: Nikolaus Rath Date: Tue, 4 Oct 2016 03:23:42 +0000 (-0700) Subject: fuse_lowlevel_notify_poll(): use master channel X-Git-Tag: fuse-3.0.0rc1~94 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=e572cfbd3490add057b867c29d37da51ee8217e5;p=qemu-gpiodev%2Flibfuse.git fuse_lowlevel_notify_poll(): use master channel In theory, a poll handle could hang around much longer than the worker thread that creates it. Furthermore, the thread that created the pollhandle is no more likely to call fuse_lowlevel_notify_poll() than any other thread. In theory, this would have kept the channel alive for much longer than necessary. In practice, there seems to have been a bug that prevented this - and instead allowed the channel to be destroyed while there was still a pollhandle referring to it. Instead of fixing this by calling fuse_chan_get() and fuse_chan_put() in do_poll() and fuse_pollhandle_destroy(), we simply transmit poll notifications over the master channel now. --- diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 82cbe06..d7b1fd1 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -44,8 +44,7 @@ struct fuse_pollhandle { uint64_t kh; - struct fuse_chan *ch; - struct fuse_ll *f; + struct fuse_session *se; }; static size_t pagesize; @@ -1794,8 +1793,7 @@ static void do_poll(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) return; } ph->kh = arg->kh; - ph->ch = req->ch; - ph->f = req->f; + ph->se = req->se; } req->f->op.poll(req, nodeid, &fi, ph); @@ -2110,7 +2108,8 @@ int fuse_lowlevel_notify_poll(struct fuse_pollhandle *ph) iov[1].iov_base = &outarg; iov[1].iov_len = sizeof(outarg); - return send_notify_iov(ph->f, ph->ch, FUSE_NOTIFY_POLL, iov, 2); + return send_notify_iov(ph->se->f, ph->se->ch, + FUSE_NOTIFY_POLL, iov, 2); } else { return 0; }