All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH stable backport] net/9p: Switch to wait_event_killable()
@ 2017-11-27 23:44 Tuomas Tynkkynen
  2017-11-28  8:40 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Tuomas Tynkkynen @ 2017-11-27 23:44 UTC (permalink / raw)
  To: stable; +Cc: Tuomas Tynkkynen, Al Viro

commit 9523feac272ccad2ad8186ba4fcc89103754de52 upstream, with changes
to net/9p/trans_xen.c dropped as that driver was only added in 4.12.

Because userspace gets Very Unhappy when calls like stat() and execve()
return -EINTR on 9p filesystem mounts. For instance, when bash is
looking in PATH for things to execute and some SIGCHLD interrupts
stat(), bash can throw a spurious 'command not found' since it doesn't
retry the stat().

In practice, hitting the problem is rare and needs a really
slow/bogged down 9p server.

Cc: stable@vger.kernel.org
Signed-off-by: Tuomas Tynkkynen <tuomas@tuxera.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
This backport applies to stable trees for 4.9 and below.
---
 net/9p/client.c       |  3 +--
 net/9p/trans_virtio.c | 13 ++++++-------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/net/9p/client.c b/net/9p/client.c
index cf129fec7329..1fd60190177e 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -749,8 +749,7 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...)
 	}
 again:
 	/* Wait for the response */
-	err = wait_event_interruptible(*req->wq,
-				       req->status >= REQ_STATUS_RCVD);
+	err = wait_event_killable(*req->wq, req->status >= REQ_STATUS_RCVD);
 
 	/*
 	 * Make sure our req is coherent with regard to updates in other
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index f24b25c25106..f3a4efcf1456 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -286,8 +286,8 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req)
 		if (err == -ENOSPC) {
 			chan->ring_bufs_avail = 0;
 			spin_unlock_irqrestore(&chan->lock, flags);
-			err = wait_event_interruptible(*chan->vc_wq,
-							chan->ring_bufs_avail);
+			err = wait_event_killable(*chan->vc_wq,
+						  chan->ring_bufs_avail);
 			if (err  == -ERESTARTSYS)
 				return err;
 
@@ -327,7 +327,7 @@ static int p9_get_mapped_pages(struct virtio_chan *chan,
 		 * Other zc request to finish here
 		 */
 		if (atomic_read(&vp_pinned) >= chan->p9_max_pages) {
-			err = wait_event_interruptible(vp_wq,
+			err = wait_event_killable(vp_wq,
 			      (atomic_read(&vp_pinned) < chan->p9_max_pages));
 			if (err == -ERESTARTSYS)
 				return err;
@@ -471,8 +471,8 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req,
 		if (err == -ENOSPC) {
 			chan->ring_bufs_avail = 0;
 			spin_unlock_irqrestore(&chan->lock, flags);
-			err = wait_event_interruptible(*chan->vc_wq,
-						       chan->ring_bufs_avail);
+			err = wait_event_killable(*chan->vc_wq,
+						  chan->ring_bufs_avail);
 			if (err  == -ERESTARTSYS)
 				goto err_out;
 
@@ -489,8 +489,7 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req,
 	virtqueue_kick(chan->vq);
 	spin_unlock_irqrestore(&chan->lock, flags);
 	p9_debug(P9_DEBUG_TRANS, "virtio request kicked\n");
-	err = wait_event_interruptible(*req->wq,
-				       req->status >= REQ_STATUS_RCVD);
+	err = wait_event_killable(*req->wq, req->status >= REQ_STATUS_RCVD);
 	/*
 	 * Non kernel buffers are pinned, unpin them
 	 */
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH stable backport] net/9p: Switch to wait_event_killable()
  2017-11-27 23:44 [PATCH stable backport] net/9p: Switch to wait_event_killable() Tuomas Tynkkynen
@ 2017-11-28  8:40 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2017-11-28  8:40 UTC (permalink / raw)
  To: Tuomas Tynkkynen; +Cc: stable, Al Viro

On Tue, Nov 28, 2017 at 01:44:50AM +0200, Tuomas Tynkkynen wrote:
> commit 9523feac272ccad2ad8186ba4fcc89103754de52 upstream, with changes
> to net/9p/trans_xen.c dropped as that driver was only added in 4.12.
> 
> Because userspace gets Very Unhappy when calls like stat() and execve()
> return -EINTR on 9p filesystem mounts. For instance, when bash is
> looking in PATH for things to execute and some SIGCHLD interrupts
> stat(), bash can throw a spurious 'command not found' since it doesn't
> retry the stat().
> 
> In practice, hitting the problem is rare and needs a really
> slow/bogged down 9p server.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Tuomas Tynkkynen <tuomas@tuxera.com>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> This backport applies to stable trees for 4.9 and below.

Thanks, now applied.

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-28  8:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-27 23:44 [PATCH stable backport] net/9p: Switch to wait_event_killable() Tuomas Tynkkynen
2017-11-28  8:40 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.