Patchwork [BUG:1756,1/2] nfs: Undo selective changes in inode revalidation

login
register
Submitter Shehjar Tikoo
Date 2010-11-25 05:47:07
Message ID <1290664028-11580-1-git-send-email-shehjart@gluster.com>
Download mbox | patch
Permalink /patch/5775/
State Accepted
Headers show

Comments

Shehjar Tikoo - 2010-11-25 05:47:07
From: Shehjar Tikoo <shehjart@gluster.com>

Those changes were brought in by commit 161850285ff06e90f2c990989bab9513dd4a4289:
"nfs: re-implement logic to perform fresh lookups when lookup revalidates fail"

Signed-off-by: Shehjar Tikoo <shehjart@gluster.com>
---
 xlators/nfs/server/src/nfs-fops.c     |   29 +----------------
 xlators/nfs/server/src/nfs-fops.h     |    6 ---
 xlators/nfs/server/src/nfs-generics.c |    3 +-
 xlators/nfs/server/src/nfs-inodes.c   |   56 ---------------------------------
 4 files changed, 2 insertions(+), 92 deletions(-)

Patch

diff --git a/xlators/nfs/server/src/nfs-fops.c b/xlators/nfs/server/src/nfs-fops.c
index 1c5b4f5..787dcc4 100644
--- a/xlators/nfs/server/src/nfs-fops.c
+++ b/xlators/nfs/server/src/nfs-fops.c
@@ -74,8 +74,6 @@  nfs_fop_local_wipe (xlator_t *nfsx, struct nfs_fop_local *l)
         if (l->dictgfid)
                 dict_unref (l->dictgfid);
 
-        loc_wipe (&l->revalidate_loc);
-
         mem_put (nfs->foppool, l);
 
         return;
@@ -307,29 +305,9 @@  nfs_fop_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
 {
         struct nfs_fop_local    *local = NULL;
         fop_lookup_cbk_t        progcbk;
-        inode_table_t           *itable = NULL;
-        xlator_t                *xl = NULL;
-
-        xl = cookie;
-
-        local = frame->local;
-        nfs_fop_restore_root_ino (local, buf, NULL, NULL, postparent);
-
-        if (op_ret == -1 && local->is_revalidate == 1) {
-                /* perform a fresh lookup if revalidate fails */
-                itable = local->revalidate_loc.inode->table;
-                inode_unref (local->revalidate_loc.inode);
-                local->revalidate_loc.inode = inode_new (itable);
-
-                local->is_revalidate = 2; /* prevent entering revalidate loops */
-
-                STACK_WIND_COOKIE (frame, nfs_fop_lookup_cbk, xl, xl,
-                                   xl->fops->lookup, &local->revalidate_loc,
-                                   local->dictgfid);
-                return 0;
-        }
 
         nfl_to_prog_data (local, progcbk, frame);
+        nfs_fop_restore_root_ino (local, buf, NULL, NULL, postparent);
         if (progcbk)
                 progcbk (frame, cookie, this, op_ret, op_errno, inode, buf,
                          xattr, postparent);
@@ -356,11 +334,6 @@  nfs_fop_lookup (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
         nfs_fop_save_root_ino (nfl, loc);
         nfs_fop_gfid_setup (nfl, loc->inode, ret, err);
 
-        if (!uuid_is_null (loc->inode->gfid)) {
-                nfl->is_revalidate = 1;
-                loc_copy (&nfl->revalidate_loc, loc);
-        }
-
         STACK_WIND_COOKIE (frame, nfs_fop_lookup_cbk, xl, xl,
                            xl->fops->lookup, loc, nfl->dictgfid);
 
diff --git a/xlators/nfs/server/src/nfs-fops.h b/xlators/nfs/server/src/nfs-fops.h
index 4feb916..d010db2 100644
--- a/xlators/nfs/server/src/nfs-fops.h
+++ b/xlators/nfs/server/src/nfs-fops.h
@@ -100,12 +100,6 @@  struct nfs_fop_local {
         char            newpath[NFS_NAME_MAX];
         xlator_t        *nfsx;
         dict_t          *dictgfid;
-
-        /* Determine whether the call was a lookup revalidate in cases where
-         * lookup fails. Mangle the copied loc_t to perform a fresh lookup
-         */
-        int             is_revalidate;
-        loc_t           revalidate_loc;
 };
 
 extern struct nfs_fop_local *
diff --git a/xlators/nfs/server/src/nfs-generics.c b/xlators/nfs/server/src/nfs-generics.c
index eb6dc58..0ebba68 100644
--- a/xlators/nfs/server/src/nfs-generics.c
+++ b/xlators/nfs/server/src/nfs-generics.c
@@ -83,8 +83,7 @@  nfs_lookup (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
         if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
                 return ret;
 
-        ret = nfs_inode_lookup (nfsx, xl, nfu, pathloc, cbk, local);
-
+        ret = nfs_fop_lookup (nfsx, xl, nfu, pathloc, cbk, local);
         return ret;
 }
 
diff --git a/xlators/nfs/server/src/nfs-inodes.c b/xlators/nfs/server/src/nfs-inodes.c
index a69e1d7..cd33452 100644
--- a/xlators/nfs/server/src/nfs-inodes.c
+++ b/xlators/nfs/server/src/nfs-inodes.c
@@ -336,62 +336,6 @@  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)