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

Thadeu Lima de Souza Cascardo cascardo at canonical.com
Thu Jul 15 21:35:48 UTC 2021


On Thu, Jul 15, 2021 at 04:27:40PM -0500, Ian May wrote:
> 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

I see it the other way around here. O_DIRECT is 040000 and O_DIRECTORY is 0200000.

Where did you find this failure? Which kernel on which series?

Cascardo.

> 
> 
> -- 
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team



More information about the kernel-team mailing list