Bug 131981 - O_DIRECT doesn't work on LVM devices
O_DIRECT doesn't work on LVM devices
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: kernel (Show other bugs)
3.0
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Heinz Mauelshagen
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-09-07 13:33 EDT by Robert
Modified: 2007-11-30 17:07 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-05-18 09:27:55 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
rawread.tar (37.50 KB, application/octet-stream)
2004-09-07 13:39 EDT, Robert
no flags Details

  None (edit)
Description Robert 2004-09-07 13:33:41 EDT
Description of problem:

O_DIRECT doesn't work on LVM devices

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

kernel-2.4.21-4.EL, O_DIRECT to a LVM device on a SCSI disk worked fine.
kernel-2.4.21-9.EL, kernel-2.4.21-15.EL,  kernel-2.4.21-18.EL seem to
disable varyio to LVM devices.
I.e. see mm/filemap.c
/* Only files on a varyio-capable block device are allowed to do
 * sector-aligned direct IO, and then only if the direct_sector_IO
 * method is present.  Otherwise we need to constrain the IO to fs
 * blocksize. */
This seems to be no longer true since kernel-2.4.21-9.EL for a LVM
device.

How reproducible:
anytime


Steps to Reproduce:

Using attached rawread to simulate O_DIRECT pread to /mnt/u1/<anyfile>
1.
/sbin/insmod /lib/modules/2.4.21-15.ELsmp/kernel/drivers/md/lvm-mod.o
/sbin/vgscan -v
/sbin/pvcreate /dev/sdj2
/sbin/vgcreate vgbde /dev/sdj2
/sbin/lvcreate -I512 -L3G -nlvgbde  -v vgbde
mkfs -t ext3 /dev/vgbde/lvgbde
mount -f ext3 /dev/vgbde/lvgbde /mnt/u1
.
2. rawread -f -z -t 4 -o 512 -s 8192 -r 1 => Errno = EINVAL
   rawread -f -z -t 4 -o 1024 -s 8192 -r 1 => Errno = EINVAL
   rawread -f -z -t 4 -o 2048 -s 8192 -r 1 => Errno = EINVAL
   rawread -f -z -t 4 -o 4096 -s 8192 -r 1 => OK, i.e. if offset is 
     FS blocksize multiple
  
Actual results:

9169  open("/mnt/u1/control01.ctl", O_RDONLY|O_DIRECT|O_LARGEFILE) = 15
9169  close(15)                         = 0
9169  open("/mnt3/bde/BDETST/control01.ctl",
O_RDWR|O_SYNC|O_DIRECT|O_LARGEFILE) = 15
9169  fcntl64(15, F_SETFD, FD_CLOEXEC)  = 0
9169  fcntl64(15, F_GETFL)              = 0xd002
(flags=O_RDWR|O_SYNC|O_DIRECT|O_LARGEFILE)
9169  fcntl64(15, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0,
len=0}) = 0
9169  gettimeofday({1093901803, 43850}, NULL) = 0
9169  pread(15, 0xbbb5e00, 8192, 512)   = -1 EINVAL (Invalid argument)

Expected results:

O_DIRECT pread/pwrite should work with 512 bytes aligned offset on LVM

Additional info:
Comment 1 Robert 2004-09-07 13:39:57 EDT
Created attachment 103549 [details]
rawread.tar
Comment 5 Robert 2004-10-13 11:54:35 EDT
Note RH's Issue Tracker id for this is: 41346
Comment 10 Ernie Petrides 2005-01-14 19:27:09 EST
A fix for this problem has just been committed to the RHEL3 U5
patch pool this evening (in kernel version 2.4.21-27.8.EL).
Comment 11 Tim Powers 2005-05-18 09:27:55 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2005-294.html

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