Date: Mon, 15 Nov 2010 21:19:50 +0000 (UTC) From: Weongyo Jeong <weongyo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r215346 - user/weongyo/usb/sys/dev/usb Message-ID: <201011152119.oAFLJopB028896@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: weongyo Date: Mon Nov 15 21:19:50 2010 New Revision: 215346 URL: http://svn.freebsd.org/changeset/base/215346 Log: Stopping / draining the callout should happen first to make sure that the task wouldn't be enqueued during stopping the taskqueue. Pointed by: hps Modified: user/weongyo/usb/sys/dev/usb/usb_sleepout.c Modified: user/weongyo/usb/sys/dev/usb/usb_sleepout.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_sleepout.c Mon Nov 15 19:55:19 2010 (r215345) +++ user/weongyo/usb/sys/dev/usb/usb_sleepout.c Mon Nov 15 21:19:50 2010 (r215346) @@ -109,20 +109,31 @@ int sleepout_stop(struct sleepout_task *st) { struct sleepout *s = st->st_sleepout; + int ret; + + ret = callout_stop(&st->st_callout); /* * XXX the return value is ignored but one thing clear is that the task * isn't on the task queue list after this moment. */ (void)taskqueue_cancel(s->s_taskqueue, &st->st_task, NULL); - return (callout_stop(&st->st_callout)); + + return (ret); } int sleepout_drain(struct sleepout_task *st) { struct sleepout *s = st->st_sleepout; + int ret; + /* + * Always the sequence to stop / drain a sleepout is that callout(9) + * should be handled first to make sure that it's not enqueued at + * the task list. + */ + ret = callout_drain(&st->st_callout); taskqueue_drain(s->s_taskqueue, &st->st_task); - return (callout_drain(&st->st_callout)); + return (ret); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011152119.oAFLJopB028896>