Bug 170860

Summary: Write errors when inherit_directio flag is set
Product: [Retired] Red Hat Cluster Suite Reporter: Henry Harris <henry.harris>
Component: gfsAssignee: Wendy Cheng <nobody+wcheng>
Status: CLOSED NOTABUG QA Contact: GFS Bugs <gfs-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 4   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-10-15 04:12:24 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.