]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
uml: DEBUG_SHIRQ fixes
authorEduard-Gabriel Munteanu <maxdamage@aladin.ro>
Mon, 16 Jul 2007 06:38:51 +0000 (23:38 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 16 Jul 2007 16:05:38 +0000 (09:05 -0700)
DEBUG_SHIRQ generates spurious interrupts, triggering handlers such as
mconsole_interrupt() or line_interrupt().  They expect data to be available to
be read from their sockets/pipes, but in the case of spurious interrupts, the
host didn't actually send anything, so UML hangs in read() and friends.
Setting those fd's as O_NONBLOCK makes DEBUG_SHIRQ-enabled UML kernels boot
and run correctly.

Signed-off-by: Eduard-Gabriel Munteanu <maxdamage@aladin.ro>
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/um/drivers/chan_user.c
arch/um/drivers/mconsole_user.c
arch/um/drivers/ubd_user.c
arch/um/drivers/xterm.c

index 13f0bf852b2a195e8b15ceab084c51e6153ad3eb..5d1289d3341013196c211fda633c69f73435adfc 100644 (file)
@@ -170,7 +170,13 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out)
                 err = -EINVAL;
                goto out_close;
        }
-       return err ;
+
+       if (os_set_fd_block(*fd_out, 0)) {
+               printk("winch_tramp: failed to set thread_fd non-blocking.\n");
+               goto out_close;
+       }
+
+       return err;
 
  out_close:
        os_close_file(fds[1]);
index 62e5ad63181a69c999b61dc40f0e4083c8e1a0ba..f31e71546e52b1f26ddadff022a421273ab66a9d 100644 (file)
@@ -86,8 +86,9 @@ int mconsole_get_request(int fd, struct mc_request *req)
        int len;
 
        req->originlen = sizeof(req->origin);
-       req->len = recvfrom(fd, &req->request, sizeof(req->request), 0,
-                           (struct sockaddr *) req->origin, &req->originlen);
+       req->len = recvfrom(fd, &req->request, sizeof(req->request),
+                           MSG_DONTWAIT, (struct sockaddr *) req->origin,
+                           &req->originlen);
        if (req->len < 0)
                return 0;
 
index 4707b3f14c2fcf45029a0c4ae65d84bfad5004e8..41d254bd38df5222d06f6d08e643dda7469df524 100644 (file)
@@ -43,6 +43,12 @@ int start_io_thread(unsigned long sp, int *fd_out)
        kernel_fd = fds[0];
        *fd_out = fds[1];
 
+       err = os_set_fd_block(*fd_out, 0);
+       if (err) {
+               printk("start_io_thread - failed to set nonblocking I/O.\n");
+               goto out_close;
+       }
+
        pid = clone(io_thread, (void *) sp, CLONE_FILES | CLONE_VM | SIGCHLD,
                    NULL);
        if(pid < 0){
index 571c2b3325d573a1819d47b9d4e69f18a1c40540..fe238e03a300dcaaccc22f1e94c35dbb27988448 100644 (file)
@@ -151,6 +151,13 @@ int xterm_open(int input, int output, int primary, void *d,
                goto out;
        }
 
+       err = os_set_fd_block(new, 0);
+       if (err) {
+               printk("xterm_open : failed to set xterm descriptor "
+                      "non-blocking, err = %d\n", -err);
+               goto out;
+       }
+
        CATCH_EINTR(err = tcgetattr(new, &data->tt));
        if(err){
                new = err;