From: "J. Bruce Fields" <bfields@fieldses.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Howells <dhowells@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
hugh@veritas.com, hch@infradead.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] EXPORTFS: handle NULL returns from fh_to_dentry()/fh_to_parent()
Date: Mon, 8 Dec 2008 18:24:18 -0500 [thread overview]
Message-ID: <20081208232418.GJ19417@fieldses.org> (raw)
In-Reply-To: <alpine.LFD.2.00.0812051053190.3386@nehalem.linux-foundation.org>
From: J. Bruce Fields <bfields@citi.umich.edu>
While 440037287c5 "[PATCH] switch all filesystems over to
d_obtain_alias" removed some cases where fh_to_dentry() and
fh_to_parent() could return NULL, there are still a few NULL returns
left in individual filesystems. Thus it was a mistake for that commit
to remove the handling of NULL returns in the callers.
Revert those parts of 440037287c5 which removed the NULL handling.
(We could, alternatively, modify all implementations to return -ESTALE
instead of NULL, but that proves to require fixing a number of
filesystems, and in some cases it's arguably more natural to return
NULL.)
Thanks to David for original patch and Linus, Christoph, and Hugh for
review.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Cc: David Howells <dhowells@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hugh Dickins <hugh@veritas.com>
---
fs/exportfs/expfs.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
On Fri, Dec 05, 2008 at 11:02:00AM -0800, Linus Torvalds wrote:
> So it really seems to make more sense to just make the ESTALE handling be
> a NFS issue.
This thread seems to have died out, and I didn't see any objections to
handling the error in the caller as Linus suggested, so here's the
patch.
Also available from the for-2.6.28 branch at
git://linux-nfs.org/~bfields/linux.git for-2.6.28
--b.
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index 80246ba..890e018 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -367,6 +367,8 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
* Try to get any dentry for the given file handle from the filesystem.
*/
result = nop->fh_to_dentry(mnt->mnt_sb, fid, fh_len, fileid_type);
+ if (!result)
+ result = ERR_PTR(-ESTALE);
if (IS_ERR(result))
return result;
@@ -420,6 +422,8 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
target_dir = nop->fh_to_parent(mnt->mnt_sb, fid,
fh_len, fileid_type);
+ if (!target_dir)
+ goto err_result;
err = PTR_ERR(target_dir);
if (IS_ERR(target_dir))
goto err_result;
--
1.5.5.rc1
next prev parent reply other threads:[~2008-12-08 23:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-05 16:23 [PATCH] EXPORTFS: Don't return NULL from fh_to_dentry()/fh_to_parent() [ver #4] David Howells
2008-12-05 16:39 ` Hugh Dickins
2008-12-05 16:52 ` Linus Torvalds
2008-12-05 17:42 ` J. Bruce Fields
2008-12-09 9:52 ` Christoph Hellwig
2008-12-05 18:49 ` David Howells
2008-12-05 19:02 ` Linus Torvalds
2008-12-08 23:24 ` J. Bruce Fields [this message]
2008-12-09 10:30 ` [PATCH] EXPORTFS: handle NULL returns from fh_to_dentry()/fh_to_parent() David Howells
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=20081208232418.GJ19417@fieldses.org \
--to=bfields@fieldses.org \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=hch@infradead.org \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome