Merge branch 'optlenmax' of https://github.com/powernap/fio
authorJens Axboe <axboe@kernel.dk>
Mon, 1 Jul 2019 20:26:29 +0000 (14:26 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 1 Jul 2019 20:26:29 +0000 (14:26 -0600)
* 'optlenmax' of https://github.com/powernap/fio:
  Increase maximum length of line in jobs file to 8192

engines/rbd.c
eta.c
exp/expression-parser.y
filesetup.c
init.c
server.c

index 081b4a040f6425c1f0dad7c8884d7f163c87fad6..7d4d3faf9c5318462fb7c153b7e96a8437e40dc2 100644 (file)
@@ -316,12 +316,14 @@ static inline int fri_check_complete(struct rbd_data *rbd, struct io_u *io_u,
        return 0;
 }
 
+#ifndef CONFIG_RBD_POLL
 static inline int rbd_io_u_seen(struct io_u *io_u)
 {
        struct fio_rbd_iou *fri = io_u->engine_data;
 
        return fri->io_seen;
 }
+#endif
 
 static void rbd_io_u_wait_complete(struct io_u *io_u)
 {
diff --git a/eta.c b/eta.c
index b69dd19439712f3e597696dfffb0cdc57dcf5ff9..647a1bdd8eed7433c2413fde356844720b45e722 100644 (file)
--- a/eta.c
+++ b/eta.c
@@ -392,6 +392,9 @@ bool calc_thread_status(struct jobs_eta *je, int force)
        static unsigned long long disp_io_iops[DDIR_RWDIR_CNT];
        static struct timespec rate_prev_time, disp_prev_time;
 
+       void *je_rate = (void *) je->rate;
+       void *je_iops = (void *) je->iops;
+
        if (!force) {
                if (!(output_format & FIO_OUTPUT_NORMAL) &&
                    f_out == stdout)
@@ -507,7 +510,7 @@ bool calc_thread_status(struct jobs_eta *je, int force)
 
        if (write_bw_log && rate_time > bw_avg_time && !in_ramp_time(td)) {
                calc_rate(unified_rw_rep, rate_time, io_bytes, rate_io_bytes,
-                               je->rate);
+                               je_rate);
                memcpy(&rate_prev_time, &now, sizeof(now));
                add_agg_sample(sample_val(je->rate[DDIR_READ]), DDIR_READ, 0);
                add_agg_sample(sample_val(je->rate[DDIR_WRITE]), DDIR_WRITE, 0);
@@ -519,8 +522,8 @@ bool calc_thread_status(struct jobs_eta *je, int force)
        if (!force && !eta_time_within_slack(disp_time))
                return false;
 
-       calc_rate(unified_rw_rep, disp_time, io_bytes, disp_io_bytes, je->rate);
-       calc_iops(unified_rw_rep, disp_time, io_iops, disp_io_iops, je->iops);
+       calc_rate(unified_rw_rep, disp_time, io_bytes, disp_io_bytes, je_rate);
+       calc_iops(unified_rw_rep, disp_time, io_iops, disp_io_iops, je_iops);
 
        memcpy(&disp_prev_time, &now, sizeof(now));
 
index 04a6e07a38ae924ed04cbb6736b87894eeceee61..8619025c692c3c914f681e705677e99cadd69ed6 100644 (file)
@@ -204,9 +204,9 @@ static void setup_to_parse_string(const char *string)
 {
        unsigned int len;
 
-       len = strlen(string);
-       if (len > sizeof(lexer_input_buffer) - 3)
-               len = sizeof(lexer_input_buffer) - 3;
+       len = sizeof(lexer_input_buffer) - 3;
+       if (len > strlen(string))
+               len = strlen(string);
 
        strncpy(lexer_input_buffer, string, len);
        lexer_input_buffer[len] = '\0'; 
index 24e6fb0757d84d3ceafb21a18cd12b5016af8307..17fa31fb3cd48924be886d55569b7c1356e72faf 100644 (file)
@@ -829,7 +829,8 @@ static unsigned long long get_fs_free_counts(struct thread_data *td)
                        continue;
 
                fm = calloc(1, sizeof(*fm));
-               strncpy(fm->__base, buf, sizeof(fm->__base) - 1);
+               strncpy(fm->__base, buf, sizeof(fm->__base));
+               fm->__base[255] = '\0'; 
                fm->base = basename(fm->__base);
                fm->key = sb.st_dev;
                flist_add(&fm->list, &list);
diff --git a/init.c b/init.c
index f7e7296fda9b495053b964ff789794dd2009218a..c9f6198ea63abdfa74248628fbb2ffca36a7ca7b 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1438,7 +1438,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
                   int recursed, int client_type)
 {
        unsigned int i;
-       char fname[PATH_MAX];
+       char fname[PATH_MAX + 1];
        int numjobs, file_alloced;
        struct thread_options *o = &td->o;
        char logname[PATH_MAX + 32];
@@ -2040,7 +2040,8 @@ static int __parse_jobs_ini(struct thread_data *td,
                                        strncpy(full_fn,
                                                file, (ts - file) + 1);
                                        strncpy(full_fn + (ts - file) + 1,
-                                               filename, strlen(filename));
+                                               filename,
+                                               len - (ts - file) - 1);
                                        full_fn[len - 1] = 0;
                                        filename = full_fn;
                                }
index 2a33770733e99e447f16511061f9f21a2699f2f5..23e549a590a709e4072b4de33704a32b46f3dd73 100644 (file)
--- a/server.c
+++ b/server.c
@@ -1470,9 +1470,12 @@ void fio_server_send_ts(struct thread_stat *ts, struct group_run_stats *rs)
 
        memset(&p, 0, sizeof(p));
 
-       strncpy(p.ts.name, ts->name, FIO_JOBNAME_SIZE - 1);
-       strncpy(p.ts.verror, ts->verror, FIO_VERROR_SIZE - 1);
-       strncpy(p.ts.description, ts->description, FIO_JOBDESC_SIZE - 1);
+       strncpy(p.ts.name, ts->name, FIO_JOBNAME_SIZE);
+       p.ts.name[FIO_JOBNAME_SIZE - 1] = '\0';
+       strncpy(p.ts.verror, ts->verror, FIO_VERROR_SIZE);
+       p.ts.verror[FIO_VERROR_SIZE - 1] = '\0';
+       strncpy(p.ts.description, ts->description, FIO_JOBDESC_SIZE);
+       p.ts.description[FIO_JOBDESC_SIZE - 1] = '\0';
 
        p.ts.error              = cpu_to_le32(ts->error);
        p.ts.thread_number      = cpu_to_le32(ts->thread_number);