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-fops.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-fops.c')
| -rw-r--r-- | xlators/nfs/server/src/nfs-fops.c | 25 | 
1 files changed, 25 insertions, 0 deletions
diff --git a/xlators/nfs/server/src/nfs-fops.c b/xlators/nfs/server/src/nfs-fops.c index 4928deb969f..f748c1fa34c 100644 --- a/xlators/nfs/server/src/nfs-fops.c +++ b/xlators/nfs/server/src/nfs-fops.c @@ -74,6 +74,8 @@ 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; @@ -300,9 +302,27 @@ 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;          nfl_to_prog_data (local, progcbk, frame);          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; +        } +          if (progcbk)                  progcbk (frame, cookie, this, op_ret, op_errno, inode, buf,                           xattr, postparent); @@ -329,6 +349,11 @@ 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, 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);  | 
