Whamcloud - gitweb
b=14127
authormaxim <maxim>
Mon, 12 Nov 2007 13:10:47 +0000 (13:10 +0000)
committermaxim <maxim>
Mon, 12 Nov 2007 13:10:47 +0000 (13:10 +0000)
i=isaac
i=liang
Minor enhancement allowing lstclient to accept incoming connections.

lnet/selftest/rpc.c
lnet/utils/lstclient.c

index dcd3b49..2b17e55 100644 (file)
@@ -1587,7 +1587,10 @@ srpc_startup (void)
 #ifdef __KERNEL__
         rc = LNetNIInit(LUSTRE_SRV_LNET_PID);
 #else
-        rc = LNetNIInit(getpid() | LNET_PID_USERFLAG);
+        if (the_lnet.ln_server_mode_flag)
+                rc = LNetNIInit(LUSTRE_SRV_LNET_PID);
+        else
+                rc = LNetNIInit(getpid() | LNET_PID_USERFLAG);
 #endif
         if (rc < 0) {
                 CERROR ("LNetNIInit() has failed: %d\n", rc);
index 5ab4dcd..ec52175 100644 (file)
@@ -23,9 +23,10 @@ unsigned int libcfs_debug = 0;
 
 static struct option lstjn_options[] =
 {
-        {"sesid",   required_argument,  0, 's' },
-        {"group",   required_argument,  0, 'g' },
-        {0,         0,                  0,  0  }
+        {"sesid",       required_argument,  0, 's' },
+        {"group",       required_argument,  0, 'g' },
+        {"server_mode", no_argument,        0, 'm' },
+        {0,             0,                  0,  0  }
 };
 
 void
@@ -126,12 +127,16 @@ main(int argc, char **argv)
 {
         char   *ses = NULL;
         char   *grp = NULL;
+        int     server_mode_flag = 0;
         int     optidx;
         int     c;
         int     rc;
 
+        const char *usage_string =
+                "Usage: lstclient --sesid ID --group GROUP [--server_mode]\n";
+
         while (1) {
-                c = getopt_long(argc, argv, "s:g:",
+                c = getopt_long(argc, argv, "s:g:m",
                                 lstjn_options, &optidx);
 
                 if (c == -1)
@@ -144,15 +149,17 @@ main(int argc, char **argv)
                 case 'g':
                         grp = optarg;
                         break;
+                case 'm':
+                        server_mode_flag = 1;
+                        break;
                 default:
-                        fprintf(stderr,
-                                "Usage: lstclient --sesid ID --group GROUP\n");
+                        fprintf(stderr, usage_string);
                         return -1;
                 }
         }
 
         if (optind != argc || grp == NULL || ses == NULL) {
-                fprintf(stderr, "Usage: lstclient --sesid ID --group GROUP\n");
+                fprintf(stderr, usage_string);
                 return -1;
         }
 
@@ -169,6 +176,9 @@ main(int argc, char **argv)
                 return -1;
         }
 
+        if (server_mode_flag)
+                lnet_server_mode();
+        
         rc = lnet_selftest_init();
         if (rc != 0) {
                 fprintf(stderr, "Can't startup selftest\n");