No need to retry in cancel_delayed_work_sync after all.

This commit is contained in:
riastradh 2018-08-27 15:02:19 +00:00
parent 535de6e400
commit 551d54d11f
1 changed files with 9 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_work.c,v 1.23 2018/08/27 15:02:08 riastradh Exp $ */
/* $NetBSD: linux_work.c,v 1.24 2018/08/27 15:02:19 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.23 2018/08/27 15:02:08 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.24 2018/08/27 15:02:19 riastradh Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@ -656,15 +656,11 @@ bool
cancel_delayed_work_sync(struct delayed_work *dw)
{
struct workqueue_struct *wq;
bool cancelled_p = false;
bool cancelled_p;
retry:
/*
* If there's no workqueue, nothing to cancel, unless we've
* started over from cancelling the callout.
*/
/* If there's no workqueue, nothing to cancel. */
if ((wq = dw->work.work_queue) == NULL)
return cancelled_p;
return false;
mutex_enter(&wq->wq_lock);
if (__predict_false(dw->work.work_queue != wq)) {
@ -694,9 +690,9 @@ retry:
*
* If it's too late and the callout has already
* begun to execute, we must wait for it to
* complete. In that case, the work has been
* dissociated from the queue, so we must start
* over from the top.
* complete. But we got in soon enough to ask
* the callout not to run, so we successfully
* cancelled it in that case.
*
* If we stopped the callout before it started,
* however, then destroy the callout and
@ -705,7 +701,7 @@ retry:
dw->dw_state = DELAYED_WORK_CANCELLED;
cancelled_p = true;
if (callout_halt(&dw->dw_callout, &wq->wq_lock))
goto retry;
break;
cancel_delayed_work_done(wq, dw);
break;
default: