]> xenbits.xensource.com Git - people/dstodden/blktap.git/commitdiff
CA-61156: control: Anticipate tap-ctl-spawn racing a bugtool killall -USR1.
authorDaniel Stodden <daniel.stodden@citrix.com>
Tue, 28 Jun 2011 01:08:57 +0000 (18:08 -0700)
committerDaniel Stodden <daniel.stodden@citrix.com>
Tue, 28 Jun 2011 01:08:57 +0000 (18:08 -0700)
There's a race between tapdisk's sigaction init and xen-bugtool
shooting debug signals under RT stress. If killed by something as
innocuous as USR1, then just retry the fork().

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
control/tap-ctl-spawn.c

index 67ebcb97b2784635536be155c5877383bf87019d..7c16531c5e585f5e2d07eaa3f808c5fae8fc26c6 100644 (file)
@@ -119,6 +119,12 @@ tap_ctl_wait(pid_t child)
        if (WIFSIGNALED(status)) {
                int signo = WTERMSIG(status);
                EPRINTF("tapdisk2[%d] killed by signal %d\n", child, signo);
+               if (signo == SIGUSR1)
+                       /* NB. there's a race between tapdisk's
+                        * sigaction init and xen-bugtool shooting
+                        * debug signals. If killed by something as
+                        * innocuous as USR1, then retry. */
+                       return -EAGAIN;
                return -EINTR;
        }
 
@@ -158,13 +164,17 @@ tap_ctl_spawn(void)
 
        readfd = -1;
 
+again:
        child = __tap_ctl_spawn(&readfd);
        if (child < 0)
                return child;
 
        err = tap_ctl_wait(child);
-       if (err)
+       if (err) {
+               if (err == -EAGAIN)
+                       goto again;
                return err;
+       }
 
        id = tap_ctl_get_child_id(readfd);
        if (id < 0)