|
|
12a457 |
From 814ae32757bf65eb497b41f5ab504593a05520f0 Mon Sep 17 00:00:00 2001
|
|
|
12a457 |
From: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
12a457 |
Date: Mon, 28 Mar 2016 16:31:12 +0530
|
|
|
12a457 |
Subject: [PATCH 74/80] cluster/afr: Don't lookup/forget inodes
|
|
|
12a457 |
|
|
|
12a457 |
Problem:
|
|
|
12a457 |
All inodes that are looked-up are always forgotten without fail in
|
|
|
12a457 |
afr removing the benefits of them being in lru. This same code can
|
|
|
12a457 |
cause crashes if between inode_lookup, inode_forget in afr if the
|
|
|
12a457 |
top xlator does inode_forget(0).
|
|
|
12a457 |
|
|
|
12a457 |
Fix:
|
|
|
12a457 |
Don't use lookup/forget in afr. No benefits are there at the moment
|
|
|
12a457 |
for keeping this code. It is impossible to prevent top xlators to
|
|
|
12a457 |
do inode_forget(0). Found similar instances in ec
|
|
|
12a457 |
and removed them even though those code paths are not going to
|
|
|
12a457 |
be executed in any place other than heal-daemon.
|
|
|
12a457 |
|
|
|
12a457 |
>BUG: 1321554
|
|
|
12a457 |
>Change-Id: Ia4cb236178f7f129cc898d53f0bbd26f494a2a8d
|
|
|
12a457 |
>Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
12a457 |
>Reviewed-on: http://review.gluster.org/13834
|
|
|
12a457 |
>Smoke: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
12a457 |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
>Reviewed-by: Anuradha Talur <atalur@redhat.com>
|
|
|
12a457 |
|
|
|
12a457 |
>BUG: 1327864
|
|
|
12a457 |
>Change-Id: I3507ed88cd75e069ed302525bfa259cf407871fb
|
|
|
12a457 |
>Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
12a457 |
>Reviewed-on: http://review.gluster.org/14009
|
|
|
12a457 |
>Smoke: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
12a457 |
|
|
|
12a457 |
BUG: 1314724
|
|
|
12a457 |
Change-Id: Ib8607fedd60722877539f36c2f79c94531cc2538
|
|
|
12a457 |
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
12a457 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/72372
|
|
|
12a457 |
---
|
|
|
12a457 |
xlators/cluster/afr/src/afr-common.c | 7 ++-----
|
|
|
12a457 |
xlators/cluster/afr/src/afr-self-heal-common.c | 20 ++------------------
|
|
|
12a457 |
xlators/cluster/afr/src/afr-self-heal.h | 3 ---
|
|
|
12a457 |
xlators/cluster/afr/src/afr-self-heald.c | 7 +------
|
|
|
12a457 |
xlators/cluster/ec/src/ec-heald.c | 12 +-----------
|
|
|
12a457 |
5 files changed, 6 insertions(+), 43 deletions(-)
|
|
|
12a457 |
|
|
|
12a457 |
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
|
|
|
12a457 |
index dcbab23..b799bff 100644
|
|
|
12a457 |
--- a/xlators/cluster/afr/src/afr-common.c
|
|
|
12a457 |
+++ b/xlators/cluster/afr/src/afr-common.c
|
|
|
12a457 |
@@ -1953,12 +1953,11 @@ afr_lookup_sh_metadata_wrap (void *opaque)
|
|
|
12a457 |
if (first == -1)
|
|
|
12a457 |
goto out;
|
|
|
12a457 |
|
|
|
12a457 |
- inode = afr_inode_link (local->inode,&replies[first].poststat);
|
|
|
12a457 |
+ inode = inode_link (local->inode, NULL, NULL, &replies[first].poststat);
|
|
|
12a457 |
if(!inode)
|
|
|
12a457 |
goto out;
|
|
|
12a457 |
|
|
|
12a457 |
afr_selfheal_metadata (frame, this, inode);
|
|
|
12a457 |
- inode_forget (inode, 1);
|
|
|
12a457 |
inode_unref (inode);
|
|
|
12a457 |
|
|
|
12a457 |
afr_local_replies_wipe (local, this->private);
|
|
|
12a457 |
@@ -4839,10 +4838,8 @@ out:
|
|
|
12a457 |
AFR_STACK_UNWIND (getxattr, frame, ret, op_errno, dict, NULL);
|
|
|
12a457 |
if (dict)
|
|
|
12a457 |
dict_unref (dict);
|
|
|
12a457 |
- if (inode) {
|
|
|
12a457 |
- inode_forget (inode, 1);
|
|
|
12a457 |
+ if (inode)
|
|
|
12a457 |
inode_unref (inode);
|
|
|
12a457 |
- }
|
|
|
12a457 |
GF_FREE (substr);
|
|
|
12a457 |
return ret;
|
|
|
12a457 |
}
|
|
|
12a457 |
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
|
|
|
12a457 |
index 130388d..2dc3448 100644
|
|
|
12a457 |
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
|
|
|
12a457 |
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
|
|
|
12a457 |
@@ -1275,20 +1275,6 @@ afr_is_entry_set (xlator_t *this, dict_t *xdata)
|
|
|
12a457 |
return afr_is_pending_set (this, xdata, AFR_ENTRY_TRANSACTION);
|
|
|
12a457 |
}
|
|
|
12a457 |
|
|
|
12a457 |
-
|
|
|
12a457 |
-inode_t*
|
|
|
12a457 |
-afr_inode_link (inode_t *inode, struct iatt *iatt)
|
|
|
12a457 |
-{
|
|
|
12a457 |
- inode_t *linked_inode = NULL;
|
|
|
12a457 |
-
|
|
|
12a457 |
- linked_inode = inode_link (inode, NULL, NULL, iatt);
|
|
|
12a457 |
-
|
|
|
12a457 |
- if (linked_inode)
|
|
|
12a457 |
- inode_lookup (linked_inode);
|
|
|
12a457 |
- return linked_inode;
|
|
|
12a457 |
-}
|
|
|
12a457 |
-
|
|
|
12a457 |
-
|
|
|
12a457 |
/*
|
|
|
12a457 |
* This function inspects the looked up replies (in an unlocked manner)
|
|
|
12a457 |
* and decides whether a locked verification and possible healing is
|
|
|
12a457 |
@@ -1415,7 +1401,7 @@ afr_selfheal_unlocked_inspect (call_frame_t *frame, xlator_t *this,
|
|
|
12a457 |
}
|
|
|
12a457 |
|
|
|
12a457 |
if (valid_cnt > 0 && link_inode) {
|
|
|
12a457 |
- *link_inode = afr_inode_link (inode, &first);
|
|
|
12a457 |
+ *link_inode = inode_link (inode, NULL, NULL, &first);
|
|
|
12a457 |
if (!*link_inode) {
|
|
|
12a457 |
ret = -EINVAL;
|
|
|
12a457 |
goto out;
|
|
|
12a457 |
@@ -1576,10 +1562,8 @@ afr_selfheal_do (call_frame_t *frame, xlator_t *this, uuid_t gfid)
|
|
|
12a457 |
ret = 0;
|
|
|
12a457 |
|
|
|
12a457 |
out:
|
|
|
12a457 |
- if (inode) {
|
|
|
12a457 |
- inode_forget (inode, 1);
|
|
|
12a457 |
+ if (inode)
|
|
|
12a457 |
inode_unref (inode);
|
|
|
12a457 |
- }
|
|
|
12a457 |
return ret;
|
|
|
12a457 |
}
|
|
|
12a457 |
/*
|
|
|
12a457 |
diff --git a/xlators/cluster/afr/src/afr-self-heal.h b/xlators/cluster/afr/src/afr-self-heal.h
|
|
|
12a457 |
index e0a3341..afc086c 100644
|
|
|
12a457 |
--- a/xlators/cluster/afr/src/afr-self-heal.h
|
|
|
12a457 |
+++ b/xlators/cluster/afr/src/afr-self-heal.h
|
|
|
12a457 |
@@ -199,9 +199,6 @@ afr_selfheal_newentry_mark (call_frame_t *frame, xlator_t *this, inode_t *inode,
|
|
|
12a457 |
int source, struct afr_reply *replies,
|
|
|
12a457 |
unsigned char *sources, unsigned char *newentry);
|
|
|
12a457 |
|
|
|
12a457 |
-inode_t*
|
|
|
12a457 |
-afr_inode_link (inode_t *inode, struct iatt *iatt);
|
|
|
12a457 |
-
|
|
|
12a457 |
unsigned int
|
|
|
12a457 |
afr_success_count (struct afr_reply *replies, unsigned int count);
|
|
|
12a457 |
|
|
|
12a457 |
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
|
|
|
12a457 |
index 1da3cb9..21b13b7 100644
|
|
|
12a457 |
--- a/xlators/cluster/afr/src/afr-self-heald.c
|
|
|
12a457 |
+++ b/xlators/cluster/afr/src/afr-self-heald.c
|
|
|
12a457 |
@@ -164,10 +164,8 @@ afr_shd_inode_find (xlator_t *this, xlator_t *subvol, uuid_t gfid)
|
|
|
12a457 |
struct iatt iatt = {0, };
|
|
|
12a457 |
|
|
|
12a457 |
inode = inode_find (this->itable, gfid);
|
|
|
12a457 |
- if (inode) {
|
|
|
12a457 |
- inode_lookup (inode);
|
|
|
12a457 |
+ if (inode)
|
|
|
12a457 |
goto out;
|
|
|
12a457 |
- }
|
|
|
12a457 |
|
|
|
12a457 |
loc.inode = inode_new (this->itable);
|
|
|
12a457 |
if (!loc.inode)
|
|
|
12a457 |
@@ -179,8 +177,6 @@ afr_shd_inode_find (xlator_t *this, xlator_t *subvol, uuid_t gfid)
|
|
|
12a457 |
goto out;
|
|
|
12a457 |
|
|
|
12a457 |
inode = inode_link (loc.inode, NULL, NULL, &iatt);
|
|
|
12a457 |
- if (inode)
|
|
|
12a457 |
- inode_lookup (inode);
|
|
|
12a457 |
out:
|
|
|
12a457 |
loc_wipe (&loc;;
|
|
|
12a457 |
return inode;
|
|
|
12a457 |
@@ -449,7 +445,6 @@ afr_shd_index_sweep (struct subvol_healer *healer, char *vgfid)
|
|
|
12a457 |
ret = syncop_dir_scan (subvol, &loc, GF_CLIENT_PID_SELF_HEALD,
|
|
|
12a457 |
healer, afr_shd_index_heal);
|
|
|
12a457 |
|
|
|
12a457 |
- inode_forget (loc.inode, 1);
|
|
|
12a457 |
loc_wipe (&loc;;
|
|
|
12a457 |
|
|
|
12a457 |
if (ret == 0)
|
|
|
12a457 |
diff --git a/xlators/cluster/ec/src/ec-heald.c b/xlators/cluster/ec/src/ec-heald.c
|
|
|
12a457 |
index 2e5098a..0e80768 100644
|
|
|
12a457 |
--- a/xlators/cluster/ec/src/ec-heald.c
|
|
|
12a457 |
+++ b/xlators/cluster/ec/src/ec-heald.c
|
|
|
12a457 |
@@ -137,10 +137,8 @@ ec_shd_inode_find (xlator_t *this, xlator_t *subvol,
|
|
|
12a457 |
*inode = NULL;
|
|
|
12a457 |
|
|
|
12a457 |
*inode = inode_find (this->itable, gfid);
|
|
|
12a457 |
- if (*inode) {
|
|
|
12a457 |
- inode_lookup (*inode);
|
|
|
12a457 |
+ if (*inode)
|
|
|
12a457 |
goto out;
|
|
|
12a457 |
- }
|
|
|
12a457 |
|
|
|
12a457 |
loc.inode = inode_new (this->itable);
|
|
|
12a457 |
if (!loc.inode) {
|
|
|
12a457 |
@@ -157,8 +155,6 @@ ec_shd_inode_find (xlator_t *this, xlator_t *subvol,
|
|
|
12a457 |
if (!*inode) {
|
|
|
12a457 |
ret = -ENOMEM;
|
|
|
12a457 |
goto out;
|
|
|
12a457 |
- } else {
|
|
|
12a457 |
- inode_lookup (*inode);
|
|
|
12a457 |
}
|
|
|
12a457 |
out:
|
|
|
12a457 |
loc_wipe (&loc;;
|
|
|
12a457 |
@@ -267,8 +263,6 @@ out:
|
|
|
12a457 |
uuid_utoa(loc.gfid));
|
|
|
12a457 |
ec_shd_index_purge (subvol, parent->inode, entry->d_name);
|
|
|
12a457 |
}
|
|
|
12a457 |
- if (loc.inode)
|
|
|
12a457 |
- inode_forget (loc.inode, 0);
|
|
|
12a457 |
loc_wipe (&loc;;
|
|
|
12a457 |
|
|
|
12a457 |
return 0;
|
|
|
12a457 |
@@ -296,8 +290,6 @@ ec_shd_index_sweep (struct subvol_healer *healer)
|
|
|
12a457 |
ret = syncop_dir_scan (subvol, &loc, GF_CLIENT_PID_SELF_HEALD,
|
|
|
12a457 |
healer, ec_shd_index_heal);
|
|
|
12a457 |
out:
|
|
|
12a457 |
- if (loc.inode)
|
|
|
12a457 |
- inode_forget (loc.inode, 0);
|
|
|
12a457 |
loc_wipe (&loc;;
|
|
|
12a457 |
|
|
|
12a457 |
return ret;
|
|
|
12a457 |
@@ -336,8 +328,6 @@ ec_shd_full_heal (xlator_t *subvol, gf_dirent_t *entry, loc_t *parent,
|
|
|
12a457 |
ret = 0;
|
|
|
12a457 |
|
|
|
12a457 |
out:
|
|
|
12a457 |
- if (loc.inode)
|
|
|
12a457 |
- inode_forget (loc.inode, 0);
|
|
|
12a457 |
loc_wipe (&loc;;
|
|
|
12a457 |
return ret;
|
|
|
12a457 |
}
|
|
|
12a457 |
--
|
|
|
12a457 |
1.7.1
|
|
|
12a457 |
|