mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
osdep: warn if open(O_DIRECT) on fails with EINVAL
Print a warning when opening a file O_DIRECT fails with EINVAL. This saves users a lot of time trying to figure out the EINVAL error, which is typical when attempting to open a file O_DIRECT on Linux tmpfs. Reported-by: Deepak C Shetty <deepakcs@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
975a0015ee
commit
a5813077aa
1 changed files with 7 additions and 0 deletions
|
@ -207,6 +207,13 @@ int qemu_open(const char *name, int flags, ...)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef O_DIRECT
|
||||
if (ret == -1 && errno == EINVAL && (flags & O_DIRECT)) {
|
||||
error_report("file system may not support O_DIRECT");
|
||||
errno = EINVAL; /* in case it was clobbered */
|
||||
}
|
||||
#endif /* O_DIRECT */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue