Re: Fix soft lockup with iSeries viocd driver

From: Jens Axboe
Date: Tue Feb 27 2007 - 09:33:38 EST


On Tue, Feb 27 2007, Tony Breeds wrote:
> From: Tony Breeds <tony@xxxxxxxxxxxxxxxxxx>
>
> Fix soft lockup with iSeries viocd driver, caused by eventually calling
> end_that_request_first() with nr_bytes 0.
>
> The lockup is triggered by hald, interrogating the device.
>
> Signed-off-by: Tony Breeds <tony@xxxxxxxxxxxxxxxxxx>
>
> ---
> Implementation based on drivers/ide/ide-io.c:ide_end_request()
>
> viocd.c | 24 ++++++++++++++++++++----
> 1 file changed, 20 insertions(+), 4 deletions(-)
>
> Index: linux-2.6.20-rc5/drivers/cdrom/viocd.c
> ===================================================================
> --- linux-2.6.20-rc5.orig/drivers/cdrom/viocd.c
> +++ linux-2.6.20-rc5/drivers/cdrom/viocd.c
> @@ -376,6 +376,22 @@ static int send_request(struct request *
> return 0;
> }
>
> +static void viocd_end_request(struct request *req, int uptodate)
> +{
> + int nsectors = req->hard_cur_sectors;
> +
> + /* Make sure it's fully ended */
> + if (blk_pc_request(req))
> + nsectors = (req->data_len + 511) >> 9;
> + if (!nsectors)
> + nsectors = 1;
> +
> + if (!end_that_request_first(req, uptodate, nsectors)) {
> + add_disk_randomness(req->rq_disk);
> + blkdev_dequeue_request(req);
> + end_that_request_last(req, uptodate);
> + }
> +}

It looks ok (better than end_request()), though it would still be nice
to properly end requests. See the recent thread on the lguest block
driver.

--
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/