summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heal-entry.c
diff options
context:
space:
mode:
authorPranith K <pranithk@gluster.com>2011-07-14 06:30:20 +0000
committerVijay Bellur <vijay@gluster.com>2011-10-19 02:28:02 -0700
commit94943e213a61c83481308dba6adc6b23c3581d2e (patch)
treea1664c9d3e16d6278d996f4f8c148ffcef39acf6 /xlators/cluster/afr/src/afr-self-heal-entry.c
parent449f31c8ae8f1e6df787cfc1d1203ba7f0312cb6 (diff)
cluster/afr: Fix conflict files and gfids
Change-Id: I771045aca9f9a811744aeec0d844609a37ae4792 BUG: 3734 Reviewed-on: http://review.gluster.com/611 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-entry.c')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-entry.c320
1 files changed, 169 insertions, 151 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c
index 8c619ff45a5..3977ae101f6 100644
--- a/xlators/cluster/afr/src/afr-self-heal-entry.c
+++ b/xlators/cluster/afr/src/afr-self-heal-entry.c
@@ -50,9 +50,6 @@
#include "afr-self-heal-common.h"
int
-afr_sh_post_nonblocking_entrylk_cbk (call_frame_t *frame, xlator_t *this);
-
-int
afr_sh_entry_done (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
@@ -362,7 +359,8 @@ afr_sh_entry_expunge_subvol (call_frame_t *frame, xlator_t *this,
int
afr_sh_entry_expunge_entry_done (call_frame_t *frame, xlator_t *this,
- int active_src)
+ int active_src, int32_t op_ret,
+ int32_t op_errno)
{
int call_count = 0;
@@ -385,21 +383,25 @@ afr_sh_entry_expunge_parent_setattr_cbk (call_frame_t *expunge_frame,
afr_self_heal_t *expunge_sh = NULL;
call_frame_t *frame = NULL;
int active_src = (long) cookie;
+ afr_self_heal_t *sh = NULL;
+ afr_local_t *local = NULL;
priv = this->private;
expunge_local = expunge_frame->local;
expunge_sh = &expunge_local->self_heal;
frame = expunge_sh->sh_frame;
+ local = frame->local;
+ sh = &local->self_heal;
if (op_ret != 0) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_log (this->name, GF_LOG_ERROR,
"setattr on parent directory of %s on subvolume %s failed: %s",
expunge_local->loc.path,
priv->children[active_src]->name, strerror (op_errno));
}
AFR_STACK_DESTROY (expunge_frame);
- afr_sh_entry_expunge_entry_done (frame, this, active_src);
+ sh->expunge_done (frame, this, active_src, op_ret, op_errno);
return 0;
}
@@ -510,15 +512,17 @@ afr_sh_entry_expunge_remove (call_frame_t *expunge_frame, xlator_t *this,
afr_private_t *priv = NULL;
afr_local_t *expunge_local = NULL;
afr_self_heal_t *expunge_sh = NULL;
- int source = 0;
call_frame_t *frame = NULL;
int type = 0;
+ afr_self_heal_t *sh = NULL;
+ afr_local_t *local = NULL;
priv = this->private;
expunge_local = expunge_frame->local;
expunge_sh = &expunge_local->self_heal;
frame = expunge_sh->sh_frame;
- source = expunge_sh->source;
+ local = frame->local;
+ sh = &local->self_heal;
type = buf->ia_type;
@@ -538,7 +542,7 @@ afr_sh_entry_expunge_remove (call_frame_t *expunge_frame, xlator_t *this,
gf_log (this->name, GF_LOG_ERROR,
"%s has unknown file type on %s: 0%o",
expunge_local->loc.path,
- priv->children[source]->name, type);
+ priv->children[active_src]->name, type);
goto out;
break;
}
@@ -546,7 +550,7 @@ afr_sh_entry_expunge_remove (call_frame_t *expunge_frame, xlator_t *this,
return 0;
out:
AFR_STACK_DESTROY (expunge_frame);
- afr_sh_entry_expunge_entry_done (frame, this, active_src);
+ sh->expunge_done (frame, this, active_src, -1, EINVAL);
return 0;
}
@@ -564,15 +568,19 @@ afr_sh_entry_expunge_lookup_cbk (call_frame_t *expunge_frame, void *cookie,
afr_self_heal_t *expunge_sh = NULL;
call_frame_t *frame = NULL;
int active_src = 0;
+ afr_self_heal_t *sh = NULL;
+ afr_local_t *local = NULL;
priv = this->private;
expunge_local = expunge_frame->local;
expunge_sh = &expunge_local->self_heal;
frame = expunge_sh->sh_frame;
active_src = (long) cookie;
+ local = frame->local;
+ sh = &local->self_heal;
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_ERROR,
"lookup of %s on %s failed (%s)",
expunge_local->loc.path,
priv->children[active_src]->name,
@@ -585,7 +593,7 @@ afr_sh_entry_expunge_lookup_cbk (call_frame_t *expunge_frame, void *cookie,
return 0;
out:
AFR_STACK_DESTROY (expunge_frame);
- afr_sh_entry_expunge_entry_done (frame, this, active_src);
+ sh->expunge_done (frame, this, active_src, op_ret, op_errno);
return 0;
}
@@ -628,7 +636,8 @@ afr_sh_entry_expunge_entry_cbk (call_frame_t *expunge_frame, void *cookie,
call_frame_t *frame = NULL;
int active_src = 0;
int need_expunge = 0;
-
+ afr_self_heal_t *sh = NULL;
+ afr_local_t *local = NULL;
priv = this->private;
expunge_local = expunge_frame->local;
@@ -636,6 +645,8 @@ afr_sh_entry_expunge_entry_cbk (call_frame_t *expunge_frame, void *cookie,
frame = expunge_sh->sh_frame;
active_src = expunge_sh->active_source;
source = (long) cookie;
+ local = frame->local;
+ sh = &local->self_heal;
if (op_ret == -1 && op_errno == ENOENT)
need_expunge = 1;
@@ -685,7 +696,7 @@ out:
}
AFR_STACK_DESTROY (expunge_frame);
- afr_sh_entry_expunge_entry_done (frame, this, active_src);
+ sh->expunge_done (frame, this, active_src, op_ret, op_errno);
return 0;
}
@@ -706,6 +717,7 @@ afr_sh_entry_expunge_entry (call_frame_t *frame, xlator_t *this,
int source = 0;
int op_errno = 0;
char *name = NULL;
+ int op_ret = -1;
priv = this->private;
local = frame->local;
@@ -713,6 +725,7 @@ afr_sh_entry_expunge_entry (call_frame_t *frame, xlator_t *this,
active_src = sh->active_source;
source = sh->source;
+ sh->expunge_done = afr_sh_entry_expunge_entry_done;
name = entry->d_name;
@@ -724,6 +737,7 @@ afr_sh_entry_expunge_entry (call_frame_t *frame, xlator_t *this,
gf_log (this->name, GF_LOG_TRACE,
"skipping inspection of %s under %s",
name, local->loc.path);
+ op_ret = 0;
goto out;
}
@@ -733,6 +747,7 @@ afr_sh_entry_expunge_entry (call_frame_t *frame, xlator_t *this,
expunge_frame = copy_frame (frame);
if (!expunge_frame) {
+ op_errno = ENOMEM;
goto out;
}
@@ -746,6 +761,7 @@ afr_sh_entry_expunge_entry (call_frame_t *frame, xlator_t *this,
ret = build_child_loc (this, &expunge_local->loc, &local->loc, name);
if (ret != 0) {
+ op_errno = EINVAL;
goto out;
}
@@ -763,7 +779,7 @@ afr_sh_entry_expunge_entry (call_frame_t *frame, xlator_t *this,
ret = 0;
out:
if (ret == -1)
- afr_sh_entry_expunge_entry_done (frame, this, active_src);
+ sh->expunge_done (frame, this, active_src, op_ret, op_errno);
return 0;
}
@@ -896,7 +912,8 @@ out:
int
afr_sh_entry_impunge_entry_done (call_frame_t *frame, xlator_t *this,
- int active_src)
+ int active_src, int32_t op_ret,
+ int32_t op_errno)
{
int call_count = 0;
@@ -924,6 +941,7 @@ afr_sh_entry_impunge_setattr_cbk (call_frame_t *impunge_frame, void *cookie,
call_frame_t *frame = NULL;
int active_src = 0;
int child_index = 0;
+ int32_t impunge_ret_child = 0;
priv = this->private;
impunge_local = impunge_frame->local;
@@ -931,7 +949,7 @@ afr_sh_entry_impunge_setattr_cbk (call_frame_t *impunge_frame, void *cookie,
frame = impunge_sh->sh_frame;
local = frame->local;
sh = &local->self_heal;
- active_src = sh->active_source;
+ active_src = impunge_sh->active_source;
child_index = (long) cookie;
if (op_ret == 0) {
@@ -954,8 +972,10 @@ afr_sh_entry_impunge_setattr_cbk (call_frame_t *impunge_frame, void *cookie,
UNLOCK (&impunge_frame->lock);
if (call_count == 0) {
+ impunge_ret_child = impunge_sh->impunge_ret_child;
AFR_STACK_DESTROY (impunge_frame);
- afr_sh_entry_impunge_entry_done (frame, this, active_src);
+ sh->impunge_done (frame, this, impunge_ret_child, op_ret,
+ op_errno);
}
return 0;
@@ -972,9 +992,8 @@ afr_sh_entry_impunge_xattrop_cbk (call_frame_t *impunge_frame, void *cookie,
afr_local_t *impunge_local = NULL;
afr_self_heal_t *impunge_sh = NULL;
int child_index = 0;
-
- struct iatt stbuf;
- int32_t valid = 0;
+ struct iatt stbuf = {0};
+ int32_t valid = 0;
priv = this->private;
impunge_local = impunge_frame->local;
@@ -1066,6 +1085,7 @@ afr_sh_entry_impunge_newfile_cbk (call_frame_t *impunge_frame, void *cookie,
int32_t valid = 0;
loc_t *parent_loc = NULL;
struct iatt parentbuf = {0,};
+ int32_t impunge_ret_child = 0;
priv = this->private;
impunge_local = impunge_frame->local;
@@ -1073,7 +1093,7 @@ afr_sh_entry_impunge_newfile_cbk (call_frame_t *impunge_frame, void *cookie,
frame = impunge_sh->sh_frame;
local = frame->local;
sh = &local->self_heal;
- active_src = sh->active_source;
+ active_src = impunge_sh->active_source;
child_index = (long) cookie;
@@ -1115,6 +1135,7 @@ afr_sh_entry_impunge_newfile_cbk (call_frame_t *impunge_frame, void *cookie,
pending_array, 3 * sizeof (int32_t));
if (ret < 0) {
GF_FREE (pending_array);
+ pending_array = NULL;
gf_log (this->name, GF_LOG_WARNING,
"Unable to set dict value.");
}
@@ -1162,8 +1183,10 @@ out:
UNLOCK (&impunge_frame->lock);
if (call_count == 0) {
+ impunge_ret_child = impunge_sh->impunge_ret_child;
AFR_STACK_DESTROY (impunge_frame);
- afr_sh_entry_impunge_entry_done (frame, this, active_src);
+ sh->impunge_done (frame, this, impunge_ret_child, -1,
+ op_errno);
}
return 0;
@@ -1262,14 +1285,23 @@ int
afr_sh_entry_impunge_symlink (call_frame_t *impunge_frame, xlator_t *this,
int child_index, const char *linkname)
{
- afr_private_t *priv = NULL;
- afr_local_t *impunge_local = NULL;
- dict_t *dict = NULL;
- struct iatt *buf = NULL;
- int ret = 0;
+ afr_private_t *priv = NULL;
+ afr_local_t *impunge_local = NULL;
+ dict_t *dict = NULL;
+ struct iatt *buf = NULL;
+ int ret = 0;
+ call_frame_t *frame = NULL;
+ afr_local_t *local = NULL;
+ afr_self_heal_t *sh = NULL;
+ afr_self_heal_t *impunge_sh = NULL;
+ int32_t impunge_ret_child = 0;
priv = this->private;
impunge_local = impunge_frame->local;
+ impunge_sh = &impunge_local->self_heal;
+ frame = impunge_sh->sh_frame;
+ local = frame->local;
+ sh = &local->self_heal;
buf = &impunge_local->cont.symlink.buf;
@@ -1277,7 +1309,11 @@ afr_sh_entry_impunge_symlink (call_frame_t *impunge_frame, xlator_t *this,
if (!dict) {
gf_log (this->name, GF_LOG_ERROR,
"Out of memory");
- afr_sh_entry_impunge_entry_done (impunge_frame, this, 0);
+ impunge_ret_child = impunge_sh->impunge_ret_child;
+ AFR_STACK_DESTROY (impunge_frame);
+ sh->impunge_done (impunge_frame, this, impunge_ret_child, -1,
+ ENOMEM);
+ goto out;
}
ret = afr_set_dict_gfid (dict, buf->ia_gfid);
@@ -1299,7 +1335,7 @@ afr_sh_entry_impunge_symlink (call_frame_t *impunge_frame, xlator_t *this,
if (dict)
dict_unref (dict);
-
+out:
return 0;
}
@@ -1318,11 +1354,16 @@ afr_sh_entry_impunge_symlink_unlink_cbk (call_frame_t *impunge_frame,
call_frame_t *frame = NULL;
int call_count = -1;
int active_src = -1;
+ afr_local_t *local = NULL;
+ afr_self_heal_t *sh = NULL;
+ int32_t impunge_ret_child = 0;
priv = this->private;
impunge_local = impunge_frame->local;
impunge_sh = &impunge_local->self_heal;
frame = impunge_sh->sh_frame;
+ local = frame->local;
+ sh = &local->self_heal;
active_src = impunge_sh->active_source;
child_index = (long) cookie;
@@ -1348,8 +1389,10 @@ out:
UNLOCK (&impunge_frame->lock);
if (call_count == 0) {
+ impunge_ret_child = impunge_sh->impunge_ret_child;
AFR_STACK_DESTROY (impunge_frame);
- afr_sh_entry_impunge_entry_done (frame, this, active_src);
+ sh->impunge_done (frame, this, impunge_ret_child, op_ret,
+ op_errno);
}
return 0;
@@ -1394,11 +1437,16 @@ afr_sh_entry_impunge_readlink_sink_cbk (call_frame_t *impunge_frame, void *cooki
call_frame_t *frame = NULL;
int call_count = -1;
int active_src = -1;
+ afr_local_t *local = NULL;
+ afr_self_heal_t *sh = NULL;
+ int32_t impunge_ret_child = 0;
priv = this->private;
impunge_local = impunge_frame->local;
impunge_sh = &impunge_local->self_heal;
frame = impunge_sh->sh_frame;
+ local = frame->local;
+ sh = &local->self_heal;
active_src = impunge_sh->active_source;
child_index = (long) cookie;
@@ -1444,8 +1492,10 @@ out:
UNLOCK (&impunge_frame->lock);
if (call_count == 0) {
+ impunge_ret_child = impunge_sh->impunge_ret_child;
AFR_STACK_DESTROY (impunge_frame);
- afr_sh_entry_impunge_entry_done (frame, this, active_src);
+ sh->impunge_done (frame, this, impunge_ret_child, op_ret,
+ op_errno);
}
return 0;
@@ -1489,11 +1539,16 @@ afr_sh_entry_impunge_readlink_cbk (call_frame_t *impunge_frame, void *cookie,
call_frame_t *frame = NULL;
int call_count = -1;
int active_src = -1;
+ afr_local_t *local = NULL;
+ afr_self_heal_t *sh = NULL;
+ int32_t impunge_ret_child = 0;
priv = this->private;
impunge_local = impunge_frame->local;
impunge_sh = &impunge_local->self_heal;
frame = impunge_sh->sh_frame;
+ local = frame->local;
+ sh = &local->self_heal;
active_src = impunge_sh->active_source;
child_index = (long) cookie;
@@ -1520,8 +1575,10 @@ out:
UNLOCK (&impunge_frame->lock);
if (call_count == 0) {
+ impunge_ret_child = impunge_sh->impunge_ret_child;
AFR_STACK_DESTROY (impunge_frame);
- afr_sh_entry_impunge_entry_done (frame, this, active_src);
+ sh->impunge_done (frame, this, impunge_ret_child, op_ret,
+ op_errno);
}
return 0;
@@ -1552,44 +1609,22 @@ afr_sh_entry_impunge_readlink (call_frame_t *impunge_frame, xlator_t *this,
return 0;
}
-
int
-afr_sh_entry_impunge_recreate_lookup_cbk (call_frame_t *impunge_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)
+afr_sh_entry_impunge_create (call_frame_t *impunge_frame, xlator_t *this,
+ int child_index, struct iatt *buf,
+ struct iatt *postparent)
{
- afr_private_t *priv = NULL;
afr_local_t *impunge_local = NULL;
afr_self_heal_t *impunge_sh = NULL;
- int active_src = 0;
- int type = 0;
- int child_index = 0;
- call_frame_t *frame = NULL;
- int call_count = 0;
+ afr_private_t *priv = NULL;
+ ia_type_t type = IA_INVAL;
+ int ret = 0;
+ int active_src = 0;
- priv = this->private;
impunge_local = impunge_frame->local;
impunge_sh = &impunge_local->self_heal;
- frame = impunge_sh->sh_frame;
-
- child_index = (long) cookie;
-
- active_src = impunge_sh->active_source;
-
- if (op_ret != 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "looking up %s on %s (for %s) failed (%s)",
- impunge_local->loc.path,
- priv->children[active_src]->name,
- priv->children[child_index]->name,
- strerror (op_errno));
- goto out;
- }
-
impunge_sh->parentbuf = *postparent;
-
+ active_src = impunge_sh->active_source;
impunge_local->cont.lookup.buf = *buf;
afr_update_loc_gfids (&impunge_local->loc, buf, postparent);
@@ -1617,10 +1652,58 @@ afr_sh_entry_impunge_recreate_lookup_cbk (call_frame_t *impunge_frame,
"%s has unknown file type on %s: 0%o",
impunge_local->loc.path,
priv->children[active_src]->name, type);
- goto out;
+ ret = -1;
break;
}
+ return ret;
+}
+
+int
+afr_sh_entry_impunge_recreate_lookup_cbk (call_frame_t *impunge_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)
+{
+ afr_private_t *priv = NULL;
+ afr_local_t *impunge_local = NULL;
+ afr_local_t *local = NULL;
+ afr_self_heal_t *impunge_sh = NULL;
+ afr_self_heal_t *sh = NULL;
+ int active_src = 0;
+ int child_index = 0;
+ call_frame_t *frame = NULL;
+ int call_count = 0;
+ int ret = 0;
+ int32_t impunge_ret_child = 0;
+
+ priv = this->private;
+ impunge_local = impunge_frame->local;
+ impunge_sh = &impunge_local->self_heal;
+ frame = impunge_sh->sh_frame;
+ local = frame->local;
+ sh = &local->self_heal;
+
+ child_index = (long) cookie;
+
+ active_src = impunge_sh->active_source;
+
+ if (op_ret != 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "looking up %s on %s (for %s) failed (%s)",
+ impunge_local->loc.path,
+ priv->children[active_src]->name,
+ priv->children[child_index]->name,
+ strerror (op_errno));
+ goto out;
+ }
+
+ ret = afr_sh_entry_impunge_create (impunge_frame, this, child_index, buf,
+ postparent);
+ if (ret)
+ goto out;
+
return 0;
out:
@@ -1631,8 +1714,10 @@ out:
UNLOCK (&impunge_frame->lock);
if (call_count == 0) {
+ impunge_ret_child = impunge_sh->impunge_ret_child;
AFR_STACK_DESTROY (impunge_frame);
- afr_sh_entry_impunge_entry_done (frame, this, active_src);
+ sh->impunge_done (frame, this, impunge_ret_child, op_ret,
+ op_errno);
}
return 0;
@@ -1680,11 +1765,16 @@ afr_sh_entry_impunge_entry_cbk (call_frame_t *impunge_frame, void *cookie,
int child_index = 0;
call_frame_t *frame = NULL;
int active_src = 0;
+ afr_local_t *local = NULL;
+ afr_self_heal_t *sh = NULL;
+ int32_t impunge_ret_child = 0;
priv = this->private;
impunge_local = impunge_frame->local;
impunge_sh = &impunge_local->self_heal;
frame = impunge_sh->sh_frame;
+ local = frame->local;
+ sh = &local->self_heal;
child_index = (long) cookie;
active_src = impunge_sh->active_source;
@@ -1730,8 +1820,10 @@ afr_sh_entry_impunge_entry_cbk (call_frame_t *impunge_frame, void *cookie,
UNLOCK (&impunge_frame->lock);
if (call_count == 0) {
+ impunge_ret_child = impunge_sh->impunge_ret_child;
AFR_STACK_DESTROY (impunge_frame);
- afr_sh_entry_impunge_entry_done (frame, this, active_src);
+ sh->impunge_done (frame, this, impunge_ret_child, op_ret,
+ op_errno);
}
return 0;
@@ -1753,12 +1845,14 @@ afr_sh_entry_impunge_entry (call_frame_t *frame, xlator_t *this,
int i = 0;
int call_count = 0;
int op_errno = 0;
+ int op_ret = -1;
priv = this->private;
local = frame->local;
sh = &local->self_heal;
active_src = sh->active_source;
+ sh->impunge_done = afr_sh_entry_impunge_entry_done;
if ((strcmp (entry->d_name, ".") == 0)
|| (strcmp (entry->d_name, "..") == 0)
@@ -1768,6 +1862,7 @@ afr_sh_entry_impunge_entry (call_frame_t *frame, xlator_t *this,
gf_log (this->name, GF_LOG_TRACE,
"skipping inspection of %s under %s",
entry->d_name, local->loc.path);
+ op_ret = 0;
goto out;
}
@@ -1779,6 +1874,7 @@ afr_sh_entry_impunge_entry (call_frame_t *frame, xlator_t *this,
if (!impunge_frame) {
gf_log (this->name, GF_LOG_ERROR,
"Out of memory.");
+ op_errno = ENOMEM;
goto out;
}
@@ -1788,12 +1884,14 @@ afr_sh_entry_impunge_entry (call_frame_t *frame, xlator_t *this,
impunge_sh = &impunge_local->self_heal;
impunge_sh->sh_frame = frame;
impunge_sh->active_source = active_src;
+ impunge_sh->impunge_ret_child = active_src;
impunge_sh->impunging_entry_mode =
st_mode_from_ia (entry->d_stat.ia_prot, entry->d_stat.ia_type);
ret = build_child_loc (this, &impunge_local->loc, &local->loc, entry->d_name);
if (ret != 0) {
+ op_errno = ENOMEM;
goto out;
}
@@ -1835,7 +1933,7 @@ afr_sh_entry_impunge_entry (call_frame_t *frame, xlator_t *this,
ret = 0;
out:
if (ret == -1)
- afr_sh_entry_impunge_entry_done (frame, this, active_src);
+ sh->impunge_done (frame, this, active_src, op_ret, op_errno);
return 0;
}
@@ -2225,63 +2323,6 @@ afr_sh_entry_lookup_cbk (call_frame_t *frame, void *cookie,
return 0;
}
-
-
-int
-afr_sh_entry_lookup (call_frame_t *frame, xlator_t *this)
-{
- afr_local_t * local = NULL;
- afr_private_t * priv = NULL;
- dict_t *xattr_req = NULL;
- int ret = 0;
- int call_count = 0;
- int i = 0;
- afr_self_heal_t *sh = NULL;
-
- priv = this->private;
- local = frame->local;
- sh = &local->self_heal;
-
- call_count = afr_up_children_count (priv->child_count,
- local->child_up);
-
- local->call_count = call_count;
-
- xattr_req = dict_new();
- if (xattr_req) {
- for (i = 0; i < priv->child_count; i++) {
- ret = dict_set_uint64 (xattr_req,
- priv->pending_key[i],
- 3 * sizeof(int32_t));
- if (ret < 0)
- gf_log (this->name, GF_LOG_WARNING,
- "%s: Unable to set dict value.",
- local->loc.path);
- }
- }
-
- for (i = 0; i < priv->child_count; i++)
- sh->child_success[i] = -1;
- sh->success_count = 0;
- for (i = 0; i < priv->child_count; i++) {
- if (local->child_up[i]) {
- STACK_WIND_COOKIE (frame,
- afr_sh_entry_lookup_cbk,
- (void *) (long) i,
- priv->children[i],
- priv->children[i]->fops->lookup,
- &local->loc, xattr_req);
- if (!--call_count)
- break;
- }
- }
-
- if (xattr_req)
- dict_unref (xattr_req);
-
- return 0;
-}
-
int
afr_sh_post_nonblocking_entry_cbk (call_frame_t *frame, xlator_t *this)
{
@@ -2302,38 +2343,14 @@ afr_sh_post_nonblocking_entry_cbk (call_frame_t *frame, xlator_t *this)
gf_log (this->name, GF_LOG_DEBUG, "Non Blocking entrylks done "
"for %s. Proceeding to FOP", local->loc.path);
- afr_sh_entry_lookup(frame, this);
+ afr_sh_common_lookup (frame, this, &local->loc,
+ afr_sh_entry_lookup_cbk, _gf_false);
}
return 0;
}
int
-afr_sh_entry_lock (call_frame_t *frame, xlator_t *this)
-{
- afr_internal_lock_t *int_lock = NULL;
- afr_local_t *local = NULL;
-
- local = frame->local;
- int_lock = &local->internal_lock;
-
- int_lock->transaction_lk_type = AFR_SELFHEAL_LK;
- int_lock->selfheal_lk_type = AFR_ENTRY_SELF_HEAL_LK;
-
- afr_set_lock_number (frame, this);
-
- int_lock->lk_basename = NULL;
- int_lock->lk_loc = &local->loc;
- int_lock->lock_cbk = afr_sh_post_nonblocking_entry_cbk;
-
- afr_nonblocking_entrylk (frame, this);
-
-
- return 0;
-}
-
-
-int
afr_self_heal_entry (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
@@ -2344,7 +2361,8 @@ afr_self_heal_entry (call_frame_t *frame, xlator_t *this)
local = frame->local;
if (local->self_heal.need_entry_self_heal && priv->entry_self_heal) {
- afr_sh_entry_lock (frame, this);
+ afr_sh_entrylk (frame, this, &local->loc, NULL,
+ afr_sh_post_nonblocking_entry_cbk);
} else {
gf_log (this->name, GF_LOG_TRACE,
"proceeding to completion on %s",