]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
xio: Enforce at least two portals if bind 3544/head
authorVu Pham <vu@mellanox.com>
Fri, 30 Jan 2015 17:21:37 +0000 (09:21 -0800)
committerVu Pham <vu@mellanox.com>
Fri, 30 Jan 2015 17:21:37 +0000 (09:21 -0800)
Enforce at least two portals being set/created if one set
xio_portals_thread = 1 by mistake
Return the correct last use portal and pass in only one portal
to accept

Signed-off-by: Vu Pham <vu@mellanox.com>
src/msg/xio/XioPortal.h

index 8d248d23d7530c348eaff25ac799a0f83a2081bb..cd7a2e7025803a36876614175f185e702ca2cb8f 100644 (file)
@@ -343,12 +343,17 @@ private:
   int last_use;
 
 public:
-  XioPortals(Messenger *msgr, int _n) : p_vec(NULL), n(_n)
+  XioPortals(Messenger *msgr, int _n) : p_vec(NULL)
     {
       /* portal0 */
       portals.push_back(new XioPortal(msgr));
       last_use = 0;
 
+      /* enforce at least two portals if bind */
+      if (_n < 2)
+        _n = 2;
+      n = _n;
+
       /* additional portals allocated on bind() */
     }
 
@@ -367,7 +372,7 @@ public:
   int get_last_use()
   {
     int pix = last_use;
-    if (++last_use == get_portals_len() - 2)
+    if (++last_use >= get_portals_len() - 1)
       last_use = 0;
     return pix;
   }
@@ -389,7 +394,7 @@ public:
 
       return xio_accept(session,
                        (const char **)&(portals_vec[pix]),
-                       2, NULL, 0);
+                       1, NULL, 0);
     }
 
   void start()