summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-05-08 11:54:00 +0900
committerJens Axboe <jens.axboe@oracle.com>2009-05-11 09:52:14 +0200
commit9a8d23d8855e554fc5887f14cb008b55c4300ccc (patch)
treea754cec4066df52f94161784262edff0de0fb312 /drivers/block
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/block')
-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 826c3492b9fe..be323880f24a 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)
while ((req = elv_next_request(q)) != NULL) {
host = req->rq_disk->private_data;
- if (blk_fs_request(req)) {
- switch (rq_data_dir(req)) {
- case READ:
- mg_read(req);
- break;
- case WRITE:
- mg_write(req);
- break;
- }
+
+ if (unlikely(!blk_fs_request(req))) {
+ __blk_end_request_cur(req, -EIO);
+ continue;
}
+
+ if (rq_data_dir(req) == READ)
+ mg_read(req);
+ else
+ mg_write(req);
}
}
@@ -766,8 +766,10 @@ static void mg_request(struct request_queue *q)
continue;
}
- if (!blk_fs_request(req))
- return;
+ if (unlikely(!blk_fs_request(req))) {
+ __blk_end_request_cur(req, -EIO);
+ continue;
+ }
if (!mg_issue_req(req, host, sect_num, sect_cnt))
return;