Skip to content

Commit

Permalink
FreeBSD: Sync taskq_cancel_id() returns with Linux
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by:	Alexander Motin <[email protected]>
Sponsored by:	iXsystems, Inc.
Closes #16565
  • Loading branch information
amotin authored Sep 24, 2024
1 parent ccc420a commit 832f66b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions module/os/freebsd/spl/spl_taskq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit 832f66b

Please sign in to comment.