init: abort write and trim jobs when --readonly option is present
authorVincent Fu <vincent.fu@wdc.com>
Fri, 15 Jun 2018 21:17:38 +0000 (15:17 -0600)
committerVincent Fu <vincent.fu@wdc.com>
Mon, 18 Jun 2018 19:37:05 +0000 (13:37 -0600)
Check for conflicts between --readonly and the job's data direction
in fixup_options(). rw_verify() in options.c only detects this
conflict if --readonly precedes --readwrite on the command line.

init.c

diff --git a/init.c b/init.c
index 8d38260..af4cc6b 100644 (file)
--- a/init.c
+++ b/init.c
@@ -594,6 +594,12 @@ static int fixup_options(struct thread_data *td)
        struct thread_options *o = &td->o;
        int ret = 0;
 
+       if (read_only && (td_write(td) || td_trim(td))) {
+               log_err("fio: trim and write operations are not allowed"
+                        " with the --readonly parameter.\n");
+               ret |= 1;
+       }
+
 #ifndef CONFIG_PSHARED
        if (!o->use_thread) {
                log_info("fio: this platform does not support process shared"