From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH] blkfront:finish requests in io-ring with EIO Date: Tue, 1 Apr 2014 08:47:17 -0400 Message-ID: <20140401124717.GB7135@phenom.dumpdata.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WUy6B-00048J-J7 for xen-devel@lists.xenproject.org; Tue, 01 Apr 2014 12:47:28 +0000 Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Gordon Gong Cc: xen-devel@lists.xenproject.org, boris.ostrovsky@oracle.com, david.vrable@citrix.com List-Id: xen-devel@lists.xenproject.org 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