Bug 131981 - O_DIRECT doesn't work on LVM devices
Summary: O_DIRECT doesn't work on LVM devices
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: kernel
Version: 3.0
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Heinz Mauelshagen
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-09-07 17:33 UTC by Robert
Modified: 2007-11-30 22:07 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-05-18 13:27:55 UTC
Target Upstream Version:
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2005:294 0 normal SHIPPED_LIVE Moderate: Updated kernel packages available for Red Hat Enterprise Linux 3 Update 5 2005-05-18 04:00:00 UTC

Description Robert 2004-09-07 17:33:41 UTC
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 17:39:57 UTC
Created attachment 103549 [details]
rawread.tar

Comment 5 Robert 2004-10-13 15:54:35 UTC
Note RH's Issue Tracker id for this is: 41346

Comment 10 Ernie Petrides 2005-01-15 00:27:09 UTC
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 13:27:55 UTC
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.