From: Christoph Hellwig <hch@infradead.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: hch@lst.de, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 3/4] switch all filesystems over to d_obtain_alias
Date: Tue, 9 Sep 2008 11:31:08 -0400 [thread overview]
Message-ID: <20080909153108.GB29279@infradead.org> (raw)
In-Reply-To: <E1Kd3GQ-0001v9-4u@pomaz-ex.szeredi.hu>
On Tue, Sep 09, 2008 at 03:28:14PM +0200, Miklos Szeredi wrote:
> > - if (get_node_id(inode) != FUSE_ROOT_ID) {
> > + entry = d_obtain_alias(inode);
> > + if (entry && !IS_ERR(entry) && get_node_id(inode) != FUSE_ROOT_ID) {
>
> checking for entry != NULL superfluous here.
True.
> > }
> > @@ -696,17 +692,14 @@ static struct dentry *fuse_get_parent(st
> > name.name = "..";
> > err = fuse_lookup_name(child_inode->i_sb, get_node_id(child_inode),
> > &name, &outarg, &inode);
> > - if (err && err != -ENOENT)
> > - return ERR_PTR(err);
> > - if (err || !inode)
> > - return ERR_PTR(-ESTALE);
> > -
> > - parent = d_alloc_anon(inode);
> > - if (!parent) {
> > - iput(inode);
> > - return ERR_PTR(-ENOMEM);
> > + if (err) {
> > + if (err == -ENOENT)
> > + return -ESTALE;
> > + return err;
> > }
> > - if (get_node_id(inode) != FUSE_ROOT_ID) {
> > +
> > + parent = d_obtain_alias(inode);
> > + if (parent && !IS_ERR(parent) && get_node_id(inode) != FUSE_ROOT_ID) {
>
> This is buggy: we want to return ERR_PTR(-ESTALE) for !inode, not
> NULL. So again, either d_obtain_alias() should turn !inode into
> -ENOENT, (which would gain nothing in this case) or it should simply
> expect inode to be not NULL.
ESTALE doesn't really help us here, but I agree that we want an error
return.
> Doing the !inode check in d_obtain_alias() seems only to confuse
> things, instead of simplifying them.
Doing the !inode check here means we can do a return
d_obtain_alias(foo_iget())) tailcall which is quite useful to reduce the
mess in the export operations.
prev parent reply other threads:[~2008-09-09 15:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-11 13:49 [PATCH 3/4] switch all filesystems over to d_obtain_alias Christoph Hellwig
2008-08-12 12:29 ` steve
2008-09-09 13:28 ` Miklos Szeredi
2008-09-09 15:31 ` Christoph Hellwig [this message]
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=20080909153108.GB29279@infradead.org \
--to=hch@infradead.org \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=viro@zeniv.linux.org.uk \
/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).