summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-10-30 05:58:01 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-30 04:30:59 -0700
commite4548d105538182ee3e2be72d9ceb11df18610fd (patch)
tree7ca02c6a38005a3f6b056e9fd6b6fb9eab34ebe1 /xlators/cluster/afr/src
parentf01aa2aa7487cdb3198fb7749d2fbf25d41ad1e6 (diff)
cluster/afr: Don't try to self-heal if there are locks held
If the inodelk_count or entrylk_count is positive on a file/directory, don't try to do self-heal on it. Signed-off-by: Vikas Gorur <vikas@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 326 ([2.0.8rc9] Spurious self-heal) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=326
Diffstat (limited to 'xlators/cluster/afr/src')
-rw-r--r--xlators/cluster/afr/src/afr.c16
-rw-r--r--xlators/cluster/afr/src/afr.h3
2 files changed, 18 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index 3e1808721..fa90e2880 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -420,6 +420,9 @@ afr_lookup_cbk (call_frame_t *frame, void *cookie,
int first_up_child = -1;
uint32_t open_fd_count = 0;
+ uint32_t inodelk_count = 0;
+ uint32_t entrylk_count = 0;
+
int ret = 0;
child_index = (long) cookie;
@@ -463,6 +466,13 @@ afr_lookup_cbk (call_frame_t *frame, void *cookie,
&open_fd_count);
local->open_fd_count += open_fd_count;
+ ret = dict_get_uint32 (xattr, GLUSTERFS_INODELK_COUNT,
+ &inodelk_count);
+ local->inodelk_count += inodelk_count;
+
+ ret = dict_get_uint32 (xattr, GLUSTERFS_ENTRYLK_COUNT,
+ &entrylk_count);
+ local->entrylk_count += entrylk_count;
first_up_child = afr_first_up_child (priv);
@@ -593,7 +603,9 @@ unlock:
if ((local->need_metadata_self_heal
|| local->need_data_self_heal
|| local->need_entry_self_heal)
- && (!local->open_fd_count)) {
+ && (!local->open_fd_count &&
+ !local->inodelk_count &&
+ !local->entrylk_count)) {
if (!local->cont.lookup.inode->st_mode) {
/* fix for RT #602 */
@@ -674,6 +686,8 @@ afr_lookup (call_frame_t *frame, xlator_t *this,
}
ret = dict_set_uint64 (local->xattr_req, GLUSTERFS_OPEN_FD_COUNT, 0);
+ ret = dict_set_uint64 (local->xattr_req, GLUSTERFS_INODELK_COUNT, 0);
+ ret = dict_set_uint64 (local->xattr_req, GLUSTERFS_ENTRYLK_COUNT, 0);
for (i = 0; i < priv->child_count; i++) {
STACK_WIND_COOKIE (frame, afr_lookup_cbk, (void *) (long) i,
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index fff53e569..dfdaf28c7 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -170,6 +170,9 @@ typedef struct _afr_local {
dict_t *xattr_req;
int open_fd_count;
+ int32_t inodelk_count;
+ int32_t entrylk_count;
+
/*
This struct contains the arguments for the "continuation"
(scheme-like) of fops