[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] blkfront:finish requests in io-ring with EIO



On Tue, Apr 01, 2014 at 04:25:12PM +0800, Gordon Gong wrote:
> Subject: [PATCH] blkfront:finished the requests in io-ring with EIO to avoid
>  stucking with state of D.

How do you get to this state?
> 
> The sequence of xenwatch of blkfront and xenbus_frontend, when the
> tdb path of backend is gone, desided that the backend closing->
> frontend closing->backend closed->frontend closed normaly or remove
> started by xenbus.
> ---
>  drivers/block/xen-blkfront.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index 9ea8c25..6582592 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -653,6 +653,26 @@ static void blkif_restart_queue(struct work_struct
> *work)
>   spin_unlock_irq(&blkif_io_lock);
>  }
> 
> +static void finish_requests_sync(struct blkfront_info *info)
> +{
> + RING_IDX rc, rp;
> + struct blkif_request *ring_req;
> + struct request *req;
> +
> + rc = (info->ring.sring)->req_prod;
> + rp = info->ring.req_prod_pvt;
> +
> + while(rc != cp) {
> + unsigned long id;
> +
> + ring_req = RING_GET_REQUEST(&info->ring, rc);
> + id = ring_req->id;
> + req = info->shadow[id].request;
> + __blk_end_srequest_all(req, -EIO);
> + rc++;
> + }

Something is off with your editor. You should use tabs.
> +}
> +
>  static void blkif_free(struct blkfront_info *info, int suspend)
>  {
>   /* Prevent new requests being issued until we fix things up. */
> @@ -664,6 +684,9 @@ static void blkif_free(struct blkfront_info *info, int
> suspend)
>   blk_stop_queue(info->rq);
>   /* No more gnttab callback work. */
>   gnttab_cancel_free_callback(&info->callback);
> + /* Finished request in io-ring with EIO */
> + finish_requests_sync(info);
> +
>   spin_unlock_irq(&blkif_io_lock);
> 
>   /* Flush gnttab callback work. Must be done with no locks held. */
> -- 
> 1.8.3.1



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.