windowsaio: open file for write if we have syncs
authorJens Axboe <axboe@kernel.dk>
Sat, 26 Feb 2022 17:43:20 +0000 (10:43 -0700)
committerJens Axboe <axboe@kernel.dk>
Sat, 26 Feb 2022 17:43:20 +0000 (10:43 -0700)
Windows wants the file opened for write if we do a file sync, so
ensure we do that if we have syncs.

Fixes: https://github.com/axboe/fio/issues/1352
Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/windowsaio.c

index d82c80536145409356739c3a5ea94d518259f141..6681f8bbabfa9dd4b273720f444e70e4e628d20d 100644 (file)
@@ -248,7 +248,7 @@ static int fio_windowsaio_open_file(struct thread_data *td, struct fio_file *f)
                log_err("fio: unknown fadvise type %d\n", td->o.fadvise_hint);
        }
 
-       if (!td_write(td) || read_only)
+       if ((!td_write(td) && !(td->flags & TD_F_SYNCS)) || read_only)
                access = GENERIC_READ;
        else
                access = (GENERIC_READ | GENERIC_WRITE);