client: don't setup shared mem area for just the frontend
[fio.git] / init.c
diff --git a/init.c b/init.c
index 22b97950fb8ffaa5e08149ab483a802ccbb0c4cf..40a699c56f81df1fb12e402c6e808123d5319672 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1021,6 +1021,9 @@ static int setup_thread_area(void)
 {
        void *hash;
 
 {
        void *hash;
 
+       if (threads)
+               return 0;
+
        /*
         * 1024 is too much on some machines, scale max_jobs if
         * we get a failure that looks like too large a shm segment
        /*
         * 1024 is too much on some machines, scale max_jobs if
         * we get a failure that looks like too large a shm segment
@@ -1279,6 +1282,12 @@ static int parse_cmd_line(int argc, char *argv[])
                        const char *opt = l_opts[lidx].name;
                        char *val = optarg;
 
                        const char *opt = l_opts[lidx].name;
                        char *val = optarg;
 
+                       if (setup_thread_area()) {
+                               do_exit++;
+                               exit_val = 1;
+                               break;
+                       }
+
                        if (!strncmp(opt, "name", 4) && td) {
                                ret = add_job(td, td->o.name ?: "fio", 0);
                                if (ret)
                        if (!strncmp(opt, "name", 4) && td) {
                                ret = add_job(td, td->o.name ?: "fio", 0);
                                if (ret)
@@ -1343,6 +1352,8 @@ static int parse_cmd_line(int argc, char *argv[])
                        exit_val = 1;
                        break;
                }
                        exit_val = 1;
                        break;
                }
+               if (do_exit)
+                       break;
        }
 
        if (do_exit)
        }
 
        if (do_exit)
@@ -1382,13 +1393,17 @@ int parse_options(int argc, char *argv[])
        fio_options_fill_optstring();
        fio_options_dup_and_init(l_opts);
 
        fio_options_fill_optstring();
        fio_options_dup_and_init(l_opts);
 
-       if (setup_thread_area())
-               return 1;
        if (fill_def_thread())
                return 1;
 
        job_files = parse_cmd_line(argc, argv);
 
        if (fill_def_thread())
                return 1;
 
        job_files = parse_cmd_line(argc, argv);
 
+       /*
+        * Don't setup shared memory for the frontend
+        */
+       if (!nr_clients && setup_thread_area())
+               return 1;
+
        for (i = 0; i < job_files; i++) {
                if (fill_def_thread())
                        return 1;
        for (i = 0; i < job_files; i++) {
                if (fill_def_thread())
                        return 1;