From: Vincent Fu Date: Fri, 15 Jun 2018 21:05:28 +0000 (-0600) Subject: filesetup: make trim jobs respect --readonly during file open X-Git-Tag: fio-3.8~27^2~5 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=11ff4c37e3fc4fa4eb03c55942b89f92eb01263f;hp=196ccc44e70333cc87f9d417967bd06288602dac;ds=sidebyside filesetup: make trim jobs respect --readonly during file open Open files for trim workloads with the O_RDWR access mode only when the --readonly option is absent. --- diff --git a/filesetup.c b/filesetup.c index 75694bd8..a2427a1a 100644 --- a/filesetup.c +++ b/filesetup.c @@ -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 */ - flags |= O_RDWR; + if (!read_only) + flags |= O_RDWR; from_hash = file_lookup_open(f, flags); }