From: Vincent Fu Date: Fri, 15 Jun 2018 21:17:38 +0000 (-0600) Subject: init: abort write and trim jobs when --readonly option is present X-Git-Tag: fio-3.8~27^2~3 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=c0e9a23844dd78a0dd07ab72f59114089e639e74;hp=1cce3c66140206967462f85646a50b0065da87e9 init: abort write and trim jobs when --readonly option is present 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. --- diff --git a/init.c b/init.c index 8d382602..af4cc6b7 100644 --- 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"