summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src/nfs-inodes.c
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2010-10-12 01:22:28 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-10-12 00:11:23 -0700
commit161850285ff06e90f2c990989bab9513dd4a4289 (patch)
tree340a9cfca92d4497d7460bd4520c0710ee139bc7 /xlators/nfs/server/src/nfs-inodes.c
parentefa94a4237bc98c629671e6fbb58948789604fe5 (diff)
nfs: re-implement logic to perform fresh lookups when lookup revalidates fail
- implement lookup to pass via inode layer so that looked up entries make it to inode cache - implement lookup revalidation failure check in the fop layer Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1756 (NFS must revalidate inode on first ESTALE on lookup) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1756
Diffstat (limited to 'xlators/nfs/server/src/nfs-inodes.c')
-rw-r--r--xlators/nfs/server/src/nfs-inodes.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/xlators/nfs/server/src/nfs-inodes.c b/xlators/nfs/server/src/nfs-inodes.c
index cd334525d2d..a69e1d79179 100644
--- a/xlators/nfs/server/src/nfs-inodes.c
+++ b/xlators/nfs/server/src/nfs-inodes.c
@@ -336,6 +336,62 @@ err:
int32_t
+nfs_inode_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, inode_t *inode,
+ struct iatt *buf, dict_t *xattr,
+ struct iatt *postparent)
+{
+ struct nfs_fop_local *nfl = NULL;
+ fop_lookup_cbk_t progcbk = NULL;
+ inode_t *linked_inode = NULL;
+ uuid_t rootgfid = {0, };
+
+ if (op_ret == -1)
+ goto do_not_link;
+
+ rootgfid[15] = 1;
+ if (uuid_compare (rootgfid, inode->gfid) == 0)
+ goto do_not_link;
+
+ nfl = frame->local;
+
+ linked_inode = inode_link (inode, nfl->newparent, nfl->path, buf);
+
+ if (linked_inode)
+ inode_unref (linked_inode);
+
+do_not_link:
+ inodes_nfl_to_prog_data (nfl, progcbk, frame);
+ if (progcbk)
+ progcbk (frame, cookie, this, op_ret, op_errno, inode, buf,
+ xattr, postparent);
+ return 0;
+}
+
+
+int
+nfs_inode_lookup (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
+ fop_lookup_cbk_t cbk, void *local)
+{
+ struct nfs_fop_local *nfl = NULL;
+ int ret = -EFAULT;
+
+ if ((!nfsx) || (!xl) || (!loc) || (!nfu))
+ return -EFAULT;
+
+ nfs_fop_handle_local_init (NULL, nfsx, nfl, cbk, local, ret, err);
+ nfl_inodes_init (nfl, NULL, NULL, loc->parent, loc->name, NULL);
+ ret = nfs_fop_lookup (nfsx, xl, nfu, loc, nfs_inode_lookup_cbk, nfl);
+
+err:
+ if (ret < 0)
+ nfs_fop_local_wipe (xl, nfl);
+
+ return ret;
+}
+
+
+int32_t
nfs_inode_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *preparent,
struct iatt *postparent)