Re: [PATCH 4.19 209/211] fuse: fix deadlock with aio poll and fuse_iqueue::waitq.lock

From: Greg Kroah-Hartman
Date: Fri Oct 04 2019 - 04:00:10 EST


On Thu, Oct 03, 2019 at 12:48:39PM -0700, Eric Biggers wrote:
> On Thu, Oct 03, 2019 at 05:54:35PM +0200, Greg Kroah-Hartman wrote:
> >
> > static void queue_interrupt(struct fuse_iqueue *fiq, struct fuse_req *req)
> > {
> > - spin_lock(&fiq->waitq.lock);
> > + spin_lock(&fiq->lock);
> > if (test_bit(FR_FINISHED, &req->flags)) {
> > - spin_unlock(&fiq->waitq.lock);
> > + spin_unlock(&fiq->lock);
> > return;
> > }
> > if (list_empty(&req->intr_entry)) {
> > list_add_tail(&req->intr_entry, &fiq->interrupts);
> > wake_up_locked(&fiq->waitq);
> > }
> > - spin_unlock(&fiq->waitq.lock);
> > + spin_unlock(&fiq->lock);
> > kill_fasync(&fiq->fasync, SIGIO, POLL_IN);
> > }
>
> This isn't backported correctly. wake_up_locked() needs to be changed to wake_up().
>
> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
> index c0d59a86ada2e..6d39143cfa094 100644
> --- a/fs/fuse/dev.c
> +++ b/fs/fuse/dev.c
> @@ -434,7 +434,7 @@ static void queue_interrupt(struct fuse_iqueue *fiq, struct fuse_req *req)
> }
> if (list_empty(&req->intr_entry)) {
> list_add_tail(&req->intr_entry, &fiq->interrupts);
> - wake_up_locked(&fiq->waitq);
> + wake_up(&fiq->waitq);
> }
> spin_unlock(&fiq->lock);
> kill_fasync(&fiq->fasync, SIGIO, POLL_IN);

Thanks for the update and for looking at this. Now added to the
original patch and pushed out as part of a -rc3.

thanks,

greg k-h