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:
Created attachment 103549 [details] rawread.tar
Note RH's Issue Tracker id for this is: 41346
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).
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