Close a race in biodone(), whereby the bio_done field of the passed
bio may have been freed and reassigned by the wakeup before being tested after releasing the bdonelock. There's a non-zero chance this is the cause of a few of the crashes knocking around with biodone() sitting in the stack backtrace. Reviewed By: phk@
This commit is contained in:
parent
2c9137ee39
commit
05494531ef
@ -2882,14 +2882,16 @@ allocbuf(struct buf *bp, int size)
|
||||
void
|
||||
biodone(struct bio *bp)
|
||||
{
|
||||
void (*done)(struct bio *);
|
||||
|
||||
mtx_lock(&bdonelock);
|
||||
bp->bio_flags |= BIO_DONE;
|
||||
if (bp->bio_done == NULL)
|
||||
done = bp->bio_done;
|
||||
if (done == NULL)
|
||||
wakeup(bp);
|
||||
mtx_unlock(&bdonelock);
|
||||
if (bp->bio_done != NULL)
|
||||
bp->bio_done(bp);
|
||||
if (done != NULL)
|
||||
done(bp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user