summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/afr/src/afr-common.c6
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-metadata.c42
-rw-r--r--xlators/cluster/afr/src/afr-self-heal.h3
3 files changed, 46 insertions, 5 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index d7bc3e29ee2..2043e11d1e8 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -1957,13 +1957,9 @@ afr_lookup_sh_metadata_wrap (void *opaque)
if (first == -1)
goto out;
- inode = inode_link (local->inode, NULL, NULL, &replies[first].poststat);
- if(!inode)
+ if (afr_selfheal_metadata_by_stbuf (this, &replies[first].poststat))
goto out;
- afr_selfheal_metadata (frame, this, inode);
- inode_unref (inode);
-
afr_local_replies_wipe (local, this->private);
dict = dict_new ();
diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c
index 62eedd9ea09..25d8b98adda 100644
--- a/xlators/cluster/afr/src/afr-self-heal-metadata.c
+++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c
@@ -430,3 +430,45 @@ unlock:
afr_replies_wipe (locked_replies, priv->child_count);
return ret;
}
+
+int
+afr_selfheal_metadata_by_stbuf (xlator_t *this, struct iatt *stbuf)
+{
+ inode_t *inode = NULL;
+ inode_t *link_inode = NULL;
+ call_frame_t *frame = NULL;
+ int ret = 0;
+
+ if (gf_uuid_is_null (stbuf->ia_gfid)) {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ inode = inode_new (this->itable);
+ if (!inode) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ link_inode = inode_link (inode, NULL, NULL, stbuf);
+ if (!link_inode) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ frame = afr_frame_create (this);
+ if (!frame) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ ret = afr_selfheal_metadata (frame, this, link_inode);
+out:
+ if (inode)
+ inode_unref (inode);
+ if (link_inode)
+ inode_unref (link_inode);
+ if (frame)
+ AFR_STACK_DESTROY (frame);
+ return ret;
+}
diff --git a/xlators/cluster/afr/src/afr-self-heal.h b/xlators/cluster/afr/src/afr-self-heal.h
index becbe67e084..be787683c19 100644
--- a/xlators/cluster/afr/src/afr-self-heal.h
+++ b/xlators/cluster/afr/src/afr-self-heal.h
@@ -278,4 +278,7 @@ afr_locked_fill (call_frame_t *frame, xlator_t *this,
int
afr_choose_source_by_policy (afr_private_t *priv, unsigned char *sources,
afr_transaction_type type);
+
+int
+afr_selfheal_metadata_by_stbuf (xlator_t *this, struct iatt *stbuf);
#endif /* !_AFR_SELFHEAL_H */