diff options
author | Anand Avati <avati@gluster.com> | 2010-10-11 06:43:35 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-10-11 07:31:33 -0700 |
commit | 563ef3d12f8d7a927b403d04c279d9fc702faad0 (patch) | |
tree | 97f4aeab4d7233a779d3913d6249e871054112a0 /xlators/nfs/server/src/nfs-inodes.c | |
parent | 6dd3b7fa3bc7acf9281cc17f08010675e2297089 (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.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/xlators/nfs/server/src/nfs-inodes.c b/xlators/nfs/server/src/nfs-inodes.c index cd334525d2d..7f421034852 100644 --- a/xlators/nfs/server/src/nfs-inodes.c +++ b/xlators/nfs/server/src/nfs-inodes.c @@ -336,6 +336,56 @@ 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; + + if (op_ret == -1) + 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) |