init: abort write and trim jobs when --readonly option is present
[fio.git] / init.c
diff --git a/init.c b/init.c
index 8d382602f4539bd75a2d8bc493c0dd6d1176c1ac..af4cc6b75babde048f72c77de353e1f3ae031d94 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;
 
        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"
 #ifndef CONFIG_PSHARED
        if (!o->use_thread) {
                log_info("fio: this platform does not support process shared"