On Thu, Aug 27 2009, Jens Axboe wrote: > @@ -194,12 +194,21 @@ static bool slow_work_execute(void) > if (!test_and_clear_bit(SLOW_WORK_PENDING, &work->flags)) > BUG(); > > - work->ops->execute(work); > + /* > + * Don't execute if the work was cancelled after being added > + */ > + if (!test_bit(SLOW_WORK_CANCEL, &work->flags)) > + work->ops->execute(work); > > if (very_slow) > atomic_dec(&vslow_work_executing_count); > clear_bit_unlock(SLOW_WORK_EXECUTING, &work->flags); > > + /* > + * Wake anyone waiting for this work to be done > + */ > + wake_up_bit(&work->flags, SLOW_WORK_EXECUTING); > + > /* if someone tried to enqueue the item whilst we were executing it, > * then it'll be left unenqueued to avoid multiple threads trying to > * execute it simultaneously > +void cancel_slow_work(struct slow_work *work) > +{ > + set_bit(SLOW_WORK_CANCEL, &work->flags); > + wait_on_bit(&work->flags, SLOW_WORK_EXECUTING, slow_work_wait, > + TASK_UNINTERRUPTIBLE); > + clear_bit(SLOW_WORK_CANCEL, &work->flags); > +} > +EXPORT_SYMBOL(cancel_slow_work); We want to use SLOW_WORK_PENDING for this logic, not SLOW_WORK_EXECUTING. I'll update it. -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html