From: majianpeng <majianpeng@gmail.com>
To: "Jens Axboe" <jaxboe@fusionio.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: For the condition "file->f_mode", when it failed, it should return EACCES rather than EBADF.
Date: Mon, 4 Feb 2013 10:07:05 +0800 [thread overview]
Message-ID: <2013020410070150879010@gmail.com> (raw)
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!
WARNING: multiple messages have this Message-ID (diff)
From: majianpeng <majianpeng@gmail.com>
To: "Jens Axboe" <jaxboe@fusionio.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: For the condition "file->f_mode", when it failed, it should return EACCES rather than EBADF.
Date: Mon, 4 Feb 2013 10:07:05 +0800 [thread overview]
Message-ID: <2013020410070150879010@gmail.com> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 768 bytes --]
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!
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next reply other threads:[~2013-02-04 2:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-04 2:07 majianpeng [this message]
2013-02-04 2:07 ` For the condition "file->f_mode", when it failed, it should return EACCES rather than EBADF majianpeng
2013-02-05 13:21 ` Jens Axboe
2013-02-05 15:39 ` majianpeng
2013-02-05 15:39 ` majianpeng
2013-02-05 20:19 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2013020410070150879010@gmail.com \
--to=majianpeng@gmail.com \
--cc=jaxboe@fusionio.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.