Skip to content

Commit

Permalink
filesetup: clear O_RDWR flag for verify_only write workloads
Browse files Browse the repository at this point in the history
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: #1681
Signed-off-by: Vincent Fu <[email protected]>
  • Loading branch information
vincentkfu committed Jan 22, 2024
1 parent aa84b5b commit 8b3190c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions filesetup.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,11 @@ int generic_open_file(struct thread_data *td, struct fio_file *f)
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;

Expand Down

0 comments on commit 8b3190c

Please sign in to comment.