提交 149a051f 编写于 作者: J Jens Axboe

as-iosched: fix double locking bug in as_merged_requests()

If the two requests belong to the same io context, we will attempt
to lock the same lock twice. But swapping contexts is pointless in
that case, so just check for rioc == nioc before doing the double
lock and copy.
Tested-by: NOlof Johansson <olof@lixom.net>
Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
上级 5b10ca19
......@@ -1275,9 +1275,13 @@ static void as_merged_requests(struct request_queue *q, struct request *req,
* Don't copy here but swap, because when anext is
* removed below, it must contain the unused context
*/
double_spin_lock(&rioc->lock, &nioc->lock, rioc < nioc);
swap_io_context(&rioc, &nioc);
double_spin_unlock(&rioc->lock, &nioc->lock, rioc < nioc);
if (rioc != nioc) {
double_spin_lock(&rioc->lock, &nioc->lock,
rioc < nioc);
swap_io_context(&rioc, &nioc);
double_spin_unlock(&rioc->lock, &nioc->lock,
rioc < nioc);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册