Commit cae3816d authored by Mike Snitzer's avatar Mike Snitzer

dm vdo: tweak wait_for_completion_interruptible callers

Update uds_join_threads to delay in wait_for_completion_interruptible
loop. And cleanup style nits in perform_admin_operation().
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
Signed-off-by: default avatarSusan LeGendre-McGhee <slegendr@redhat.com>
Signed-off-by: default avatarMatthew Sakai <msakai@redhat.com>
parent 5581a43d
...@@ -1235,9 +1235,10 @@ static int perform_admin_operation(struct vdo *vdo, u32 starting_phase, ...@@ -1235,9 +1235,10 @@ static int perform_admin_operation(struct vdo *vdo, u32 starting_phase,
* Using the "interruptible" interface means that Linux will not log a message when we wait * Using the "interruptible" interface means that Linux will not log a message when we wait
* for more than 120 seconds. * for more than 120 seconds.
*/ */
while (wait_for_completion_interruptible(&admin->callback_sync) != 0) while (wait_for_completion_interruptible(&admin->callback_sync)) {
/* * However, if we get a signal in a user-mode process, we could spin... */ /* However, if we get a signal in a user-mode process, we could spin... */
fsleep(1000); fsleep(1000);
}
result = admin->completion.result; result = admin->completion.result;
/* pairs with implicit barrier in cmpxchg above */ /* pairs with implicit barrier in cmpxchg above */
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "uds-threads.h" #include "uds-threads.h"
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/delay.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -125,9 +126,8 @@ int uds_create_thread(void (*thread_function)(void *), void *thread_data, ...@@ -125,9 +126,8 @@ int uds_create_thread(void (*thread_function)(void *), void *thread_data,
int uds_join_threads(struct thread *thread) int uds_join_threads(struct thread *thread)
{ {
while (wait_for_completion_interruptible(&thread->thread_done) != 0) while (wait_for_completion_interruptible(&thread->thread_done))
/* empty loop */ fsleep(1000);
;
mutex_lock(&thread_mutex); mutex_lock(&thread_mutex);
hlist_del(&thread->thread_links); hlist_del(&thread->thread_links);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment