Fix a deadlock in the request completion code when the timeout timed out.
authorThomas E. Spanjaard <tgen@dragonflybsd.org>
Sun, 10 Dec 2006 23:36:13 +0000 (23:36 +0000)
committerThomas E. Spanjaard <tgen@dragonflybsd.org>
Sun, 10 Dec 2006 23:36:13 +0000 (23:36 +0000)
commit4554c33808e787196f001327d3cc03708a80b91f
tree4e7863d0198ddfb5f38cbf96b3e4bf5653fd49eb
parentc0e66144648378f846d837b448cec83a7d3977b7
Fix a deadlock in the request completion code when the timeout timed out.
The cause was not unlocking the done spinlock before calling ata_completed,
resulting in ata_completed waiting forever because it needs to acquire the
lock as well.

The solution introduces a new request flag, ATA_R_COMPLETED to signal
sleepers that a request has or has not been completed. In theory, we could
just check the return value of msleep(), but this is quite elegant, and
corecode convinced me ;).

Reported-by: YONETANI Tomokazu <qhwt+dfly@les.ath.cx>
Reviewed-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de>
sys/dev/disk/nata/ata-all.h
sys/dev/disk/nata/ata-queue.c