Bug 131981 - O_DIRECT doesn't work on LVM devices
Summary: O_DIRECT doesn't work on LVM devices
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: kernel (Show other bugs)
(Show other bugs)
Version: 3.0
Hardware: i686 Linux
Target Milestone: ---
Assignee: Heinz Mauelshagen
QA Contact:
Depends On:
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:
Story Points: ---
Clone Of:
Last Closed: 2005-05-18 13:27:55 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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 17:39 UTC, Robert
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2005:294 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

How reproducible:

Steps to Reproduce:

Using attached rawread to simulate O_DIRECT pread to /mnt/u1/<anyfile>
/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",
9169  fcntl64(15, F_SETFD, FD_CLOEXEC)  = 0
9169  fcntl64(15, F_GETFL)              = 0xd002
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]

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.


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