Skip to content

Commit

Permalink
dm vdo: tweak wait_for_completion_interruptible callers
Browse files Browse the repository at this point in the history
Update uds_join_threads to delay in wait_for_completion_interruptible
loop. And cleanup style nits in perform_admin_operation().

Signed-off-by: Mike Snitzer <[email protected]>
Signed-off-by: Susan LeGendre-McGhee <[email protected]>
Signed-off-by: Matthew Sakai <[email protected]>
  • Loading branch information
Mike Snitzer authored and lorelei-sakai committed Feb 14, 2024
1 parent cd10f0a commit 004c0b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions drivers/md/dm-vdo/dm-vdo-target.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* for more than 120 seconds.
*/
while (wait_for_completion_interruptible(&admin->callback_sync) != 0)
/* * However, if we get a signal in a user-mode process, we could spin... */
while (wait_for_completion_interruptible(&admin->callback_sync)) {
/* However, if we get a signal in a user-mode process, we could spin... */
fsleep(1000);
}

result = admin->completion.result;
/* pairs with implicit barrier in cmpxchg above */
Expand Down
6 changes: 3 additions & 3 deletions drivers/md/dm-vdo/uds-threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "uds-threads.h"

#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/kthread.h>
#include <linux/sched.h>
Expand Down Expand Up @@ -125,9 +126,8 @@ int uds_create_thread(void (*thread_function)(void *), void *thread_data,

int uds_join_threads(struct thread *thread)
{
while (wait_for_completion_interruptible(&thread->thread_done) != 0)
/* empty loop */
;
while (wait_for_completion_interruptible(&thread->thread_done))
fsleep(1000);

mutex_lock(&thread_mutex);
hlist_del(&thread->thread_links);
Expand Down

0 comments on commit 004c0b1

Please sign in to comment.