All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] Emit QUORUM_REPORT_BAD for reads in fifo mode
@ 2016-03-15  9:41 Alberto Garcia
  2016-03-15  9:41 ` [Qemu-devel] [PATCH 1/2] quorum: " Alberto Garcia
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alberto Garcia @ 2016-03-15  9:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Changlong Xie, Alberto Garcia, qemu-block, Max Reitz

This is a follow-up to the "Separate QUORUM_REPORT_BAD events" series:

   https://lists.gnu.org/archive/html/qemu-devel/2016-03/msg02402.html

If there's an I/O error in one of Quorum children then QEMU should
emit QUORUM_REPORT_BAD. However this is not working with
read-pattern=fifo. This patch fixes this problem.

This applies on top of Kevin's block branch.

Regards,

Berto

Alberto Garcia (2):
  quorum: Emit QUORUM_REPORT_BAD for reads in fifo mode
  iotests: Test QUORUM_REPORT_BAD in fifo mode

 block/quorum.c             | 17 +++++++++--------
 tests/qemu-iotests/148     | 17 +++++++++++++++--
 tests/qemu-iotests/148.out |  4 ++--
 3 files changed, 26 insertions(+), 12 deletions(-)

-- 
2.7.0

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

* [Qemu-devel] [PATCH 1/2] quorum: Emit QUORUM_REPORT_BAD for reads in fifo mode
  2016-03-15  9:41 [Qemu-devel] [PATCH 0/2] Emit QUORUM_REPORT_BAD for reads in fifo mode Alberto Garcia
@ 2016-03-15  9:41 ` Alberto Garcia
  2016-03-16 15:08   ` Max Reitz
  2016-03-15  9:41 ` [Qemu-devel] [PATCH 2/2] iotests: Test QUORUM_REPORT_BAD " Alberto Garcia
  2016-03-16 15:21 ` [Qemu-devel] [PATCH 0/2] Emit QUORUM_REPORT_BAD for reads " Max Reitz
  2 siblings, 1 reply; 6+ messages in thread
From: Alberto Garcia @ 2016-03-15  9:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Changlong Xie, Alberto Garcia, qemu-block, Max Reitz

If there's an I/O error in one of Quorum children then QEMU
should emit QUORUM_REPORT_BAD. However this is not working with
read-pattern=fifo. This patch fixes this problem.

Signed-off-by: Alberto Garcia <berto@igalia.com>
---
 block/quorum.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/block/quorum.c b/block/quorum.c
index 3d47351..da15465 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -284,9 +284,17 @@ static void quorum_aio_cb(void *opaque, int ret)
     QuorumChildRequest *sacb = opaque;
     QuorumAIOCB *acb = sacb->parent;
     BDRVQuorumState *s = acb->common.bs->opaque;
-    QuorumOpType type;
     bool rewrite = false;
 
+    if (ret == 0) {
+        acb->success_count++;
+    } else {
+        QuorumOpType type;
+        type = acb->is_read ? QUORUM_OP_TYPE_READ : QUORUM_OP_TYPE_WRITE;
+        quorum_report_bad(type, acb->sector_num, acb->nb_sectors,
+                          sacb->aiocb->bs->node_name, ret);
+    }
+
     if (acb->is_read && s->read_pattern == QUORUM_READ_PATTERN_FIFO) {
         /* We try to read next child in FIFO order if we fail to read */
         if (ret < 0 && (acb->child_iter + 1) < s->num_children) {
@@ -303,15 +311,8 @@ static void quorum_aio_cb(void *opaque, int ret)
         return;
     }
 
-    type = acb->is_read ? QUORUM_OP_TYPE_READ : QUORUM_OP_TYPE_WRITE;
     sacb->ret = ret;
     acb->count++;
-    if (ret == 0) {
-        acb->success_count++;
-    } else {
-        quorum_report_bad(type, acb->sector_num, acb->nb_sectors,
-                          sacb->aiocb->bs->node_name, ret);
-    }
     assert(acb->count <= s->num_children);
     assert(acb->success_count <= s->num_children);
     if (acb->count < s->num_children) {
-- 
2.7.0

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

* [Qemu-devel] [PATCH 2/2] iotests: Test QUORUM_REPORT_BAD in fifo mode
  2016-03-15  9:41 [Qemu-devel] [PATCH 0/2] Emit QUORUM_REPORT_BAD for reads in fifo mode Alberto Garcia
  2016-03-15  9:41 ` [Qemu-devel] [PATCH 1/2] quorum: " Alberto Garcia
@ 2016-03-15  9:41 ` Alberto Garcia
  2016-03-16 15:17   ` Max Reitz
  2016-03-16 15:21 ` [Qemu-devel] [PATCH 0/2] Emit QUORUM_REPORT_BAD for reads " Max Reitz
  2 siblings, 1 reply; 6+ messages in thread
From: Alberto Garcia @ 2016-03-15  9:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Changlong Xie, Alberto Garcia, qemu-block, Max Reitz

Signed-off-by: Alberto Garcia <berto@igalia.com>
---
 tests/qemu-iotests/148     | 17 +++++++++++++++--
 tests/qemu-iotests/148.out |  4 ++--
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/tests/qemu-iotests/148 b/tests/qemu-iotests/148
index 30bc379..d066ec3 100644
--- a/tests/qemu-iotests/148
+++ b/tests/qemu-iotests/148
@@ -35,6 +35,7 @@ sector_size = 512
 offset = 10
 
 class TestQuorumEvents(iotests.QMPTestCase):
+    read_pattern = 'quorum'
 
     def create_blkdebug_file(self, blkdebug_file, bad_sector):
         file = open(blkdebug_file, 'w')
@@ -48,6 +49,7 @@ sector = "%d"
 
     def setUp(self):
         driveopts = ['driver=quorum', 'vote-threshold=2']
+        driveopts.append('read-pattern=%s' % self.read_pattern)
         for i in range(len(imgs)):
             iotests.qemu_img('create', '-f', iotests.imgfmt, imgs[i], '1M')
             self.create_blkdebug_file(img_conf[i], i + offset)
@@ -112,7 +114,11 @@ sector = "%d"
             self.vm.hmp_qemu_io("drive0", "aio_read %d %d" %
                                 ((offset + i) * sector_size, sector_size))
             self.vm.qtest("clock_step %d" % delay)
-            self.do_check_event('img%d' % i, offset + i)
+            # In fifo mode only errors in the first child are detected
+            if i > 0 and self.read_pattern == 'fifo':
+                self.do_check_event(None)
+            else:
+                self.do_check_event('img%d' % i, offset + i)
 
         # I/O errors in different children: all events are emitted
         delay = 2 * event_rate
@@ -120,10 +126,17 @@ sector = "%d"
             self.vm.hmp_qemu_io("drive0", "aio_read %d %d" %
                                 ((offset + i) * sector_size, sector_size))
             self.vm.qtest("clock_step %d" % delay)
-            self.do_check_event('img%d' % i, offset + i)
+            # In fifo mode only errors in the first child are detected
+            if i > 0 and self.read_pattern == 'fifo':
+                self.do_check_event(None)
+            else:
+                self.do_check_event('img%d' % i, offset + i)
 
         # No more pending events
         self.do_check_event(None)
 
+class TestFifoQuorumEvents(TestQuorumEvents):
+    read_pattern = 'fifo'
+
 if __name__ == '__main__':
     iotests.main(supported_fmts=["raw"])
diff --git a/tests/qemu-iotests/148.out b/tests/qemu-iotests/148.out
index ae1213e..fbc63e6 100644
--- a/tests/qemu-iotests/148.out
+++ b/tests/qemu-iotests/148.out
@@ -1,5 +1,5 @@
-.
+..
 ----------------------------------------------------------------------
-Ran 1 tests
+Ran 2 tests
 
 OK
-- 
2.7.0

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

* Re: [Qemu-devel] [PATCH 1/2] quorum: Emit QUORUM_REPORT_BAD for reads in fifo mode
  2016-03-15  9:41 ` [Qemu-devel] [PATCH 1/2] quorum: " Alberto Garcia
@ 2016-03-16 15:08   ` Max Reitz
  0 siblings, 0 replies; 6+ messages in thread
From: Max Reitz @ 2016-03-16 15:08 UTC (permalink / raw)
  To: Alberto Garcia, qemu-devel; +Cc: Changlong Xie, qemu-block


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

On 15.03.2016 10:41, Alberto Garcia wrote:
> If there's an I/O error in one of Quorum children then QEMU
> should emit QUORUM_REPORT_BAD. However this is not working with
> read-pattern=fifo. This patch fixes this problem.
> 
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
>  block/quorum.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [Qemu-devel] [PATCH 2/2] iotests: Test QUORUM_REPORT_BAD in fifo mode
  2016-03-15  9:41 ` [Qemu-devel] [PATCH 2/2] iotests: Test QUORUM_REPORT_BAD " Alberto Garcia
@ 2016-03-16 15:17   ` Max Reitz
  0 siblings, 0 replies; 6+ messages in thread
From: Max Reitz @ 2016-03-16 15:17 UTC (permalink / raw)
  To: Alberto Garcia, qemu-devel; +Cc: Changlong Xie, qemu-block


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

On 15.03.2016 10:41, Alberto Garcia wrote:
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
>  tests/qemu-iotests/148     | 17 +++++++++++++++--
>  tests/qemu-iotests/148.out |  4 ++--
>  2 files changed, 17 insertions(+), 4 deletions(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [Qemu-devel] [PATCH 0/2] Emit QUORUM_REPORT_BAD for reads in fifo mode
  2016-03-15  9:41 [Qemu-devel] [PATCH 0/2] Emit QUORUM_REPORT_BAD for reads in fifo mode Alberto Garcia
  2016-03-15  9:41 ` [Qemu-devel] [PATCH 1/2] quorum: " Alberto Garcia
  2016-03-15  9:41 ` [Qemu-devel] [PATCH 2/2] iotests: Test QUORUM_REPORT_BAD " Alberto Garcia
@ 2016-03-16 15:21 ` Max Reitz
  2 siblings, 0 replies; 6+ messages in thread
From: Max Reitz @ 2016-03-16 15:21 UTC (permalink / raw)
  To: Alberto Garcia, qemu-devel; +Cc: Changlong Xie, qemu-block


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

On 15.03.2016 10:41, Alberto Garcia wrote:
> This is a follow-up to the "Separate QUORUM_REPORT_BAD events" series:
> 
>    https://lists.gnu.org/archive/html/qemu-devel/2016-03/msg02402.html
> 
> If there's an I/O error in one of Quorum children then QEMU should
> emit QUORUM_REPORT_BAD. However this is not working with
> read-pattern=fifo. This patch fixes this problem.
> 
> This applies on top of Kevin's block branch.
> 
> Regards,
> 
> Berto
> 
> Alberto Garcia (2):
>   quorum: Emit QUORUM_REPORT_BAD for reads in fifo mode
>   iotests: Test QUORUM_REPORT_BAD in fifo mode
> 
>  block/quorum.c             | 17 +++++++++--------
>  tests/qemu-iotests/148     | 17 +++++++++++++++--
>  tests/qemu-iotests/148.out |  4 ++--
>  3 files changed, 26 insertions(+), 12 deletions(-)

Thanks, applied to my block tree:

https://github.com/XanClic/qemu/commits/block

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2016-03-16 15:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-15  9:41 [Qemu-devel] [PATCH 0/2] Emit QUORUM_REPORT_BAD for reads in fifo mode Alberto Garcia
2016-03-15  9:41 ` [Qemu-devel] [PATCH 1/2] quorum: " Alberto Garcia
2016-03-16 15:08   ` Max Reitz
2016-03-15  9:41 ` [Qemu-devel] [PATCH 2/2] iotests: Test QUORUM_REPORT_BAD " Alberto Garcia
2016-03-16 15:17   ` Max Reitz
2016-03-16 15:21 ` [Qemu-devel] [PATCH 0/2] Emit QUORUM_REPORT_BAD for reads " Max Reitz

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.