about summary refs log tree commit homepage
path: root/svc_dev.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-07-14 00:46:10 +0000
committerEric Wong <normalperson@yhbt.net>2013-07-14 00:46:10 +0000
commit8f9b7e28eaf74e5fdc72328f0dfb890d92c02ec1 (patch)
treecefa17156197096e9973efa6973d924fae737c6d /svc_dev.c
parentb773c55485a7a50904493a0cdc8dd22da9bbfdee (diff)
downloadcmogstored-8f9b7e28eaf74e5fdc72328f0dfb890d92c02ec1.tar.gz
This should avoid concurrency bugs where client may run in
multiple threads if we switch to multi-threaded graceful shutdown.
Diffstat (limited to 'svc_dev.c')
-rw-r--r--svc_dev.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/svc_dev.c b/svc_dev.c
index 93e3c43..e57f0b6 100644
--- a/svc_dev.c
+++ b/svc_dev.c
@@ -318,6 +318,14 @@ static void mog_svc_dev_rescale_all(struct mog_svc *svc)
         CHECK(int, 0, pthread_mutex_unlock(&svc->by_mog_devid_lock));
 }
 
+void mog_svc_dev_requeue_prepare(struct mog_svc *svc)
+{
+        /* iterate through each device of this svc */
+        CHECK(int, 0, pthread_mutex_lock(&svc->by_mog_devid_lock));
+        hash_do_for_each(svc->by_mog_devid, mog_dev_requeue_prepare, svc);
+        CHECK(int, 0, pthread_mutex_unlock(&svc->by_mog_devid_lock));
+}
+
 /* rescaling only happens in the main thread */
 void mog_svc_dev_user_rescale(struct mog_svc *svc, size_t ndev_new)
 {