Open panxiao2014 opened 1 month ago
Probably this code from engines/nfs.c:fio_libnfs_open()
is relevant:
if (td->o.td_ddir == TD_DDIR_WRITE)
flags |= O_CREAT | O_RDWR;
else
flags |= O_RDWR;
ret = nfs_open(options->context, f->file_name, flags, &nfs_data->nfsfh);
For jobs that only do writes, the ioengine sets O_CREAT
whereas for any other workload that flag is not set. It seems reasonable to create files if they do not already exist no matter the workload type.
open()
documents the effect of O_CREAT
this way:
If pathname does not exist, create it as a regular file.
If nfs_open()
treats the flag in the same way then it seems as if we should always set the O_CREAT
flag here, with perhaps an exception for fio's readonly
option is enabled.
I did tweak the code in this way:
if (td->o.td_ddir == TD_DDIR_WRITE)
flags |= O_CREAT | O_RDWR;
else
flags |= O_CREAT | O_RDWR;
Then I started fio with read mode, it reported error:
Got NFS EOF, this is probably not expected Got NFS EOF, this is probably not expected Got NFS EOF, this is probably not expected Got NFS EOF, this is probably not expected ...
I guess we need to first create the file, sequentially write to populate the whole data area, and then do the wanted IO operations.
I am a newbie of fio source code, still learning it.
Please acknowledge the following before creating a ticket
Description of the bug: When using nfs as the ioengine, fio does not pre-create files when job starts. Thus, only write mode works fine. For the other mode, fio returns error unless the file existed before fio starts.
Environment: Ubuntu 20.04.1 LTS
fio version: fio-3.37-39
Reproduction steps
fio options: --ioengine=nfs --rw=read
fio run with error: _Failed to open file_xxx: open call failed with "NFS: Lookup of file_xxx failed with NFS3ERRNOENT(-2)"
Any other rw options other than write will get the same error.