Re: Problem reading file with O_DIRECT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




I found that O_DIRECT calls get_user_pages() to map kernel  user space pages in order to provide direct user-space access to the driver.

 get_user_pages  cheks thats if the user space address is memory-mapped or not by VM_IO flag.
If it is memory mapped then it retuns "Bad Address" error.

if ( !vma
               || (pages && vma->vm_flags & VM_IO)     /*
                || !(flags & vma->vm_flags))        //  I removed this line and O_DIRECT works now for memory mapped address
        {    printk ( "FAILING here 1");
            return i ? : -EFAULT;
        }


But now sure how much correct this hack is???


-manisha
On 7/4/06, Learner <ruxyz@xxxxxxxxx> wrote:
Check out this

http://oss.sgi.com/archives/xfs/2003-05/msg00082.html

--- Manisha Maheshwari < maheshwari.manisha@xxxxxxxxx>
wrote:

> I am having problem reading file if  the file is
> opened with O_DIERCT
> flag.The error given by read system call is 'Bad
> Address'.
> The buffer where i am trying to read is a device
> that is mapped into the
> process address space.
> I have checked that buffer is mapped by looking into
> the proc/<pid of my
> process>/maps.
> I am using ext2 filesysytem with blocksize is 2048.
> The address where i am trying to read is block
> aligned(i.e 2048
> byte aligned) and the number of bytes i am trying to
> read is also multiple
> of 2048.
> I am using kernel release:2.6.XXX.
>
> I couldn't understand why it's creating problem with
> O_DIRECT because the
> program works if i open file without O_DIRECT.
>
> -manisha
>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux