Correct the return value from flush_work() and flush_delayed_work() in the

LinuxKPI to comply more with Linux. This fixes an issue when these functions
are used in waiting loops.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
This commit is contained in:
Hans Petter Selasky 2018-03-01 10:31:51 +00:00
parent 5903f5954a
commit b44247b1a9

View File

@ -454,6 +454,7 @@ bool
linux_flush_work(struct work_struct *work) linux_flush_work(struct work_struct *work)
{ {
struct taskqueue *tq; struct taskqueue *tq;
int retval;
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
"linux_flush_work() might sleep"); "linux_flush_work() might sleep");
@ -463,8 +464,9 @@ linux_flush_work(struct work_struct *work)
return (0); return (0);
default: default:
tq = work->work_queue->taskqueue; tq = work->work_queue->taskqueue;
retval = taskqueue_poll_is_busy(tq, &work->work_task);
taskqueue_drain(tq, &work->work_task); taskqueue_drain(tq, &work->work_task);
return (1); return (retval);
} }
} }
@ -477,6 +479,7 @@ bool
linux_flush_delayed_work(struct delayed_work *dwork) linux_flush_delayed_work(struct delayed_work *dwork)
{ {
struct taskqueue *tq; struct taskqueue *tq;
int retval;
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
"linux_flush_delayed_work() might sleep"); "linux_flush_delayed_work() might sleep");
@ -490,8 +493,9 @@ linux_flush_delayed_work(struct delayed_work *dwork)
/* FALLTHROUGH */ /* FALLTHROUGH */
default: default:
tq = dwork->work.work_queue->taskqueue; tq = dwork->work.work_queue->taskqueue;
retval = taskqueue_poll_is_busy(tq, &dwork->work.work_task);
taskqueue_drain(tq, &dwork->work.work_task); taskqueue_drain(tq, &dwork->work.work_task);
return (1); return (retval);
} }
} }