Skip to contentSkip to conversation

rbd: fix I/O error propagation for reads

PATCH In review Josh Durgin 4 participants 6 messages Aug 27, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rbd: fix I/O error propagation for reads

When a request returns an error, the driver needs to report the entire extent of the request as completed. Writes already did this, since they always set xferred = length, but reads were skipping that step if an error other than -ENOENT occurred. Instead, rbd would end up passing 0 xferred to blk_end_request(), which would always report needing more data. This resulted in an assert failing when more data was required by the block layer, but all the object requests were done:

[ 1868.719077] rbd: obj_request read result -108 xferred 0
[ 1868.719077]
[ 1868.719518] end_request: I/O error, dev rbd1, sector 0
[ 1868.719739]
[ 1868.719739] Assertion failure in rbd_img_obj_callback() at line 1736:
[ 1868.719739]
[ 1868.719739]   rbd_assert(more ^ (which == img_request->obj_request_count));

Without this assert, reads that hit errors would hang forever, since the block layer considered them incomplete.

---
 drivers/block/rbd.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/block/rbd.c +7 -7
index 0d669ae..f8fd7d3 100644
@@ -1557,11 +1557,12 @@ rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request)
 		obj_request, obj_request->img_request, obj_request->result,
 		xferred, length);
 	/*
-	 * ENOENT means a hole in the image.  We zero-fill the
-	 * entire length of the request.  A short read also implies
-	 * zero-fill to the end of the request.  Either way we
-	 * update the xferred count to indicate the whole request
-	 * was satisfied.
+	 * ENOENT means a hole in the image.  We zero-fill the entire
+	 * length of the request.  A short read also implies zero-fill
+	 * to the end of the request.  An error requires the whole
+	 * length of the request to be reported finished with an error
+	 * to the block layer.  In each case we update the xferred
+	 * count to indicate the whole request was satisfied.
 	 */
 	rbd_assert(obj_request->type != OBJ_REQUEST_NODATA);
 	if (obj_request->result == -ENOENT) {
@@ -1570,14 +1571,13 @@ rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request)
 		else
 			zero_pages(obj_request->pages, 0, length);
 		obj_request->result = 0;
-		obj_request->xferred = length;
 	} else if (xferred < length && !obj_request->result) {
 		if (obj_request->type == OBJ_REQUEST_BIO)
 			zero_bio_chain(obj_request->bio_list, xferred);
 		else
 			zero_pages(obj_request->pages, xferred, length);
-		obj_request->xferred = length;
 	}
+	obj_request->xferred = length;
 	obj_request_done_set(obj_request);
 }
 
Signature · 1 line
1.7.2.5
#1 lore raw

Josh,

The original bug is marked as krbd, but could this bug could affect rbd volumes mounted via qemu as well? If so, could you describe how it might block a qemu guest?

We've been fighting i/o issues on some of our guests for some time. With qemu 1.4.0, we saw the entire guest freeze. But now with qemu 1.5.2 which includes your asynchronous flush patch, the issue is typified by periodic dips in performance and high latency (especially for reads, it seems). Could this bug be related?

Thanks,
Mike Dawson

Quoted 65 lines · Josh Durgin

When a request returns an error, the driver needs to report the entire extent of the request as completed. Writes already did this, since they always set xferred = length, but reads were skipping that step if an error other than -ENOENT occurred. Instead, rbd would end up passing 0 xferred to blk_end_request(), which would always report needing more data. This resulted in an assert failing when more data was required by the block layer, but all the object requests were done:

[ 1868.719077] rbd: obj_request read result -108 xferred 0
[ 1868.719077]
[ 1868.719518] end_request: I/O error, dev rbd1, sector 0
[ 1868.719739]
[ 1868.719739] Assertion failure in rbd_img_obj_callback() at line 1736:
[ 1868.719739]
[ 1868.719739]   rbd_assert(more ^ (which == img_request->obj_request_count));

Without this assert, reads that hit errors would hang forever, since the block layer considered them incomplete.

---
  drivers/block/rbd.c |   14 +++++++-------
  1 files changed, 7 insertions(+), 7 deletions(-)
drivers/block/rbd.c +7 -7
index 0d669ae..f8fd7d3 100644
@@ -1557,11 +1557,12 @@ rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request)
  		obj_request, obj_request->img_request, obj_request->result,
  		xferred, length);
  	/*
-	 * ENOENT means a hole in the image.  We zero-fill the
-	 * entire length of the request.  A short read also implies
-	 * zero-fill to the end of the request.  Either way we
-	 * update the xferred count to indicate the whole request
-	 * was satisfied.
+	 * ENOENT means a hole in the image.  We zero-fill the entire
+	 * length of the request.  A short read also implies zero-fill
+	 * to the end of the request.  An error requires the whole
+	 * length of the request to be reported finished with an error
+	 * to the block layer.  In each case we update the xferred
+	 * count to indicate the whole request was satisfied.
  	 */
  	rbd_assert(obj_request->type != OBJ_REQUEST_NODATA);
  	if (obj_request->result == -ENOENT) {
@@ -1570,14 +1571,13 @@ rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request)
  		else
  			zero_pages(obj_request->pages, 0, length);
  		obj_request->result = 0;
-		obj_request->xferred = length;
  	} else if (xferred < length && !obj_request->result) {
  		if (obj_request->type == OBJ_REQUEST_BIO)
  			zero_bio_chain(obj_request->bio_list, xferred);
  		else
  			zero_pages(obj_request->pages, xferred, length);
-		obj_request->xferred = length;
  	}
+	obj_request->xferred = length;
  	obj_request_done_set(obj_request);
  }
 
#2 lore raw
Quoted 5 lines · Mike Dawson

Josh,

The original bug is marked as krbd, but could this bug could affect rbd volumes mounted via qemu as well? If so, could you describe how it might block a qemu guest?

No, this is just a patch for the kernel rbd driver, which doesn't affect qemu at all.

Quoted 5 lines

We've been fighting i/o issues on some of our guests for some time. With qemu 1.4.0, we saw the entire guest freeze. But now with qemu 1.5.2 which includes your asynchronous flush patch, the issue is typified by periodic dips in performance and high latency (especially for reads, it seems). Could this bug be related?

A good next step for tracking this down would be narrowing in on the source of the periods of high latency - starting with whether they're primarily coming from the server or client side. Since it's especially reads, I'd guess it's more likely to be an osd-side issue. If you look at the admin socket's dump_historic_ops do you see higher op durations around the dips in performance? What about any correlation with underlying disk stats from iostat -x?

Quoted 73 lines

Thanks,
Mike Dawson

Quoted 68 lines · Josh Durgin

When a request returns an error, the driver needs to report the entire extent of the request as completed. Writes already did this, since they always set xferred = length, but reads were skipping that step if an error other than -ENOENT occurred. Instead, rbd would end up passing 0 xferred to blk_end_request(), which would always report needing more data. This resulted in an assert failing when more data was required by the block layer, but all the object requests were done:

[ 1868.719077] rbd: obj_request read result -108 xferred 0
[ 1868.719077]
[ 1868.719518] end_request: I/O error, dev rbd1, sector 0
[ 1868.719739]
[ 1868.719739] Assertion failure in rbd_img_obj_callback() at line 1736:
[ 1868.719739]
[ 1868.719739]   rbd_assert(more ^ (which ==

img_request->obj_request_count));

Without this assert, reads that hit errors would hang forever, since the block layer considered them incomplete.

---
  drivers/block/rbd.c |   14 +++++++-------
  1 files changed, 7 insertions(+), 7 deletions(-)
drivers/block/rbd.c +6 -5
index 0d669ae..f8fd7d3 100644
@@ -1557,11 +1557,12 @@ rbd_img_obj_request_read_callback(struct
 rbd_obj_request *obj_request)
          obj_request, obj_request->img_request, obj_request->result,
          xferred, length);
      /*
-     * ENOENT means a hole in the image.  We zero-fill the
-     * entire length of the request.  A short read also implies
-     * zero-fill to the end of the request.  Either way we
-     * update the xferred count to indicate the whole request
-     * was satisfied.
+     * ENOENT means a hole in the image.  We zero-fill the entire
+     * length of the request.  A short read also implies zero-fill
+     * to the end of the request.  An error requires the whole
+     * length of the request to be reported finished with an error
+     * to the block layer.  In each case we update the xferred
+     * count to indicate the whole request was satisfied.
       */
      rbd_assert(obj_request->type != OBJ_REQUEST_NODATA);
      if (obj_request->result == -ENOENT) {
drivers/block/rbd.c +1 -2
@@ -1570,14 +1571,13 @@ rbd_img_obj_request_read_callback(struct
 rbd_obj_request *obj_request)
          else
              zero_pages(obj_request->pages, 0, length);
          obj_request->result = 0;
-        obj_request->xferred = length;
      } else if (xferred < length && !obj_request->result) {
          if (obj_request->type == OBJ_REQUEST_BIO)
              zero_bio_chain(obj_request->bio_list, xferred);
          else
              zero_pages(obj_request->pages, xferred, length);
-        obj_request->xferred = length;
      }
+    obj_request->xferred = length;
      obj_request_done_set(obj_request);
  }
Reviewed-by on v1 1/1
#3 lore raw
In reply to Josh Durgin
Quoted 2 lines · Josh Durgin

When a request returns an error, the driver needs to report the entire extent of the request as completed. Writes already did this, since

You're right. The block layer needs to "consume" the bytes in this portion of the image request whether or not they were completed successfully.

This looks good to me.

Quoted 63 lines

they always set xferred = length, but reads were skipping that step if an error other than -ENOENT occurred. Instead, rbd would end up passing 0 xferred to blk_end_request(), which would always report needing more data. This resulted in an assert failing when more data was required by the block layer, but all the object requests were done:

[ 1868.719077] rbd: obj_request read result -108 xferred 0
[ 1868.719077]
[ 1868.719518] end_request: I/O error, dev rbd1, sector 0
[ 1868.719739]
[ 1868.719739] Assertion failure in rbd_img_obj_callback() at line 1736:
[ 1868.719739]
[ 1868.719739]   rbd_assert(more ^ (which == img_request->obj_request_count));

Without this assert, reads that hit errors would hang forever, since the block layer considered them incomplete.

---
 drivers/block/rbd.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/block/rbd.c +7 -7
index 0d669ae..f8fd7d3 100644
@@ -1557,11 +1557,12 @@ rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request)
 		obj_request, obj_request->img_request, obj_request->result,
 		xferred, length);
 	/*
-	 * ENOENT means a hole in the image.  We zero-fill the
-	 * entire length of the request.  A short read also implies
-	 * zero-fill to the end of the request.  Either way we
-	 * update the xferred count to indicate the whole request
-	 * was satisfied.
+	 * ENOENT means a hole in the image.  We zero-fill the entire
+	 * length of the request.  A short read also implies zero-fill
+	 * to the end of the request.  An error requires the whole
+	 * length of the request to be reported finished with an error
+	 * to the block layer.  In each case we update the xferred
+	 * count to indicate the whole request was satisfied.
 	 */
 	rbd_assert(obj_request->type != OBJ_REQUEST_NODATA);
 	if (obj_request->result == -ENOENT) {
@@ -1570,14 +1571,13 @@ rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request)
 		else
 			zero_pages(obj_request->pages, 0, length);
 		obj_request->result = 0;
-		obj_request->xferred = length;
 	} else if (xferred < length && !obj_request->result) {
 		if (obj_request->type == OBJ_REQUEST_BIO)
 			zero_bio_chain(obj_request->bio_list, xferred);
 		else
 			zero_pages(obj_request->pages, xferred, length);
-		obj_request->xferred = length;
 	}
+	obj_request->xferred = length;
 	obj_request_done_set(obj_request);
 }
 
#4 lore raw
Quoted 11 lines · Alex Elder
Quoted 2 lines · Josh Durgin

When a request returns an error, the driver needs to report the entire extent of the request as completed. Writes already did this, since

You're right. The block layer needs to "consume" the bytes in this portion of the image request whether or not they were completed successfully.

This looks good to me.

This one should go to Linus for 3.11. I added this tot he testing branch and put a CC stable for 3.10 in there.. is that the right set of kernels to backport to?

Thanks!
sage

Quoted 71 lines
Quoted 54 lines

they always set xferred = length, but reads were skipping that step if an error other than -ENOENT occurred. Instead, rbd would end up passing 0 xferred to blk_end_request(), which would always report needing more data. This resulted in an assert failing when more data was required by the block layer, but all the object requests were done:

[ 1868.719077] rbd: obj_request read result -108 xferred 0
[ 1868.719077]
[ 1868.719518] end_request: I/O error, dev rbd1, sector 0
[ 1868.719739]
[ 1868.719739] Assertion failure in rbd_img_obj_callback() at line 1736:
[ 1868.719739]
[ 1868.719739]   rbd_assert(more ^ (which == img_request->obj_request_count));

Without this assert, reads that hit errors would hang forever, since the block layer considered them incomplete.

---
 drivers/block/rbd.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/block/rbd.c +6 -6
index 0d669ae..f8fd7d3 100644
@@ -1557,11 +1557,12 @@ rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request)
 		obj_request, obj_request->img_request, obj_request->result,
 		xferred, length);
 	/*
-	 * ENOENT means a hole in the image.  We zero-fill the
-	 * entire length of the request.  A short read also implies
-	 * zero-fill to the end of the request.  Either way we
-	 * update the xferred count to indicate the whole request
-	 * was satisfied.
+	 * ENOENT means a hole in the image.  We zero-fill the entire
+	 * length of the request.  A short read also implies zero-fill
+	 * to the end of the request.  An error requires the whole
+	 * length of the request to be reported finished with an error
+	 * to the block layer.  In each case we update the xferred
+	 * count to indicate the whole request was satisfied.
 	 */
 	rbd_assert(obj_request->type != OBJ_REQUEST_NODATA);
 	if (obj_request->result == -ENOENT) {
@@ -1570,14 +1571,13 @@ rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request)
 		else
 			zero_pages(obj_request->pages, 0, length);
 		obj_request->result = 0;
-		obj_request->xferred = length;
 	} else if (xferred < length && !obj_request->result) {

drivers/block/rbd.c rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request) · line 1583

Quoted 10 lines
drivers/block/rbd.c +1 -1
 		if (obj_request->type == OBJ_REQUEST_BIO)
 			zero_bio_chain(obj_request->bio_list, xferred);
 		else
 			zero_pages(obj_request->pages, xferred, length);
-		obj_request->xferred = length;
 	}
+	obj_request->xferred = length;
 	obj_request_done_set(obj_request);
 }
 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
Quoted 9 lines · Sage Weil
Quoted 8 lines · Alex Elder
Quoted 2 lines · Josh Durgin

When a request returns an error, the driver needs to report the entire extent of the request as completed. Writes already did this, since

You're right. The block layer needs to "consume" the bytes in this portion of the image request whether or not they were completed successfully.

Quoted 7 lines
Quoted 3 lines

This looks good to me.

This one should go to Linus for 3.11. I added this tot he testing branch and put a CC stable for 3.10 in there.. is that the right set of kernels to backport to?

3.10 yes. 3.9 is EOL. 3.4.59 (longterm) did not include this code, so yes, that's the right set of kernels. (I did not check on anything Ubuntu is supporting.)

-Alex

Quoted 74 lines

Thanks!
sage

Quoted 71 lines
Quoted 54 lines

they always set xferred = length, but reads were skipping that step if an error other than -ENOENT occurred. Instead, rbd would end up passing 0 xferred to blk_end_request(), which would always report needing more data. This resulted in an assert failing when more data was required by the block layer, but all the object requests were done:

[ 1868.719077] rbd: obj_request read result -108 xferred 0
[ 1868.719077]
[ 1868.719518] end_request: I/O error, dev rbd1, sector 0
[ 1868.719739]
[ 1868.719739] Assertion failure in rbd_img_obj_callback() at line 1736:
[ 1868.719739]
[ 1868.719739]   rbd_assert(more ^ (which == img_request->obj_request_count));

Without this assert, reads that hit errors would hang forever, since the block layer considered them incomplete.

---
 drivers/block/rbd.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/block/rbd.c +6 -6
index 0d669ae..f8fd7d3 100644
@@ -1557,11 +1557,12 @@ rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request)
 		obj_request, obj_request->img_request, obj_request->result,
 		xferred, length);
 	/*
-	 * ENOENT means a hole in the image.  We zero-fill the
-	 * entire length of the request.  A short read also implies
-	 * zero-fill to the end of the request.  Either way we
-	 * update the xferred count to indicate the whole request
-	 * was satisfied.
+	 * ENOENT means a hole in the image.  We zero-fill the entire
+	 * length of the request.  A short read also implies zero-fill
+	 * to the end of the request.  An error requires the whole
+	 * length of the request to be reported finished with an error
+	 * to the block layer.  In each case we update the xferred
+	 * count to indicate the whole request was satisfied.
 	 */
 	rbd_assert(obj_request->type != OBJ_REQUEST_NODATA);
 	if (obj_request->result == -ENOENT) {
@@ -1570,14 +1571,13 @@ rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request)
 		else
 			zero_pages(obj_request->pages, 0, length);
 		obj_request->result = 0;
-		obj_request->xferred = length;
 	} else if (xferred < length && !obj_request->result) {

drivers/block/rbd.c rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request) · line 1583

Quoted 10 lines
drivers/block/rbd.c +1 -1
 		if (obj_request->type == OBJ_REQUEST_BIO)
 			zero_bio_chain(obj_request->bio_list, xferred);
 		else
 			zero_pages(obj_request->pages, xferred, length);
-		obj_request->xferred = length;
 	}
+	obj_request->xferred = length;
 	obj_request_done_set(obj_request);
 }
 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html