filesetup: clear O_RDWR flag for verify_only write workloads
authorVincent Fu <vincent.fu@samsung.com>
Fri, 19 Jan 2024 17:30:57 +0000 (17:30 +0000)
committerVincent Fu <vincent.fu@samsung.com>
Mon, 22 Jan 2024 16:51:05 +0000 (11:51 -0500)
If verify_only is set we don't need to open the file with the O_RDWR
flagi for write workloads. So we should clear this flag. This will help
when the file is on a read-only file system.

Fixes: https://github.com/axboe/fio/issues/1681
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
filesetup.c

index 816d10816e58acf2ba871bc8b78e733849914432..2d277a6428a3b19dee365262405b30850d90a669 100644 (file)
@@ -749,6 +749,11 @@ open_again:
                if (!read_only)
                        flags |= O_RDWR;
 
+               if (td->o.verify_only) {
+                       flags &= ~O_RDWR;
+                       flags |= O_RDONLY;
+               }
+
                if (f->filetype == FIO_TYPE_FILE && td->o.allow_create)
                        flags |= O_CREAT;