]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net/9p: Switch to wait_event_killable()
authorTuomas Tynkkynen <tuomas@tuxera.com>
Wed, 6 Sep 2017 14:59:08 +0000 (17:59 +0300)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 24 Oct 2017 03:10:01 +0000 (23:10 -0400)
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>
net/9p/client.c
net/9p/trans_virtio.c
net/9p/trans_xen.c

index 4674235b0d9b1f77dae3736fd08b1a6a2a417eeb..1beb131dd3e1862cbf83d8af09c9861a0743cb2c 100644 (file)
@@ -773,8 +773,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
index f24b25c25106fb55fb713b7308a8d43413a2143b..f3a4efcf1456422a6c6f036e8b7364f89b407bfd 100644 (file)
@@ -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
         */
index 6ad3e043c6174ae97a82525688988e740d87fd29..325c56043007d89886203626a2a139f1ab8fc52a 100644 (file)
@@ -156,8 +156,8 @@ static int p9_xen_request(struct p9_client *client, struct p9_req_t *p9_req)
        ring = &priv->rings[num];
 
 again:
-       while (wait_event_interruptible(ring->wq,
-                                       p9_xen_write_todo(ring, size)) != 0)
+       while (wait_event_killable(ring->wq,
+                                  p9_xen_write_todo(ring, size)) != 0)
                ;
 
        spin_lock_irqsave(&ring->lock, flags);