diff options
author | Jeff Darcy <jdarcy@redhat.com> | 2012-10-03 17:15:08 -0400 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-10-11 18:08:49 -0700 |
commit | 10c1a9c26e97ad363da84675ac22c4fb6420d28f (patch) | |
tree | d76eb4f4dea90878f2f1aabe14caeecb1f79ebb7 /xlators | |
parent | 72dafec18a79c0b66a18460725e0ade527939408 (diff) |
replicate: don't use synctask_new from within a synctask
Change-Id: Iebf821ff720c63ab6da4b219d82c7f1d00769992
BUG: 862838
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4032
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heald.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c index 6ee3da79360..b3dee3f592c 100644 --- a/xlators/cluster/afr/src/afr-self-heald.c +++ b/xlators/cluster/afr/src/afr-self-heald.c @@ -57,6 +57,11 @@ afr_start_crawl (xlator_t *this, int idx, afr_crawl_type_t crawl, static int _crawl_directory (fd_t *fd, loc_t *loc, afr_crawl_data_t *crawl_data); +/* For calling straight through (e.g. already in a synctask). */ +int +afr_find_child_position (xlator_t *this, int child, afr_child_pos_t *pos); + +/* For deferring through a new synctask. */ int afr_syncop_find_child_position (void *data); @@ -456,9 +461,15 @@ _do_crawl_op_on_local_subvols (xlator_t *this, afr_crawl_type_t crawl, for (i = 0; i < priv->child_count; i++) { if (_crawl_proceed (this, i, crawl_flags, &status)) { pos_data.child = i; - ret = synctask_new (this->ctx->env, - afr_syncop_find_child_position, - NULL, NULL, &pos_data); + /* + * We're already in a synctask in this case, so we + * don't need to defer through a second (and in fact + * that can cause deadlock). Just call straight + * through instead. + */ + ret = afr_find_child_position(pos_data.this, + pos_data.child, + &pos_data.pos); if (ret) { status = "Not able to find brick location"; } else if (pos_data.pos == AFR_POS_REMOTE) { |