Using O_DIRECT on Linux Results in Errors (Doc ID 945539.1)

Last updated on MAY 17, 2016

Applies to:

Berkeley DB - Version 4.2 to 4.7
UnitedLinux (32-bit)
Linux x86
IBM: Linux on System z
Generic Linux
Miracle Linux x86
Haansoft Linux Itanium
Embedded Linux SH4
Obsolete Linux Intel (64-bit)
Red Hat Enterprise Linux Advanced Server x86-64 (AMD Opteron Architecture)
Oracle Enterprise Linux 4.0
IBM: Linux on POWER Systems
IBM S/390 Based Linux (31-bit)
Red Hat Enterprise Linux Advanced Server Itanium
x86 64 bit (for Enterprise Linux only)
Miracle Linux x86-64
SUSE \ UnitedLinux x86-64
Linux x86-64
Haansoft Linux x86
z*OBSOLETE: IBM Linux on POWER Systems - alternate
x86 32 bit (for Enterprise Linux only)
UnitedLinux Itanium
Miracle Linux Itanium
Red Hat Enterprise Linux Workstation
Haansoft Linux x86-64
Embedded Linux xScale
Linux Itanium

Symptoms

To avoid double buffering on platforms that allow it, and use direct I/O, Berkeley DB needs to be built with --enable-o_direct configuration option and the DB_DIRECT_DB and DB_DIRECT_LOG flags should be used in the application.

When Berkeley DB is built with that configuration on Linux 2.4/2.6 calls to read and write fail with an "Invalid argument" error message as illustrated below:

read: 0xae00c674, 4096: Invalid argument
write: 0x967c6c0, 8192: Invalid argument
write: 0xbfbda940, 4096: Invalid argument
write: 0xadf471cc, 91: Invalid argument

 

This issue applies to all versions of Berkeley DB, including the current release, 4.8.24.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms