diff options
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r-- | drivers/scsi/scsi_lib.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ab55c2fa7ce2..0bac91e72370 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -400,10 +400,15 @@ static inline int scsi_host_is_busy(struct Scsi_Host *shost) | |||
400 | static void scsi_run_queue(struct request_queue *q) | 400 | static void scsi_run_queue(struct request_queue *q) |
401 | { | 401 | { |
402 | struct scsi_device *sdev = q->queuedata; | 402 | struct scsi_device *sdev = q->queuedata; |
403 | struct Scsi_Host *shost = sdev->host; | 403 | struct Scsi_Host *shost; |
404 | LIST_HEAD(starved_list); | 404 | LIST_HEAD(starved_list); |
405 | unsigned long flags; | 405 | unsigned long flags; |
406 | 406 | ||
407 | /* if the device is dead, sdev will be NULL, so no queue to run */ | ||
408 | if (!sdev) | ||
409 | return; | ||
410 | |||
411 | shost = sdev->host; | ||
407 | if (scsi_target(sdev)->single_lun) | 412 | if (scsi_target(sdev)->single_lun) |
408 | scsi_single_lun_run(sdev); | 413 | scsi_single_lun_run(sdev); |
409 | 414 | ||
@@ -411,8 +416,6 @@ static void scsi_run_queue(struct request_queue *q) | |||
411 | list_splice_init(&shost->starved_list, &starved_list); | 416 | list_splice_init(&shost->starved_list, &starved_list); |
412 | 417 | ||
413 | while (!list_empty(&starved_list)) { | 418 | while (!list_empty(&starved_list)) { |
414 | int flagset; | ||
415 | |||
416 | /* | 419 | /* |
417 | * As long as shost is accepting commands and we have | 420 | * As long as shost is accepting commands and we have |
418 | * starved queues, call blk_run_queue. scsi_request_fn | 421 | * starved queues, call blk_run_queue. scsi_request_fn |
@@ -435,20 +438,7 @@ static void scsi_run_queue(struct request_queue *q) | |||
435 | continue; | 438 | continue; |
436 | } | 439 | } |
437 | 440 | ||
438 | spin_unlock(shost->host_lock); | 441 | blk_run_queue_async(sdev->request_queue); |
439 | |||
440 | spin_lock(sdev->request_queue->queue_lock); | ||
441 | flagset = test_bit(QUEUE_FLAG_REENTER, &q->queue_flags) && | ||
442 | !test_bit(QUEUE_FLAG_REENTER, | ||
443 | &sdev->request_queue->queue_flags); | ||
444 | if (flagset) | ||
445 | queue_flag_set(QUEUE_FLAG_REENTER, sdev->request_queue); | ||
446 | __blk_run_queue(sdev->request_queue); | ||
447 | if (flagset) | ||
448 | queue_flag_clear(QUEUE_FLAG_REENTER, sdev->request_queue); | ||
449 | spin_unlock(sdev->request_queue->queue_lock); | ||
450 | |||
451 | spin_lock(shost->host_lock); | ||
452 | } | 442 | } |
453 | /* put any unprocessed entries back */ | 443 | /* put any unprocessed entries back */ |
454 | list_splice(&starved_list, &shost->starved_list); | 444 | list_splice(&starved_list, &shost->starved_list); |