diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-07-14 00:46:10 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-07-14 00:46:10 +0000 |
commit | 8f9b7e28eaf74e5fdc72328f0dfb890d92c02ec1 (patch) | |
tree | cefa17156197096e9973efa6973d924fae737c6d /svc_dev.c | |
parent | b773c55485a7a50904493a0cdc8dd22da9bbfdee (diff) | |
download | cmogstored-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.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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) { |