aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-05-07 22:54:00 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-05-11 03:52:14 -0400
commit9a8d23d8855e554fc5887f14cb008b55c4300ccc (patch)
treea754cec4066df52f94161784262edff0de0fb312 /drivers
parent8f6205cd572fece673da0255d74843680f67f879 (diff)
mg_disk: fix queue hang / infinite retry on !fs requests
Both request functions in mg_disk simply return when they encounter a !fs request, which means the request will never be cleared from the queue causing queue hang and indefinite retry of the request. Fix it. While at it, flatten condition checks and add unlikely to !fs tests. [ Impact: fix possible queue hang / infinite retry of !fs requests ] Signed-off-by: Tejun Heo <tj@kernel.org> Cc: unsik Kim <donari75@gmail.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/mg_disk.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index 826c3492b9f..be323880f24 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -672,16 +672,16 @@ static void mg_request_poll(struct request_queue *q)
672 672
673 while ((req = elv_next_request(q)) != NULL) { 673 while ((req = elv_next_request(q)) != NULL) {
674 host = req->rq_disk->private_data; 674 host = req->rq_disk->private_data;
675 if (blk_fs_request(req)) { 675
676 switch (rq_data_dir(req)) { 676 if (unlikely(!blk_fs_request(req))) {
677 case READ: 677 __blk_end_request_cur(req, -EIO);
678 mg_read(req); 678 continue;
679 break;
680 case WRITE:
681 mg_write(req);
682 break;
683 }
684 } 679 }
680
681 if (rq_data_dir(req) == READ)
682 mg_read(req);
683 else
684 mg_write(req);
685 } 685 }
686} 686}
687 687
@@ -766,8 +766,10 @@ static void mg_request(struct request_queue *q)
766 continue; 766 continue;
767 } 767 }
768 768
769 if (!blk_fs_request(req)) 769 if (unlikely(!blk_fs_request(req))) {
770 return; 770 __blk_end_request_cur(req, -EIO);
771 continue;
772 }
771 773
772 if (!mg_issue_req(req, host, sect_num, sect_cnt)) 774 if (!mg_issue_req(req, host, sect_num, sect_cnt))
773 return; 775 return;