From: Rui Xiang <rui.xiang@huawei.com>
To: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH 2/2] nfs: fix return err if inode exiting in nfs_instantiate
Date: Wed, 11 Dec 2013 14:09:40 +0800 [thread overview]
Message-ID: <52A801A4.30809@huawei.com> (raw)
In-Reply-To: <1386692771.2879.2.camel@leira.trondhjem.org>
On 2013/12/11 0:26, Trond Myklebust wrote:
> On Mon, 2013-12-09 at 18:42 +0800, Rui Xiang wrote:
>> On 2013/12/6 21:46, Trond Myklebust wrote:
>>>
>>> On Dec 6, 2013, at 4:30, Rui Xiang <rui.xiang@huawei.com> wrote:
>>>
>>>> In common function nfs_instantiate to create, mkdir, and mknod,
>>>> if dentry->d_inode exits, it should return -EEXIST instead of
>>>> -EACCES.
>>>>
>>>> Signed-off-by: Rui Xiang <rui.xiang@huawei.com>
>>>> ---
>>>> fs/nfs/dir.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
>>>> index 2518865..e570b37 100644
>>>> --- a/fs/nfs/dir.c
>>>> +++ b/fs/nfs/dir.c
>>>> @@ -1547,7 +1547,7 @@ int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle,
>>>> struct dentry *parent = dget_parent(dentry);
>>>> struct inode *dir = parent->d_inode;
>>>> struct inode *inode;
>>>> - int error = -EACCES;
>>>> + int error = -EEXIST;
>>>>
>>>> d_drop(dentry);
>>>>
>>>
>>> That looks like it should rather be a WARN_ON(). If the caller has set the dentry's inode before creating the file, then something is really wrong.
>> It can return -EEXIST to say that the file already exits, then will exit. But why does it need a WARN_ON(). Please give me some advise.
>>
>
> If we ever hit that condition then it means that the caller is doing
> something very wrong. That's what the WARN_ON (or WARN_ON_ONCE) would be
> there to check.
>
OK. In that case, is it necessary to send a new patch with the WARN_ON?
Thanks
Rui
next prev parent reply other threads:[~2013-12-11 6:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-06 9:30 [PATCH 1/2] nfs/nfsd: return err directly while malloc failing Rui Xiang
2013-12-06 9:30 ` [PATCH 2/2] nfs: fix return err if inode exiting in nfs_instantiate Rui Xiang
2013-12-06 13:46 ` Trond Myklebust
2013-12-09 10:42 ` Rui Xiang
2013-12-10 16:26 ` Trond Myklebust
2013-12-11 6:09 ` Rui Xiang [this message]
2013-12-06 15:36 ` [PATCH 1/2] nfs/nfsd: return err directly while malloc failing J. Bruce Fields
2013-12-09 12:33 ` Rui Xiang
2013-12-10 16:24 ` Trond Myklebust
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=52A801A4.30809@huawei.com \
--to=rui.xiang@huawei.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@primarydata.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).