filesetup: make trim jobs respect --readonly during file open
[fio.git] / filesetup.c
index 75694bd81825082516d9f1601de08a650ebe9aa1..a2427a1a80bb0bea52aeee2cab761faac09a5cef 100644 (file)
@@ -674,7 +674,8 @@ open_again:
                        from_hash = file_lookup_open(f, flags);
        } else if (td_trim(td)) {
                assert(!td_rw(td)); /* should have matched above */
                        from_hash = file_lookup_open(f, flags);
        } else if (td_trim(td)) {
                assert(!td_rw(td)); /* should have matched above */
-               flags |= O_RDWR;
+               if (!read_only)
+                       flags |= O_RDWR;
                from_hash = file_lookup_open(f, flags);
        }
 
                from_hash = file_lookup_open(f, flags);
        }