Bug 170860 - Write errors when inherit_directio flag is set
Write errors when inherit_directio flag is set
Product: Red Hat Cluster Suite
Classification: Red Hat
Component: gfs (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Wendy Cheng
GFS Bugs
Depends On:
  Show dependency treegraph
Reported: 2005-10-14 15:44 EDT by Henry Harris
Modified: 2010-01-11 22:08 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-10-15 00:12:24 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Henry Harris 2005-10-14 15:44:49 EDT
Description of problem: Setting the inherit_directio flag on a gfs file 
results in the following error:

  cp: writing ‘filename’: Invalid argument

  The file will be created but will be of zero size.

  Note that this behavior is exhibited locally on a single node – there is no  
need to export it and mount on another system to see the behavior.

Version-Release number of selected component (if applicable):

How reproducible: Everytime

Steps to Reproduce:
1. Set inherit_directio flag on root GFS file system
2. Write to a GFS file
Actual results:
writing ‘filename’: Invalid argument

Expected results:
no errors

Additional info:
Comment 2 Jonathan Earl Brassow 2005-10-14 17:21:33 EDT
interesting.  seems it's a problem whenever buffered->dio or dio -> buffered

echo hi > test # produces 0 file
Comment 3 Henry Harris 2005-10-14 18:52:22 EDT
Although this is still a bug, we have learned that we should be using jdata 
instead of directio for what we want, so this is not effecting us currently.
Comment 4 Wendy Cheng 2005-10-14 23:18:24 EDT
With O_DIRECT, the buffer (memory) being read from or written to must be
512-byte aligned. It is more of a programming interface and I don't think
commands such as "cp" is prepared to handle issues like this. 
Comment 5 Wendy Cheng 2005-10-14 23:20:06 EDT
I'm checking into how "cp" is implemented. 
Comment 6 Wendy Cheng 2005-10-15 00:04:08 EDT
From coreutils-5.2.1, "cp" does the regular file read/write as:

 buf = alloca (buf_size + sizeof (int));
 n_read = read (source_desc, buf, buf_size);
 full_write (dest_desc, buf, n) ...

The "buf" is not necessarily 512-byte aligned. As the result, the kernel
__blockdev_direct_IO() call will return -EINVAL if alignment checking fails.
Comment 7 Wendy Cheng 2005-10-15 00:11:00 EDT
I *don't* consider this is a bug but a restriction (or more specifically, a
mis-understanding) of the inherit_directio flag. 

On the other hand, we can certainly put some words into documentation about this
if requested.

Again, Direct IO is a programming interface - mixing its usage with other Linux
commands and utilities are not recommended. 

Note You need to log in before you can comment on or make changes to this bug.