All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] blkfront:finish requests in io-ring with EIO
@ 2014-04-01  8:25 Gordon Gong
  2014-04-01 12:47 ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 2+ messages in thread
From: Gordon Gong @ 2014-04-01  8:25 UTC (permalink / raw)
  To: konrad.wilk, boris.ostrovsky, david.vrable; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1651 bytes --]

Subject: [PATCH] blkfront:finished the requests in io-ring with EIO to avoid
 stucking with state of D.

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++;
+ }
+}
+
 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

[-- Attachment #1.2: Type: text/html, Size: 3357 bytes --]

[-- Attachment #2: 0001-blkfront-finished-the-requests-in-io-ring-with-EIO-t.patch --]
[-- Type: application/octet-stream, Size: 1816 bytes --]

From 98e228ab342065ddb7bb0754e55f1566ebe5938b Mon Sep 17 00:00:00 2001
From: Xiaodong Gong <gordongong0350@gmail.com>
Date: Tue, 1 Apr 2014 03:00:39 -0400
Subject: [PATCH] blkfront:finished the requests in io-ring with EIO to avoid
 stucking with state of D.

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++;
+	}
+}
+
 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


[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-01 12:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-01  8:25 [PATCH] blkfront:finish requests in io-ring with EIO Gordon Gong
2014-04-01 12:47 ` Konrad Rzeszutek Wilk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.