options: check for conflict between trims and readonly option
authorVincent Fu <vincent.fu@wdc.com>
Fri, 15 Jun 2018 21:52:43 +0000 (15:52 -0600)
committerVincent Fu <vincent.fu@wdc.com>
Mon, 18 Jun 2018 19:37:14 +0000 (13:37 -0600)
When processing the readwrite option, make sure that trim operations
are not requested if readonly is set.

options.c

index 0c4f89c..a174e2c 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1555,9 +1555,9 @@ static int rw_verify(const struct fio_option *o, void *data)
 {
        struct thread_data *td = cb_data_to_td(data);
 
-       if (read_only && td_write(td)) {
-               log_err("fio: job <%s> has write bit set, but fio is in"
-                       " read-only mode\n", td->o.name);
+       if (read_only && (td_write(td) || td_trim(td))) {
+               log_err("fio: job <%s> has write or trim bit set, but"
+                       " fio is in read-only mode\n", td->o.name);
                return 1;
        }