Close a race in ata_reinit().

This commit is contained in:
Søren Schmidt 2004-08-09 12:02:32 +00:00
parent 088cf0fb43
commit 74f492f9bf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=133377
2 changed files with 7 additions and 3 deletions

View File

@ -190,6 +190,11 @@ ata_detach(device_t dev)
/* fail outstanding requests on this channel */
ata_fail_requests(ch, NULL);
/* unlock the channel */
ch->running = NULL;
ATA_UNLOCK_CH(ch);
ch->locking(ch, ATA_LF_UNLOCK);
/* detach devices on this channel */
if (ch->device[MASTER].detach)
ch->device[MASTER].detach(&ch->device[MASTER]);
@ -265,8 +270,10 @@ ata_reinit(struct ata_channel *ch)
}
}
/* unlock the channel */
ch->running = NULL;
ATA_UNLOCK_CH(ch);
ch->locking(ch, ATA_LF_UNLOCK);
/* identify what is present on the channel now */
ata_identify_devices(ch);

View File

@ -483,9 +483,6 @@ ata_fail_requests(struct ata_channel *ch, struct ata_device *device)
/* if we have a request "in flight" fail it as well */
if ((request = ch->running) && (!device || request->device == device)) {
untimeout((timeout_t *)ata_timeout, request, request->timeout_handle);
ATA_UNLOCK_CH(request->device->channel);
request->device->channel->locking(request->device->channel,
ATA_LF_UNLOCK);
request->result = ENXIO;
if (request->callback)
(request->callback)(request);