[ACT][PATCH] UBUNTU: SAUCE: aio_dio_bugs: Fix O_DIRECT define

Ian May ian.may at canonical.com
Thu Jul 15 21:27:40 UTC 2021


BugLink: https://bugs.launchpad.net/bugs/1900791

If O_DIRECT is not defined in <fcntl.h> there is a manual
definition specified for O_DIRECT, but it is the wrong value.

    define O_DIRECT         040000 /* direct disk access hint */

This value maps to O_DIRECTORY, hence the failure errno=20(ENOTDIR)

strace also confirms the incorrect flag

    openat(AT_FDCWD, "file", O_RDWR|O_CREAT|O_TRUNC|O_DIRECTORY, 0600)

The fix is to set the correct value for O_DIRECT

Confirmed behavior with strace and that affected tests pass.

    openat(AT_FDCWD, "file", O_RDWR|O_CREAT|O_TRUNC|O_DIRECT, 0600)

Signed-off-by: Ian May <ian.may at canonical.com>
---
 aio_dio_bugs/src/aio-dio-extend-stat.c        | 2 +-
 aio_dio_bugs/src/aio-dio-invalidate-failure.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/aio_dio_bugs/src/aio-dio-extend-stat.c b/aio_dio_bugs/src/aio-dio-extend-stat.c
index e0dd2dfa..04e6225d 100644
--- a/aio_dio_bugs/src/aio-dio-extend-stat.c
+++ b/aio_dio_bugs/src/aio-dio-extend-stat.c
@@ -11,7 +11,7 @@
 #include <errno.h>
 
 #ifndef O_DIRECT
-#define O_DIRECT         040000 /* direct disk access hint */
+#define O_DIRECT         0200000 /* direct disk access hint */
 #endif
 
 
diff --git a/aio_dio_bugs/src/aio-dio-invalidate-failure.c b/aio_dio_bugs/src/aio-dio-invalidate-failure.c
index c5ffff05..11bd7c2d 100644
--- a/aio_dio_bugs/src/aio-dio-invalidate-failure.c
+++ b/aio_dio_bugs/src/aio-dio-invalidate-failure.c
@@ -26,7 +26,7 @@
  * return -EIO.
  */
 #ifndef O_DIRECT
-#define O_DIRECT         040000 /* direct disk access hint */
+#define O_DIRECT         0200000 /* direct disk access hint */
 #endif
 
 #define GINORMOUS (32 * 1024 * 1024)
-- 
2.25.1




More information about the kernel-team mailing list