linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: hch@infradead.org, viro@ZenIV.linux.org.uk
Cc: dhowells@redhat.com, linux-fsdevel@vger.kernel.org
Subject: [PATCH 2/3] EXPORTFS: Have fh_to_*() return -ESTALE if the file handle type is unrecognised [try #2]
Date: Wed, 03 Dec 2008 18:30:38 +0000	[thread overview]
Message-ID: <20081203183038.2636.74428.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <20081203183033.2636.47937.stgit@warthog.procyon.org.uk>

Make fh_to_dentry() and fh_to_parent() operations return -ESTALE rather than a
negative dentry if the file handle type is unrecognised.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/libfs.c                    |    4 ++++
 fs/xfs/linux-2.6/xfs_export.c |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)


diff --git a/fs/libfs.c b/fs/libfs.c
index 4fe5b5b..47952f2 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -758,6 +758,8 @@ struct dentry *generic_fh_to_dentry(struct super_block *sb, struct fid *fid,
 	case FILEID_INO32_GEN_PARENT:
 		inode = get_inode(sb, fid->i32.ino, fid->i32.gen);
 		break;
+	default:
+		return ERR_PTR(-ESTALE);
 	}
 
 	return d_obtain_alias(inode);
@@ -791,6 +793,8 @@ struct dentry *generic_fh_to_parent(struct super_block *sb, struct fid *fid,
 		inode = get_inode(sb, fid->i32.parent_ino,
 				  (fh_len > 3 ? fid->i32.parent_gen : 0));
 		break;
+	default:
+		return ERR_PTR(-ESTALE);
 	}
 
 	return d_obtain_alias(inode);
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c
index f9a51c4..7a4c75f 100644
--- a/fs/xfs/linux-2.6/xfs_export.c
+++ b/fs/xfs/linux-2.6/xfs_export.c
@@ -161,6 +161,8 @@ xfs_fs_fh_to_dentry(struct super_block *sb, struct fid *fid,
 	case FILEID_INO32_GEN | XFS_FILEID_TYPE_64FLAG:
 		inode = xfs_nfs_get_inode(sb, fid64->ino, fid64->gen);
 		break;
+	default:
+		return ERR_PTR(-ESTALE);
 	}
 
 	return d_obtain_alias(inode);
@@ -182,6 +184,8 @@ xfs_fs_fh_to_parent(struct super_block *sb, struct fid *fid,
 		inode = xfs_nfs_get_inode(sb, fid64->parent_ino,
 					      fid64->parent_gen);
 		break;
+	default:
+		return ERR_PTR(-ESTALE);
 	}
 
 	return d_obtain_alias(inode);


  reply	other threads:[~2008-12-03 18:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-03 18:30 [PATCH 1/3] EXPORTFS: Don't return NULL from fh_to_dentry()/fh_to_parent() [try #2] David Howells
2008-12-03 18:30 ` David Howells [this message]
2008-12-04 19:31   ` [PATCH 2/3] EXPORTFS: Have fh_to_*() return -ESTALE if the file handle type is unrecognised " J. Bruce Fields
2008-12-05  9:14   ` David Howells
2008-12-03 18:30 ` [PATCH 3/3] EXPORTFS: Update the documentation and comments and adjust the types used " David Howells
2008-12-04 19:32   ` J. Bruce Fields
2008-12-05  9:09   ` David Howells
2008-12-08 23:59     ` J. Bruce Fields
2008-12-04 19:07 ` [PATCH 1/3] EXPORTFS: Don't return NULL from fh_to_dentry()/fh_to_parent() " J. Bruce Fields
2008-12-05  9:13 ` 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=20081203183038.2636.74428.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --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).