summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heal-metadata.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2016-05-19 16:24:09 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-05-20 02:55:55 -0700
commit6a51464cf4704e7d7fcbce8919a5ef386a9cfd53 (patch)
treea1518d12f36423f0b018bb950b15d3cc12d2093a /xlators/cluster/afr/src/afr-self-heal-metadata.c
parent8a71e498fdcedacd1a32e121b3e081c61ee57a2e (diff)
cluster/afr: Do not inode_link in afr
Race is explained at https://bugzilla.redhat.com/show_bug.cgi?id=1337405#c0 This patch also handles performing of self-heal with shd-pid. Also performs the healing with this->itable's inode rather than main itable. BUG: 1337405 Change-Id: Id657a6623b71998b027b1dff6af5bbdf8cab09c9 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/14422 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-metadata.c')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-metadata.c42
1 files changed, 42 insertions, 0 deletions
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;
+}