summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/nufa.c
diff options
context:
space:
mode:
authorAnand V. Avati <avati@blackhole.gluster.com>2009-10-16 07:30:23 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-16 06:22:10 -0700
commitcb76cadb74a36e220a2b6a886c0c8068abdad0c7 (patch)
tree16136a771cda80b982018c2cf09249307c05d7ee /xlators/cluster/dht/src/nufa.c
parentfa4e9d639b95b557ae64dab38c4c3ff8a0ec0d7a (diff)
distribute,nufa: layout handling changes
changes to make revalidate not fail but instead perform fresh lookup and swap inode context (layout) safely Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 315 (generation number support) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=315
Diffstat (limited to 'xlators/cluster/dht/src/nufa.c')
-rw-r--r--xlators/cluster/dht/src/nufa.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c
index 545017c77..710d5b95f 100644
--- a/xlators/cluster/dht/src/nufa.c
+++ b/xlators/cluster/dht/src/nufa.c
@@ -33,7 +33,6 @@ nufa_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_t *inode, struct stat *stbuf, dict_t *xattr,
struct stat *postparent)
{
- dht_layout_t *layout = NULL;
xlator_t *subvol = NULL;
char is_linkfile = 0;
char is_dir = 0;
@@ -43,6 +42,7 @@ nufa_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int i = 0;
call_frame_t *prev = NULL;
int call_cnt = 0;
+ int ret = 0;
conf = this->private;
@@ -71,17 +71,16 @@ nufa_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_itransform (this, prev->this, stbuf->st_ino,
&stbuf->st_ino);
- layout = dht_layout_for_subvol (this, prev->this);
- if (!layout) {
+ ret = dht_layout_preset (this, prev->this, inode);
+ if (ret < 0) {
gf_log (this->name, GF_LOG_DEBUG,
- "no pre-set layout for subvolume %s",
+ "could not set pre-set layout for subvol %s",
prev->this->name);
op_ret = -1;
op_errno = EINVAL;
goto err;
}
- inode_ctx_put (inode, this, (uint64_t)(long)layout);
goto out;
}
@@ -205,7 +204,7 @@ nufa_lookup (call_frame_t *frame, xlator_t *this,
local->hashed_subvol = hashed_subvol;
if (is_revalidate (loc)) {
- layout = dht_layout_get (this, loc->inode);
+ local->layout = layout = dht_layout_get (this, loc->inode);
if (!layout) {
gf_log (this->name, GF_LOG_DEBUG,
@@ -219,8 +218,8 @@ nufa_lookup (call_frame_t *frame, xlator_t *this,
gf_log (this->name, GF_LOG_DEBUG,
"incomplete layout failure for path=%s",
loc->path);
- op_errno = ESTALE;
- goto err;
+ dht_layout_unref (this, local->layout);
+ goto do_fresh_lookup;
}
local->inode = inode_ref (loc->inode);
@@ -246,6 +245,7 @@ nufa_lookup (call_frame_t *frame, xlator_t *this,
break;
}
} else {
+ do_fresh_lookup:
ret = dict_set_uint32 (local->xattr_req,
"trusted.glusterfs.dht", 4 * 4);