summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-11-30 04:35:09 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-11-30 02:53:45 -0800
commitcc3967db49e5983f43530708c1eb4b2708546ad9 (patch)
treee6fba1700f5f59155b2545264a12fe9cc6f9e6ce /xlators/cluster
parentd21e0108638bdde5f46361aadb370061293c8146 (diff)
cluster/afr: Preserve generation number along with inode in lookup and creation fops.
This fixes fuse_create_cbk conflict warnings and random errors while running dbench (typically open handle failure with ENOENT). Signed-off-by: Vikas Gorur <vikas@gluster.com> 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')
-rw-r--r--xlators/cluster/afr/src/afr-dir-write.c14
-rw-r--r--xlators/cluster/afr/src/afr.c9
-rw-r--r--xlators/cluster/afr/src/afr.h6
3 files changed, 26 insertions, 3 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
index 55fc1a006..5387ceb3d 100644
--- a/xlators/cluster/afr/src/afr-dir-write.c
+++ b/xlators/cluster/afr/src/afr-dir-write.c
@@ -101,6 +101,7 @@ afr_create_unwind (call_frame_t *frame, xlator_t *this)
}
unwind_buf->st_ino = local->cont.create.ino;
+ unwind_buf->st_dev = local->cont.create.gen;
local->cont.create.preparent.st_ino = local->cont.create.parent_ino;
local->cont.create.postparent.st_ino = local->cont.create.parent_ino;
@@ -178,6 +179,7 @@ afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
afr_itransform (buf->st_ino,
priv->child_count,
child_index);
+ local->cont.create.gen = buf->st_dev;
if (priv->read_child >= 0) {
afr_set_read_child (this, inode,
@@ -193,6 +195,7 @@ afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
afr_itransform (buf->st_ino,
priv->child_count,
local->first_up_child);
+ local->cont.create.gen = buf->st_dev;
}
if (child_index == local->read_child_index) {
@@ -383,6 +386,7 @@ afr_mknod_unwind (call_frame_t *frame, xlator_t *this)
}
unwind_buf->st_ino = local->cont.mknod.ino;
+ unwind_buf->st_dev = local->cont.mknod.gen;
local->cont.mknod.preparent.st_ino = local->cont.mknod.parent_ino;
local->cont.mknod.postparent.st_ino = local->cont.mknod.parent_ino;
@@ -429,6 +433,7 @@ afr_mknod_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
afr_itransform (buf->st_ino,
priv->child_count,
child_index);
+ local->cont.mknod.gen = buf->st_dev;
if (priv->read_child >= 0) {
afr_set_read_child (this, inode,
@@ -444,6 +449,7 @@ afr_mknod_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
afr_itransform (buf->st_ino,
priv->child_count,
local->first_up_child);
+ local->cont.mknod.gen = buf->st_dev;
}
if (child_index == local->read_child_index) {
@@ -630,6 +636,7 @@ afr_mkdir_unwind (call_frame_t *frame, xlator_t *this)
}
unwind_buf->st_ino = local->cont.mkdir.ino;
+ unwind_buf->st_dev = local->cont.mkdir.gen;
local->cont.mkdir.preparent.st_ino = local->cont.mkdir.parent_ino;
local->cont.mkdir.postparent.st_ino = local->cont.mkdir.parent_ino;
@@ -677,6 +684,7 @@ afr_mkdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
afr_itransform (buf->st_ino,
priv->child_count,
child_index);
+ local->cont.mkdir.gen = buf->st_dev;
if (priv->read_child >= 0) {
afr_set_read_child (this, inode,
@@ -692,6 +700,7 @@ afr_mkdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
afr_itransform (buf->st_ino,
priv->child_count,
local->first_up_child);
+ local->cont.mkdir.gen = buf->st_dev;
}
if (child_index == local->read_child_index) {
@@ -1116,6 +1125,7 @@ afr_symlink_unwind (call_frame_t *frame, xlator_t *this)
}
unwind_buf->st_ino = local->cont.symlink.ino;
+ unwind_buf->st_dev = local->cont.symlink.gen;
local->cont.symlink.preparent.st_ino = local->cont.symlink.parent_ino;
local->cont.symlink.postparent.st_ino = local->cont.symlink.parent_ino;
@@ -1161,7 +1171,8 @@ afr_symlink_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local->cont.symlink.ino =
afr_itransform (buf->st_ino, priv->child_count,
child_index);
-
+ local->cont.symlink.gen = buf->st_dev;
+
if (priv->read_child >= 0) {
afr_set_read_child (this, inode,
priv->read_child);
@@ -1176,6 +1187,7 @@ afr_symlink_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
afr_itransform (buf->st_ino,
priv->child_count,
local->first_up_child);
+ local->cont.symlink.gen = buf->st_dev;
}
if (child_index == local->read_child_index) {
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index b82f412bf..98eaeb6dd 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -567,14 +567,18 @@ afr_lookup_done (call_frame_t *frame, xlator_t *this, struct stat *lookup_buf)
if (local->cont.lookup.ino) {
local->cont.lookup.buf.st_ino = local->cont.lookup.ino;
+ local->cont.lookup.buf.st_dev = local->cont.lookup.gen;
}
if (local->op_ret == 0) {
/* KLUDGE: assuming DHT will not itransform in
revalidate */
- if (local->cont.lookup.inode->ino)
+ if (local->cont.lookup.inode->ino) {
local->cont.lookup.buf.st_ino =
local->cont.lookup.inode->ino;
+ local->cont.lookup.buf.st_dev =
+ local->cont.lookup.inode->generation;
+ }
}
if (local->success_count && local->enoent_count) {
@@ -694,6 +698,7 @@ afr_fresh_lookup_cbk (call_frame_t *frame, void *cookie,
afr_itransform (buf->st_ino,
priv->child_count,
first_up_child);
+ local->cont.lookup.gen = buf->st_dev;
}
if (local->success_count == 0) {
@@ -709,7 +714,6 @@ afr_fresh_lookup_cbk (call_frame_t *frame, void *cookie,
lookup_buf->st_ino = afr_itransform (buf->st_ino,
priv->child_count,
child_index);
-
if (priv->read_child >= 0) {
afr_set_read_child (this,
local->cont.lookup.inode,
@@ -811,6 +815,7 @@ afr_revalidate_lookup_cbk (call_frame_t *frame, void *cookie,
afr_itransform (buf->st_ino,
priv->child_count,
first_up_child);
+ local->cont.lookup.gen = buf->st_dev;
}
/* in case of revalidate, we need to send stat of the
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index 6a1c53cee..09f76351a 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -254,6 +254,7 @@ typedef struct _afr_local {
struct stat read_child_buf;
struct stat postparent;
ino_t ino;
+ uint64_t gen;
ino_t parent_ino;
dict_t *xattr;
gf_boolean_t is_revalidate;
@@ -404,6 +405,7 @@ typedef struct _afr_local {
struct {
ino_t ino;
+ uint64_t gen;
ino_t parent_ino;
fd_t *fd;
int32_t flags;
@@ -417,6 +419,7 @@ typedef struct _afr_local {
struct {
ino_t ino;
+ uint64_t gen;
ino_t parent_ino;
dev_t dev;
mode_t mode;
@@ -429,6 +432,7 @@ typedef struct _afr_local {
struct {
ino_t ino;
+ uint64_t gen;
ino_t parent_ino;
int32_t mode;
inode_t *inode;
@@ -468,6 +472,7 @@ typedef struct _afr_local {
struct {
ino_t ino;
+ uint64_t gen;
ino_t parent_ino;
inode_t *inode;
struct stat buf;
@@ -478,6 +483,7 @@ typedef struct _afr_local {
struct {
ino_t ino;
+ uint64_t gen;
ino_t parent_ino;
inode_t *inode;
struct stat buf;