mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-26 20:12:44 +00:00
FreeBSD: Sync taskq_cancel_id() returns with Linux
Couple places in the code depend on 0 returned only if the task was actually cancelled. Doing otherwise could lead to extra references being dropped. The race could be small, but I believe CI hit it from time to time. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #16565
This commit is contained in:
parent
ccc420acd5
commit
832f66b218
@ -357,7 +357,7 @@ taskq_cancel_id(taskq_t *tq, taskqid_t tid)
|
||||
taskq_ent_t *ent;
|
||||
|
||||
if ((ent = taskq_lookup(tid)) == NULL)
|
||||
return (0);
|
||||
return (ENOENT);
|
||||
|
||||
if (ent->tqent_type == NORMAL_TASK) {
|
||||
rc = taskqueue_cancel(tq->tq_queue, &ent->tqent_task, &pend);
|
||||
@ -380,7 +380,7 @@ taskq_cancel_id(taskq_t *tq, taskqid_t tid)
|
||||
}
|
||||
/* Free the extra reference we added with taskq_lookup. */
|
||||
taskq_free(ent);
|
||||
return (rc);
|
||||
return (pend ? 0 : ENOENT);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user