[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/11] osdep: warn if open(O_DIRECT) on fails with EI
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 02/11] osdep: warn if open(O_DIRECT) on fails with EINVAL |
Date: |
Fri, 20 Sep 2013 19:42:02 +0200 |
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 <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
util/osdep.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/util/osdep.c b/util/osdep.c
index 685c8ae..62072b4 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -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;
}
--
1.8.3.1
- [Qemu-devel] [PULL 00/11] Block patches, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 01/11] libcacard: link against qemu-error.o for error_report(), Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 02/11] osdep: warn if open(O_DIRECT) on fails with EINVAL,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 03/11] qemu-timer: drop outdated signal safety comments, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 04/11] qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 05/11] qemu-timer: do not take the lock in timer_pending, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 06/11] coroutine: add qemu_coroutine_yield benchmark, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 07/11] coroutine: fix /perf/nesting coroutine benchmark, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 08/11] qcow2: Correct snapshots size for overlap check, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 09/11] block: don't lose data from last incomplete sector, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 10/11] blockdev: do not default cache.no-flush to true, Stefan Hajnoczi, 2013/09/20
- [Qemu-devel] [PULL 11/11] virtio-blk: do not relay a previous driver's WCE configuration to the current, Stefan Hajnoczi, 2013/09/20