Commit fb8ec18c authored by Jens Axboe's avatar Jens Axboe

block: fix oops in blk_queue_io_stat()

Some initial probe requests don't have disk->queue mapped yet, so we
can't rely on a non-NULL queue in blk_queue_io_stat(). Wrap it in
blk_do_io_stat().
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 45c82b5a
...@@ -69,7 +69,7 @@ static void drive_stat_acct(struct request *rq, int new_io) ...@@ -69,7 +69,7 @@ static void drive_stat_acct(struct request *rq, int new_io)
int rw = rq_data_dir(rq); int rw = rq_data_dir(rq);
int cpu; int cpu;
if (!blk_fs_request(rq) || !disk || !blk_queue_io_stat(disk->queue)) if (!blk_fs_request(rq) || !disk || !blk_do_io_stat(disk->queue))
return; return;
cpu = part_stat_lock(); cpu = part_stat_lock();
...@@ -1667,7 +1667,7 @@ static void blk_account_io_completion(struct request *req, unsigned int bytes) ...@@ -1667,7 +1667,7 @@ static void blk_account_io_completion(struct request *req, unsigned int bytes)
{ {
struct gendisk *disk = req->rq_disk; struct gendisk *disk = req->rq_disk;
if (!disk || !blk_queue_io_stat(disk->queue)) if (!disk || !blk_do_io_stat(disk->queue))
return; return;
if (blk_fs_request(req)) { if (blk_fs_request(req)) {
...@@ -1686,7 +1686,7 @@ static void blk_account_io_done(struct request *req) ...@@ -1686,7 +1686,7 @@ static void blk_account_io_done(struct request *req)
{ {
struct gendisk *disk = req->rq_disk; struct gendisk *disk = req->rq_disk;
if (!disk || !blk_queue_io_stat(disk->queue)) if (!disk || !blk_do_io_stat(disk->queue))
return; return;
/* /*
......
...@@ -108,4 +108,12 @@ static inline int blk_cpu_to_group(int cpu) ...@@ -108,4 +108,12 @@ static inline int blk_cpu_to_group(int cpu)
#endif #endif
} }
static inline int blk_do_io_stat(struct request_queue *q)
{
if (q)
return blk_queue_io_stat(q);
return 0;
}
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment