]> Zhao Yanbai Git Server - minix.git/commitdiff
PFS: unblock the child when unsuspending an accept 74/774/3
authorDavid van Moolenbroek <david@minix3.org>
Tue, 20 Aug 2013 23:05:05 +0000 (01:05 +0200)
committerGerrit Code Review <gerrit@gerrit>
Wed, 21 Aug 2013 09:12:48 +0000 (11:12 +0200)
Previously, PFS would incorrectly try to unsuspend the parent (i.e.,
the listening socket), resulting in the child hanging until the other
side performed another action. Test56 started failing on this now.

Change-Id: I231ac5481c83ac45951d33aeecc8149273f48b11

servers/pfs/uds.c

index f28531b92d8e889b91b1f959157bbcd64d3f6fa0..34b9d10064d07e89da688e2a3f5295d65a0b79da 100644 (file)
@@ -398,7 +398,7 @@ int do_accept(message *dev_m_in, message *dev_m_out)
 
 int do_connect(message *dev_m_in, message *dev_m_out)
 {
-       int minor;
+       int minor, child;
        struct sockaddr_un addr;
        int rc, i, j;
 
@@ -446,26 +446,28 @@ int do_connect(message *dev_m_in, message *dev_m_out)
                        !strncmp(addr.sun_path, uds_fd_table[i].addr.sun_path,
                        UNIX_PATH_MAX)) {
 
-                       if (uds_fd_table[i].child != -1) {
+                       if ((child = uds_fd_table[i].child) != -1) {
 
                                /* the server is blocked on accept(2) --
                                 * perform connection to the child
                                 */
 
                                rc = perform_connection(dev_m_in, dev_m_out,
-                                       &addr, minor, uds_fd_table[i].child);
+                                       &addr, minor, child);
 
                                if (rc == OK) {
 
                                        uds_fd_table[i].child = -1;
 
 #if DEBUG == 1
-                       printf("(uds) [%d] {do_connect} revive %d\n", minor, i);
+               printf("(uds) [%d] {do_connect} revive %d\n", minor, child);
 #endif
 
                                        /* wake the parent (server) */
-                                       uds_fd_table[i].ready_to_revive = 1;
-                                       uds_unsuspend(dev_m_in->m_source, i);
+                                       uds_fd_table[child].ready_to_revive =
+                                               1;
+                                       uds_unsuspend(dev_m_in->m_source,
+                                               child);
                                }
 
                                return rc;