lkml.org 
[lkml]   [2013]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectFor the condition "file->f_mode", when it failed, it should return EACCES rather than EBADF.
Hi all,
When I wanted to do discard operations,but i set the openflag was O_RDONLY,it returned a EBADF rather than EACCES or EPERM.
I searched the code and found:
>case BLKDISCARD:
>case BLKSECDISCARD: {
> uint64_t range[2];

> if (!(mode & FMODE_WRITE))
> return -EBADF;
Initial i thought there was error.But i searched all code of kernel and found some places like this.

The description of EBADF is "Bad file numbe". There are some places where returned EBADF like,
>if (!f.file)
> return -EBADF;

So i think for checking file->f_mode when failed, it should return EACCESS.


Jianpeng Ma
Thanks!


\
 
 \ /
  Last update: 2013-02-04 03:42    [W:0.063 / U:0.780 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site