diff options
author | Dan Lambright <dlambrig@redhat.com> | 2015-12-16 15:28:57 -0500 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2015-12-21 05:23:20 -0800 |
commit | 3a094f1de03b3da8cdff650c14e46aab87e1905b (patch) | |
tree | 8786ebd5baf1cf146d6b2e6efed77c58a9d53f0c /xlators/cluster/dht/src/dht-common.h | |
parent | d2f48214d436be633efb1136ee951b0736935143 (diff) |
cluster/tier: do not block in synctask created from pause tier
We had run sleep() in the pause tier callback. Blocking within
a synctask is dangerous. The sleep() call does not inform
the synctask scheduler that a thread is no longer running.
It therefore believes it is running. If a second synctask already
exists, it may not be able to run. This occurs if the thread
limit in the pool has been reached.
Note the pool size only grows when a synctask is created, not
when it is moved from wait state to run state, as is the case
when an FOP completes. When the tier is paused during migration,
synctasks already exist waiting for responses to FOPs to the
server with high probability.
The fix is to yield() in the RPC callback, which will place
the synctask into the wait queue and free up a thread for the
FOP callback. A timer wakes the callback after sufficient
time has elapsed for the pause to occur.
Change-Id: I6a947ee04c6e5649946cb6d8207ba17263a67fc6
BUG: 1267950
Signed-off-by: Dan Lambright <dlambrig@redhat.com>
Reviewed-on: http://review.gluster.org/12987
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-common.h')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index a6e9a408a44..70e5e15c0d8 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -16,6 +16,7 @@ #include "libxlator.h" #include "syncop.h" #include "refcount.h" +#include "timer.h" #ifndef _DHT_H #define _DHT_H @@ -356,6 +357,9 @@ typedef struct gf_tier_conf { uint64_t st_last_demoted_size; int request_pause; gf_boolean_t paused; + struct synctask *pause_synctask; + gf_timer_t *pause_timer; + pthread_mutex_t pause_mutex; } gf_tier_conf_t; struct gf_defrag_info_ { @@ -987,6 +991,9 @@ gf_defrag_status_get (gf_defrag_info_t *defrag, dict_t *dict); int gf_defrag_pause_tier (xlator_t *this, gf_defrag_info_t *defrag); +void +gf_defrag_wake_pause_tier (gf_tier_conf_t *defrag, gf_boolean_t pause); + int gf_defrag_resume_tier (xlator_t *this, gf_defrag_info_t *defrag); |