Re: Intel SATA ICH5/5R 6300ESB support patches

From: Poul-Henning Kamp <phk_at_phk.freebsd.dk>
Date: Sun, 04 Apr 2004 22:17:22 +0200
In message <200404042002.i34K2nop038808_at_ambrisko.com>, Doug Ambrisko writes:
>Søren Schmidt writes:

>| > I put in a patch for geom for bio_taskqueue_remove.  Since ata code
>| > schedules bio_task it need to be cancelled when we abort and call
>| > biodone.  If we don't cancel this task then when the task is 
>| > run later we get a double free in UMA since we have cleaned up
>| > twice and called biodone twice for the same request.

Sos_at_ forwarded that patch and it won't fly, it has no chance of
working reliably on multi-cpu machines:

There is no guarantee that the task is still on the queue by the
time you try to remove it, and if is not, it is likely to be because
another CPU is already waiting for a lock in the ata driver in the
bio_taskqueue handler function, so we have no way to cancel that
other CPU's activity.

The correct solution is to not do the biodone when you cancel, but
let the already scheduled bio_taskqueue event to do so.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk_at_FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.
Received on Sun Apr 04 2004 - 11:17:46 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:49 UTC