Skip to content

Commit

Permalink
Merge pull request #35 from lorelei-sakai/ingest/wait-loop-tweaks
Browse files Browse the repository at this point in the history
[VDO-5682] Tweak wait_for_completion_interruptible callers
  • Loading branch information
lorelei-sakai authored Feb 14, 2024
2 parents cd10f0a + 004c0b1 commit e6fcec7
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 e6fcec7

Please sign in to comment.