From: Greg Kroah-Hartman Date: Fri, 4 Oct 2019 07:57:44 +0000 (+0200) Subject: fix up queue-4.19/fuse-fix-deadlock-with-aio-poll-and-fuse_iqueue-wait.patch X-Git-Tag: v4.4.195~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d1e9082e8ffbadbf46dbc53bb074c9732c1350cc;p=thirdparty%2Fkernel%2Fstable-queue.git fix up queue-4.19/fuse-fix-deadlock-with-aio-poll-and-fuse_iqueue-wait.patch --- diff --git a/queue-4.19/fuse-fix-deadlock-with-aio-poll-and-fuse_iqueue-wait.patch b/queue-4.19/fuse-fix-deadlock-with-aio-poll-and-fuse_iqueue-wait.patch index 0cc93843fa4..04fc9462440 100644 --- a/queue-4.19/fuse-fix-deadlock-with-aio-poll-and-fuse_iqueue-wait.patch +++ b/queue-4.19/fuse-fix-deadlock-with-aio-poll-and-fuse_iqueue-wait.patch @@ -75,16 +75,14 @@ Signed-off-by: Eric Biggers Signed-off-by: Miklos Szeredi Signed-off-by: Sasha Levin --- - fs/fuse/dev.c | 89 +++++++++++++++++++++++++----------------------- - fs/fuse/fuse_i.h | 3 ++ - fs/fuse/inode.c | 1 + - 3 files changed, 50 insertions(+), 43 deletions(-) + fs/fuse/dev.c | 91 ++++++++++++++++++++++++++++--------------------------- + fs/fuse/fuse_i.h | 3 + + fs/fuse/inode.c | 1 + 3 files changed, 51 insertions(+), 44 deletions(-) -diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c -index 6ee471b72a34d..c0d59a86ada2e 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c -@@ -331,7 +331,7 @@ static void queue_request(struct fuse_iqueue *fiq, struct fuse_req *req) +@@ -331,7 +331,7 @@ static void queue_request(struct fuse_iq req->in.h.len = sizeof(struct fuse_in_header) + len_args(req->in.numargs, (struct fuse_arg *) req->in.args); list_add_tail(&req->list, &fiq->pending); @@ -93,7 +91,7 @@ index 6ee471b72a34d..c0d59a86ada2e 100644 kill_fasync(&fiq->fasync, SIGIO, POLL_IN); } -@@ -343,16 +343,16 @@ void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget, +@@ -343,16 +343,16 @@ void fuse_queue_forget(struct fuse_conn forget->forget_one.nodeid = nodeid; forget->forget_one.nlookup = nlookup; @@ -113,7 +111,7 @@ index 6ee471b72a34d..c0d59a86ada2e 100644 } static void flush_bg_queue(struct fuse_conn *fc) -@@ -365,10 +365,10 @@ static void flush_bg_queue(struct fuse_conn *fc) +@@ -365,10 +365,10 @@ static void flush_bg_queue(struct fuse_c req = list_entry(fc->bg_queue.next, struct fuse_req, list); list_del(&req->list); fc->active_background++; @@ -126,7 +124,7 @@ index 6ee471b72a34d..c0d59a86ada2e 100644 } } -@@ -387,9 +387,9 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req) +@@ -387,9 +387,9 @@ static void request_end(struct fuse_conn if (test_and_set_bit(FR_FINISHED, &req->flags)) goto put_request; @@ -138,7 +136,7 @@ index 6ee471b72a34d..c0d59a86ada2e 100644 WARN_ON(test_bit(FR_PENDING, &req->flags)); WARN_ON(test_bit(FR_SENT, &req->flags)); if (test_bit(FR_BACKGROUND, &req->flags)) { -@@ -427,16 +427,16 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req) +@@ -427,16 +427,16 @@ put_request: static void queue_interrupt(struct fuse_iqueue *fiq, struct fuse_req *req) { @@ -151,14 +149,15 @@ index 6ee471b72a34d..c0d59a86ada2e 100644 } if (list_empty(&req->intr_entry)) { list_add_tail(&req->intr_entry, &fiq->interrupts); - wake_up_locked(&fiq->waitq); +- wake_up_locked(&fiq->waitq); ++ wake_up(&fiq->waitq); } - spin_unlock(&fiq->waitq.lock); + spin_unlock(&fiq->lock); kill_fasync(&fiq->fasync, SIGIO, POLL_IN); } -@@ -466,16 +466,16 @@ static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req) +@@ -466,16 +466,16 @@ static void request_wait_answer(struct f if (!err) return; @@ -178,7 +177,7 @@ index 6ee471b72a34d..c0d59a86ada2e 100644 } /* -@@ -490,9 +490,9 @@ static void __fuse_request_send(struct fuse_conn *fc, struct fuse_req *req) +@@ -490,9 +490,9 @@ static void __fuse_request_send(struct f struct fuse_iqueue *fiq = &fc->iq; BUG_ON(test_bit(FR_BACKGROUND, &req->flags)); @@ -190,7 +189,7 @@ index 6ee471b72a34d..c0d59a86ada2e 100644 req->out.h.error = -ENOTCONN; } else { req->in.h.unique = fuse_get_unique(fiq); -@@ -500,7 +500,7 @@ static void __fuse_request_send(struct fuse_conn *fc, struct fuse_req *req) +@@ -500,7 +500,7 @@ static void __fuse_request_send(struct f /* acquire extra reference, since request is still needed after request_end() */ __fuse_get_request(req); @@ -199,7 +198,7 @@ index 6ee471b72a34d..c0d59a86ada2e 100644 request_wait_answer(fc, req); /* Pairs with smp_wmb() in request_end() */ -@@ -633,12 +633,12 @@ static int fuse_request_send_notify_reply(struct fuse_conn *fc, +@@ -633,12 +633,12 @@ static int fuse_request_send_notify_repl __clear_bit(FR_ISREPLY, &req->flags); req->in.h.unique = unique; @@ -214,7 +213,7 @@ index 6ee471b72a34d..c0d59a86ada2e 100644 return err; } -@@ -1082,12 +1082,12 @@ static int request_pending(struct fuse_iqueue *fiq) +@@ -1082,12 +1082,12 @@ static int request_pending(struct fuse_i * Unlike other requests this is assembled on demand, without a need * to allocate a separate fuse_req structure. * @@ -238,7 +237,7 @@ index 6ee471b72a34d..c0d59a86ada2e 100644 if (nbytes < reqsize) return -EINVAL; -@@ -1140,7 +1140,7 @@ static struct fuse_forget_link *dequeue_forget(struct fuse_iqueue *fiq, +@@ -1140,7 +1140,7 @@ static struct fuse_forget_link *dequeue_ static int fuse_read_single_forget(struct fuse_iqueue *fiq, struct fuse_copy_state *cs, size_t nbytes) @@ -290,7 +289,7 @@ index 6ee471b72a34d..c0d59a86ada2e 100644 { if (fc->minor < 16 || fiq->forget_list_head.next->next == NULL) return fuse_read_single_forget(fiq, cs, nbytes); -@@ -1251,16 +1251,19 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, +@@ -1251,16 +1251,19 @@ static ssize_t fuse_dev_do_read(struct f unsigned reqsize; restart: @@ -318,7 +317,7 @@ index 6ee471b72a34d..c0d59a86ada2e 100644 if (!fiq->connected) { err = (fc->aborted && fc->abort_err) ? -ECONNABORTED : -ENODEV; -@@ -1284,7 +1287,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, +@@ -1284,7 +1287,7 @@ static ssize_t fuse_dev_do_read(struct f req = list_entry(fiq->pending.next, struct fuse_req, list); clear_bit(FR_PENDING, &req->flags); list_del_init(&req->list); @@ -327,7 +326,7 @@ index 6ee471b72a34d..c0d59a86ada2e 100644 in = &req->in; reqsize = in->h.len; -@@ -1341,7 +1344,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, +@@ -1341,7 +1344,7 @@ out_end: return err; err_unlock: @@ -336,7 +335,7 @@ index 6ee471b72a34d..c0d59a86ada2e 100644 return err; } -@@ -2054,12 +2057,12 @@ static __poll_t fuse_dev_poll(struct file *file, poll_table *wait) +@@ -2054,12 +2057,12 @@ static __poll_t fuse_dev_poll(struct fil fiq = &fud->fc->iq; poll_wait(file, &fiq->waitq, wait); @@ -351,7 +350,7 @@ index 6ee471b72a34d..c0d59a86ada2e 100644 return mask; } -@@ -2150,15 +2153,15 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) +@@ -2150,15 +2153,15 @@ void fuse_abort_conn(struct fuse_conn *f fc->max_background = UINT_MAX; flush_bg_queue(fc); @@ -370,8 +369,6 @@ index 6ee471b72a34d..c0d59a86ada2e 100644 kill_fasync(&fiq->fasync, SIGIO, POLL_IN); end_polls(fc); wake_up_all(&fc->blocked_waitq); -diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h -index cec8b8e749695..900bdcf79bfc0 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -388,6 +388,9 @@ struct fuse_iqueue { @@ -384,11 +381,9 @@ index cec8b8e749695..900bdcf79bfc0 100644 /** Readers of the connection are waiting on this */ wait_queue_head_t waitq; -diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c -index db9e60b7eb691..cb018315ecaf5 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c -@@ -585,6 +585,7 @@ static int fuse_show_options(struct seq_file *m, struct dentry *root) +@@ -585,6 +585,7 @@ static int fuse_show_options(struct seq_ static void fuse_iqueue_init(struct fuse_iqueue *fiq) { memset(fiq, 0, sizeof(struct fuse_iqueue)); @@ -396,6 +391,3 @@ index db9e60b7eb691..cb018315ecaf5 100644 init_waitqueue_head(&fiq->waitq); INIT_LIST_HEAD(&fiq->pending); INIT_LIST_HEAD(&fiq->interrupts); --- -2.20.1 -