Bug 170860 - Write errors when inherit_directio flag is set
Summary: Write errors when inherit_directio flag is set
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Cluster Suite
Classification: Retired
Component: gfs
Version: 4
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Wendy Cheng
QA Contact: GFS Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-10-14 19:44 UTC by Henry Harris
Modified: 2010-01-12 03:08 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-10-15 04:12:24 UTC
Embargoed:


Attachments (Terms of Use)

Description Henry Harris 2005-10-14 19:44:49 UTC
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):
GFS-kernel-smp-2.6.9-42.1.x86_64.rpm

How reproducible: Everytime


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

Expected results:
no errors

Additional info:

Comment 2 Jonathan Earl Brassow 2005-10-14 21:21:33 UTC
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 22:52:22 UTC
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-15 03:18:24 UTC
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-15 03:20:06 UTC
I'm checking into how "cp" is implemented. 

Comment 6 Wendy Cheng 2005-10-15 04:04:08 UTC
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 04:11:00 UTC
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.