summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2010-02-25 15:38:07 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-03-04 03:13:28 -0800
commita8f10e72f265e96f3785f278a3c4a3631b9f0392 (patch)
tree6dcd0a10831987279c3544e4cd4e13a4259a10f8 /xlators/cluster/dht/src
parent11433ebf94a58e0a40f115be8c6fe919c29ed61b (diff)
distribute, nufa: return 0 mtimes in preparent/postparent
Returning 0 times means the values are unreliable and not to be trusted for the purposes of caching. This is a temporary fix till we bring in proper times handling in DHT to return consistant values for parent inodes. Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 597 (miscellaneous fixes for xlators to work well with NFS xlator) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=597
Diffstat (limited to 'xlators/cluster/dht/src')
-rw-r--r--xlators/cluster/dht/src/dht-common.c35
-rw-r--r--xlators/cluster/dht/src/dht-common.h2
-rw-r--r--xlators/cluster/dht/src/dht-rename.c20
-rw-r--r--xlators/cluster/dht/src/nufa.c3
4 files changed, 58 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 326724a993d..5dff5b87725 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -69,6 +69,8 @@ dht_lookup_selfheal_cbk (call_frame_t *frame, void *cookie,
local->postparent.st_ino = local->loc.parent->ino;
}
+ WIPE (&local->postparent);
+
DHT_STACK_UNWIND (lookup, frame, ret, local->op_errno, local->inode,
&local->stbuf, local->xattr, &local->postparent);
@@ -310,7 +312,9 @@ unlock:
local->op_ret = -1;
local->op_errno = ESTALE;
}
-
+
+ WIPE (&local->postparent);
+
DHT_STACK_UNWIND (lookup, frame, local->op_ret, local->op_errno,
local->inode, &local->stbuf, local->xattr,
&local->postparent);
@@ -356,6 +360,8 @@ dht_lookup_linkfile_create_cbk (call_frame_t *frame, void *cookie,
local->postparent.st_ino = local->loc.parent->ino;
unwind:
+ WIPE (&local->postparent);
+
DHT_STACK_UNWIND (lookup, frame, local->op_ret, local->op_errno,
local->inode, &local->stbuf, local->xattr,
&local->postparent);
@@ -501,6 +507,8 @@ unlock:
local->postparent.st_ino =
local->loc.parent->ino;
+ WIPE (&local->postparent);
+
DHT_STACK_UNWIND (lookup, frame, local->op_ret,
local->op_errno, local->inode,
&local->stbuf, local->xattr,
@@ -609,6 +617,8 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,
}
out:
+ WIPE (postparent);
+
DHT_STACK_UNWIND (lookup, frame, op_ret, op_errno, inode, stbuf, xattr,
postparent);
@@ -757,7 +767,10 @@ out:
* correct values. since, postparent corresponds to a directory these
* two members should have values equal to sum of corresponding values
* from each of the subvolume. See dht_stat_merge for reference.
- */
+ */
+
+ WIPE (postparent);
+
DHT_STACK_UNWIND (lookup, frame, op_ret, op_errno, inode, stbuf, xattr,
postparent);
return 0;
@@ -1224,6 +1237,9 @@ dht_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
unlock:
UNLOCK (&frame->lock);
+ WIPE (postparent);
+ WIPE (preparent);
+
DHT_STACK_UNWIND (unlink, frame, local->op_ret, local->op_errno,
preparent, postparent);
@@ -2491,6 +2507,9 @@ dht_newfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (local->loc.parent) {
preparent->st_ino = local->loc.parent->ino;
postparent->st_ino = local->loc.parent->ino;
+
+ WIPE (preparent);
+ WIPE (postparent);
}
ret = dht_layout_preset (this, prev->this, inode);
@@ -2778,6 +2797,9 @@ dht_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
preparent->st_ino = local->loc2.parent->ino;
postparent->st_ino = local->loc2.parent->ino;
+ WIPE (preparent);
+ WIPE (postparent);
+
out:
DHT_STACK_UNWIND (link, frame, op_ret, op_errno, inode, stbuf, preparent,
postparent);
@@ -2918,6 +2940,9 @@ dht_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (local->loc.parent) {
preparent->st_ino = local->loc.parent->ino;
postparent->st_ino = local->loc.parent->ino;
+
+ WIPE (preparent);
+ WIPE (postparent);
}
ret = dht_layout_preset (this, prev->this, inode);
@@ -3070,6 +3095,9 @@ dht_mkdir_selfheal_cbk (call_frame_t *frame, void *cookie,
if (local->loc.parent) {
local->preparent.st_ino = local->loc.parent->ino;
local->postparent.st_ino = local->loc.parent->ino;
+
+ WIPE (&local->preparent);
+ WIPE (&local->postparent);
}
}
@@ -3344,6 +3372,9 @@ unlock:
local->loc.parent->ino;
local->postparent.st_ino =
local->loc.parent->ino;
+
+ WIPE (&local->preparent);
+ WIPE (&local->postparent);
}
DHT_STACK_UNWIND (rmdir, frame, local->op_ret,
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h
index d739f852dc4..9974bc0d2fc 100644
--- a/xlators/cluster/dht/src/dht-common.h
+++ b/xlators/cluster/dht/src/dht-common.h
@@ -156,6 +156,8 @@ struct dht_disk_layout {
};
typedef struct dht_disk_layout dht_disk_layout_t;
+#define WIPE(statp) do { typeof(*statp) z = {0,}; if (statp) *statp = z; } while (0)
+
#define ENTRY_MISSING(op_ret, op_errno) (op_ret == -1 && op_errno == ENOENT)
#define is_fs_root(loc) (strcmp (loc->path, "/") == 0)
diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c
index 92e305613d0..11dab01939c 100644
--- a/xlators/cluster/dht/src/dht-rename.c
+++ b/xlators/cluster/dht/src/dht-rename.c
@@ -82,6 +82,11 @@ dht_rename_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local->preparent.st_ino = local->loc2.parent->ino;
local->postparent.st_ino = local->loc2.parent->ino;
+ WIPE (&local->preoldparent);
+ WIPE (&local->postoldparent);
+ WIPE (&local->preparent);
+ WIPE (&local->postparent);
+
DHT_STACK_UNWIND (rename, frame, local->op_ret, local->op_errno,
&local->stbuf, &local->preoldparent,
&local->postoldparent,
@@ -256,6 +261,11 @@ dht_rename_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
prev->this->name, strerror (op_errno));
}
+ WIPE (&local->preoldparent);
+ WIPE (&local->postoldparent);
+ WIPE (&local->preparent);
+ WIPE (&local->postparent);
+
if (is_last_call (this_call_cnt))
DHT_STACK_UNWIND (rename, frame, local->op_ret, local->op_errno,
&local->stbuf, &local->preoldparent,
@@ -368,6 +378,11 @@ dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
return 0;
unwind:
+ WIPE (&local->preoldparent);
+ WIPE (&local->postoldparent);
+ WIPE (&local->preparent);
+ WIPE (&local->postparent);
+
DHT_STACK_UNWIND (rename, frame, local->op_ret, local->op_errno,
&local->stbuf, &local->preoldparent,
&local->postoldparent, &local->preparent,
@@ -445,6 +460,11 @@ dht_rename_links_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
return 0;
unwind:
+ WIPE (&local->preoldparent);
+ WIPE (&local->postoldparent);
+ WIPE (&local->preparent);
+ WIPE (&local->postparent);
+
DHT_STACK_UNWIND (rename, frame, local->op_ret, local->op_errno,
&local->stbuf, &local->preoldparent,
&local->postoldparent, &local->preparent,
diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c
index 96cc5fe3e2e..eb12be60d9f 100644
--- a/xlators/cluster/dht/src/nufa.c
+++ b/xlators/cluster/dht/src/nufa.c
@@ -401,6 +401,9 @@ nufa_mknod_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
return 0;
}
+ WIPE (postparent);
+ WIPE (preparent);
+
DHT_STACK_UNWIND (link, frame, op_ret, op_errno,
inode, stbuf, preparent, postparent);
return 0;