Skip to content

Commit fd3c395

Browse files
dezgeggregkh
authored andcommitted
net/9p: Switch to wait_event_killable()
commit 9523feac272ccad2ad8186ba4fcc89103754de52 upstream. 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. Signed-off-by: Tuomas Tynkkynen <tuomas@tuxera.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 91bd72d commit fd3c395

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

net/9p/client.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,7 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...)
749749
}
750750
again:
751751
/* Wait for the response */
752-
err = wait_event_interruptible(*req->wq,
753-
req->status >= REQ_STATUS_RCVD);
752+
err = wait_event_killable(*req->wq, req->status >= REQ_STATUS_RCVD);
754753

755754
/*
756755
* Make sure our req is coherent with regard to updates in other

net/9p/trans_virtio.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req)
290290
if (err == -ENOSPC) {
291291
chan->ring_bufs_avail = 0;
292292
spin_unlock_irqrestore(&chan->lock, flags);
293-
err = wait_event_interruptible(*chan->vc_wq,
294-
chan->ring_bufs_avail);
293+
err = wait_event_killable(*chan->vc_wq,
294+
chan->ring_bufs_avail);
295295
if (err == -ERESTARTSYS)
296296
return err;
297297

@@ -331,7 +331,7 @@ static int p9_get_mapped_pages(struct virtio_chan *chan,
331331
* Other zc request to finish here
332332
*/
333333
if (atomic_read(&vp_pinned) >= chan->p9_max_pages) {
334-
err = wait_event_interruptible(vp_wq,
334+
err = wait_event_killable(vp_wq,
335335
(atomic_read(&vp_pinned) < chan->p9_max_pages));
336336
if (err == -ERESTARTSYS)
337337
return err;
@@ -475,8 +475,8 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req,
475475
if (err == -ENOSPC) {
476476
chan->ring_bufs_avail = 0;
477477
spin_unlock_irqrestore(&chan->lock, flags);
478-
err = wait_event_interruptible(*chan->vc_wq,
479-
chan->ring_bufs_avail);
478+
err = wait_event_killable(*chan->vc_wq,
479+
chan->ring_bufs_avail);
480480
if (err == -ERESTARTSYS)
481481
goto err_out;
482482

@@ -493,8 +493,7 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req,
493493
virtqueue_kick(chan->vq);
494494
spin_unlock_irqrestore(&chan->lock, flags);
495495
p9_debug(P9_DEBUG_TRANS, "virtio request kicked\n");
496-
err = wait_event_interruptible(*req->wq,
497-
req->status >= REQ_STATUS_RCVD);
496+
err = wait_event_killable(*req->wq, req->status >= REQ_STATUS_RCVD);
498497
/*
499498
* Non kernel buffers are pinned, unpin them
500499
*/

0 commit comments

Comments
 (0)