All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/6] pr-manager/qemu-pr-helper patches for QEMU 3.0
@ 2018-06-28 19:57 Paolo Bonzini
  2018-06-28 19:57 ` [Qemu-devel] [PATCH 1/6] pr-helper: fix --socket-path default in help Paolo Bonzini
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Paolo Bonzini @ 2018-06-28 19:57 UTC (permalink / raw)
  To: qemu-devel

The first three patches are more or less trivial bugfixes.  The
last three allow libvirt to know the status of the qemu-pr-helper
process that is attached to a running QEMU instance.

Thanks,

Paolo

v1->v2: new patch for non-Linux portability
	issue event as soon as the socket is disconnected
	do not include full object path in event
	renamed "is_connected" field to "connected"

Paolo Bonzini (6):
  pr-helper: fix --socket-path default in help
  pr-helper: fix assertion failure on failed multipath PERSISTENT
    RESERVE IN
  pr-manager-helper: avoid SIGSEGV when writing to the socket fail
  pr-manager: put stubs in .c file
  pr-manager: add query-pr-managers QMP command
  pr-manager-helper: report event on connection/disconnection

 include/scsi/pr-manager.h | 11 ++--------
 qapi/block.json           | 52 +++++++++++++++++++++++++++++++++++++++++++++++
 scsi/Makefile.objs        |  1 +
 scsi/pr-manager-helper.c  | 28 +++++++++++++++++++++++++
 scsi/pr-manager-stub.c    | 30 +++++++++++++++++++++++++++
 scsi/pr-manager.c         | 45 ++++++++++++++++++++++++++++++++++++++++
 scsi/qemu-pr-helper.c     | 21 +++++++++++--------
 7 files changed, 171 insertions(+), 17 deletions(-)
 create mode 100644 scsi/pr-manager-stub.c

-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 1/6] pr-helper: fix --socket-path default in help
  2018-06-28 19:57 [Qemu-devel] [PATCH v2 0/6] pr-manager/qemu-pr-helper patches for QEMU 3.0 Paolo Bonzini
@ 2018-06-28 19:57 ` Paolo Bonzini
  2018-06-28 19:57 ` [Qemu-devel] [PATCH 2/6] pr-helper: fix assertion failure on failed multipath PERSISTENT RESERVE IN Paolo Bonzini
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Paolo Bonzini @ 2018-06-28 19:57 UTC (permalink / raw)
  To: qemu-devel

Currently --help shows "(default '(null)')" for the -k/--socket-path
option.  Fix it by getting the default path in /var/run.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 scsi/qemu-pr-helper.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c
index d0f8317..4057cf3 100644
--- a/scsi/qemu-pr-helper.c
+++ b/scsi/qemu-pr-helper.c
@@ -74,8 +74,16 @@ static int uid = -1;
 static int gid = -1;
 #endif
 
+static void compute_default_paths(void)
+{
+    if (!socket_path) {
+        socket_path = qemu_get_local_state_pathname("run/qemu-pr-helper.sock");
+    }
+}
+
 static void usage(const char *name)
 {
+    compute_default_paths();
     (printf) (
 "Usage: %s [OPTIONS] FILE\n"
 "Persistent Reservation helper program for QEMU\n"
@@ -845,13 +853,6 @@ static const char *socket_activation_validate_opts(void)
     return NULL;
 }
 
-static void compute_default_paths(void)
-{
-    if (!socket_path) {
-        socket_path = qemu_get_local_state_pathname("run/qemu-pr-helper.sock");
-    }
-}
-
 static void termsig_handler(int signum)
 {
     atomic_cmpxchg(&state, RUNNING, TERMINATE);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 2/6] pr-helper: fix assertion failure on failed multipath PERSISTENT RESERVE IN
  2018-06-28 19:57 [Qemu-devel] [PATCH v2 0/6] pr-manager/qemu-pr-helper patches for QEMU 3.0 Paolo Bonzini
  2018-06-28 19:57 ` [Qemu-devel] [PATCH 1/6] pr-helper: fix --socket-path default in help Paolo Bonzini
@ 2018-06-28 19:57 ` Paolo Bonzini
  2018-06-28 19:57 ` [Qemu-devel] [PATCH 3/6] pr-manager-helper: avoid SIGSEGV when writing to the socket fail Paolo Bonzini
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Paolo Bonzini @ 2018-06-28 19:57 UTC (permalink / raw)
  To: qemu-devel

The response size is expected to be zero if the SCSI status is not
"GOOD", but nothing was resetting it.

This can be reproduced simply by "sg_persist -s /dev/sdb" where /dev/sdb
in the guest is a scsi-block device corresponding to a multipath device
on the host.

Before:

  PR in (Read full status): Aborted command

and on the host:

  prh_write_response: Assertion `resp->sz == 0' failed.

After:

  PR in (Read full status): bad field in cdb or parameter list
  (perhaps unsupported service action)

Reported-by: Jiri Belka <jbelka@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 scsi/qemu-pr-helper.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c
index 4057cf3..0218d65 100644
--- a/scsi/qemu-pr-helper.c
+++ b/scsi/qemu-pr-helper.c
@@ -558,7 +558,11 @@ static int do_pr_in(int fd, const uint8_t *cdb, uint8_t *sense,
 #ifdef CONFIG_MPATH
     if (is_mpath(fd)) {
         /* multipath_pr_in fills the whole input buffer.  */
-        return multipath_pr_in(fd, cdb, sense, data, *resp_sz);
+        int r = multipath_pr_in(fd, cdb, sense, data, *resp_sz);
+        if (r != GOOD) {
+            *resp_sz = 0;
+        }
+        return r;
     }
 #endif
 
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 3/6] pr-manager-helper: avoid SIGSEGV when writing to the socket fail
  2018-06-28 19:57 [Qemu-devel] [PATCH v2 0/6] pr-manager/qemu-pr-helper patches for QEMU 3.0 Paolo Bonzini
  2018-06-28 19:57 ` [Qemu-devel] [PATCH 1/6] pr-helper: fix --socket-path default in help Paolo Bonzini
  2018-06-28 19:57 ` [Qemu-devel] [PATCH 2/6] pr-helper: fix assertion failure on failed multipath PERSISTENT RESERVE IN Paolo Bonzini
@ 2018-06-28 19:57 ` Paolo Bonzini
  2018-06-28 19:57 ` [Qemu-devel] [PATCH 4/6] pr-manager: put stubs in .c file Paolo Bonzini
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Paolo Bonzini @ 2018-06-28 19:57 UTC (permalink / raw)
  To: qemu-devel

When writing to the qemu-pr-helper socket failed, the persistent
reservation manager was correctly disconnecting the socket, but it
did not clear pr_mgr->ioc.  So the rest of the code did not know
that the socket had been disconnected, accessed pr_mgr->ioc and
happily caused a crash.

To reproduce, it is enough to stop qemu-pr-helper between QEMU
startup and executing e.g. sg_persist -k /dev/sdb.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scsi/pr-manager-helper.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scsi/pr-manager-helper.c b/scsi/pr-manager-helper.c
index 82ff6b6..0c0fe38 100644
--- a/scsi/pr-manager-helper.c
+++ b/scsi/pr-manager-helper.c
@@ -71,6 +71,7 @@ static int pr_manager_helper_write(PRManagerHelper *pr_mgr,
         if (n_written <= 0) {
             assert(n_written != QIO_CHANNEL_ERR_BLOCK);
             object_unref(OBJECT(pr_mgr->ioc));
+            pr_mgr->ioc = NULL;
             return n_written < 0 ? -EINVAL : 0;
         }
 
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 4/6] pr-manager: put stubs in .c file
  2018-06-28 19:57 [Qemu-devel] [PATCH v2 0/6] pr-manager/qemu-pr-helper patches for QEMU 3.0 Paolo Bonzini
                   ` (2 preceding siblings ...)
  2018-06-28 19:57 ` [Qemu-devel] [PATCH 3/6] pr-manager-helper: avoid SIGSEGV when writing to the socket fail Paolo Bonzini
@ 2018-06-28 19:57 ` Paolo Bonzini
  2018-06-28 19:57 ` [Qemu-devel] [PATCH 5/6] pr-manager: add query-pr-managers QMP command Paolo Bonzini
  2018-06-28 19:57 ` [Qemu-devel] [PATCH 6/6] pr-manager-helper: report event on connection/disconnection Paolo Bonzini
  5 siblings, 0 replies; 9+ messages in thread
From: Paolo Bonzini @ 2018-06-28 19:57 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/scsi/pr-manager.h |  9 ---------
 scsi/Makefile.objs        |  1 +
 scsi/pr-manager-stub.c    | 24 ++++++++++++++++++++++++
 3 files changed, 25 insertions(+), 9 deletions(-)
 create mode 100644 scsi/pr-manager-stub.c

diff --git a/include/scsi/pr-manager.h b/include/scsi/pr-manager.h
index 5d2f13a..71971ae 100644
--- a/include/scsi/pr-manager.h
+++ b/include/scsi/pr-manager.h
@@ -41,15 +41,6 @@ BlockAIOCB *pr_manager_execute(PRManager *pr_mgr,
                                BlockCompletionFunc *complete,
                                void *opaque);
 
-#ifdef CONFIG_LINUX
 PRManager *pr_manager_lookup(const char *id, Error **errp);
-#else
-static inline PRManager *pr_manager_lookup(const char *id, Error **errp)
-{
-    /* The classes do not exist at all!  */
-    error_setg(errp, "No persistent reservation manager with id '%s'", id);
-    return NULL;
-}
-#endif
 
 #endif
diff --git a/scsi/Makefile.objs b/scsi/Makefile.objs
index 4d25e47..bb8789c 100644
--- a/scsi/Makefile.objs
+++ b/scsi/Makefile.objs
@@ -1,3 +1,4 @@
 block-obj-y += utils.o
 
 block-obj-$(CONFIG_LINUX) += pr-manager.o pr-manager-helper.o
+block-obj-$(call lnot,$(CONFIG_LINUX)) += pr-manager-stub.o
diff --git a/scsi/pr-manager-stub.c b/scsi/pr-manager-stub.c
new file mode 100644
index 0000000..632f17c
--- /dev/null
+++ b/scsi/pr-manager-stub.c
@@ -0,0 +1,24 @@
+/*
+ * Persistent reservation manager - stub for non-Linux platforms
+ *
+ * Copyright (c) 2018 Red Hat, Inc.
+ *
+ * Author: Paolo Bonzini <pbonzini@redhat.com>
+ *
+ * This code is licensed under the LGPL.
+ *
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "scsi/pr-manager.h"
+#include "trace.h"
+#include "qapi/qapi-types-block.h"
+#include "qapi/qapi-commands-block.h"
+
+PRManager *pr_manager_lookup(const char *id, Error **errp)
+{
+    /* The classes do not exist at all!  */
+    error_setg(errp, "No persistent reservation manager with id '%s'", id);
+        return NULL;
+}
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 5/6] pr-manager: add query-pr-managers QMP command
  2018-06-28 19:57 [Qemu-devel] [PATCH v2 0/6] pr-manager/qemu-pr-helper patches for QEMU 3.0 Paolo Bonzini
                   ` (3 preceding siblings ...)
  2018-06-28 19:57 ` [Qemu-devel] [PATCH 4/6] pr-manager: put stubs in .c file Paolo Bonzini
@ 2018-06-28 19:57 ` Paolo Bonzini
  2018-06-28 19:57 ` [Qemu-devel] [PATCH 6/6] pr-manager-helper: report event on connection/disconnection Paolo Bonzini
  5 siblings, 0 replies; 9+ messages in thread
From: Paolo Bonzini @ 2018-06-28 19:57 UTC (permalink / raw)
  To: qemu-devel

This command lets you query the connection status of each pr-manager-helper
object.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/scsi/pr-manager.h |  2 ++
 qapi/block.json           | 28 ++++++++++++++++++++++++++++
 scsi/pr-manager-helper.c  | 13 +++++++++++++
 scsi/pr-manager-stub.c    |  6 ++++++
 scsi/pr-manager.c         | 45 +++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 94 insertions(+)

diff --git a/include/scsi/pr-manager.h b/include/scsi/pr-manager.h
index 71971ae..50a77b0 100644
--- a/include/scsi/pr-manager.h
+++ b/include/scsi/pr-manager.h
@@ -33,8 +33,10 @@ typedef struct PRManagerClass {
 
     /* <public> */
     int (*run)(PRManager *pr_mgr, int fd, struct sg_io_hdr *hdr);
+    bool (*is_connected)(PRManager *pr_mgr);
 } PRManagerClass;
 
+bool pr_manager_is_connected(PRManager *pr_mgr);
 BlockAIOCB *pr_manager_execute(PRManager *pr_mgr,
                                AioContext *ctx, int fd,
                                struct sg_io_hdr *hdr,
diff --git a/qapi/block.json b/qapi/block.json
index ca807f1..8765c29 100644
--- a/qapi/block.json
+++ b/qapi/block.json
@@ -78,6 +78,34 @@
   'data': { 'device': 'str', 'name': 'str' } }
 
 ##
+# @PRManagerInfo:
+#
+# Information about a persistent reservation manager
+#
+# @id: the identifier of the persistent reservation manager
+#
+# @connected: true if the persistent reservation manager is connected to
+#             the underlying storage or helper
+#
+# Since: 3.0
+##
+{ 'struct': 'PRManagerInfo',
+  'data': {'id': 'str', 'connected': 'bool'} }
+
+##
+# @query-pr-managers:
+#
+# Returns a list of information about each persistent reservation manager.
+#
+# Returns: a list of @PRManagerInfo for each persistent reservation manager
+#
+# Since: 3.0
+##
+{ 'command': 'query-pr-managers', 'returns': ['PRManagerInfo'],
+  'allow-preconfig': true }
+
+
+##
 # @blockdev-snapshot-internal-sync:
 #
 # Synchronously take an internal snapshot of a block device, when the
diff --git a/scsi/pr-manager-helper.c b/scsi/pr-manager-helper.c
index 0c0fe38..b11481b 100644
--- a/scsi/pr-manager-helper.c
+++ b/scsi/pr-manager-helper.c
@@ -235,6 +235,18 @@ out:
     return ret;
 }
 
+static bool pr_manager_helper_is_connected(PRManager *p)
+{
+    PRManagerHelper *pr_mgr = PR_MANAGER_HELPER(p);
+    bool result;
+
+    qemu_mutex_lock(&pr_mgr->lock);
+    result = (pr_mgr->ioc != NULL);
+    qemu_mutex_unlock(&pr_mgr->lock);
+
+    return result;
+}
+
 static void pr_manager_helper_complete(UserCreatable *uc, Error **errp)
 {
     PRManagerHelper *pr_mgr = PR_MANAGER_HELPER(uc);
@@ -284,6 +296,7 @@ static void pr_manager_helper_class_init(ObjectClass *klass,
                                   &error_abort);
     uc_klass->complete = pr_manager_helper_complete;
     prmgr_klass->run = pr_manager_helper_run;
+    prmgr_klass->is_connected = pr_manager_helper_is_connected;
 }
 
 static const TypeInfo pr_manager_helper_info = {
diff --git a/scsi/pr-manager-stub.c b/scsi/pr-manager-stub.c
index 632f17c..738b6d7 100644
--- a/scsi/pr-manager-stub.c
+++ b/scsi/pr-manager-stub.c
@@ -22,3 +22,9 @@ PRManager *pr_manager_lookup(const char *id, Error **errp)
     error_setg(errp, "No persistent reservation manager with id '%s'", id);
         return NULL;
 }
+
+
+PRManagerInfoList *qmp_query_pr_managers(Error **errp)
+{
+    return NULL;
+}
diff --git a/scsi/pr-manager.c b/scsi/pr-manager.c
index 87c45db..2a8f300 100644
--- a/scsi/pr-manager.c
+++ b/scsi/pr-manager.c
@@ -17,6 +17,10 @@
 #include "block/thread-pool.h"
 #include "scsi/pr-manager.h"
 #include "trace.h"
+#include "qapi/qapi-types-block.h"
+#include "qapi/qapi-commands-block.h"
+
+#define PR_MANAGER_PATH     "/objects"
 
 typedef struct PRManagerData {
     PRManager *pr_mgr;
@@ -64,6 +68,14 @@ BlockAIOCB *pr_manager_execute(PRManager *pr_mgr,
                                   data, complete, opaque);
 }
 
+bool pr_manager_is_connected(PRManager *pr_mgr)
+{
+    PRManagerClass *pr_mgr_class =
+        PR_MANAGER_GET_CLASS(pr_mgr);
+
+    return !pr_mgr_class->is_connected || pr_mgr_class->is_connected(pr_mgr);
+}
+
 static const TypeInfo pr_manager_info = {
     .parent = TYPE_OBJECT,
     .name = TYPE_PR_MANAGER,
@@ -105,5 +117,38 @@ pr_manager_register_types(void)
     type_register_static(&pr_manager_info);
 }
 
+static int query_one_pr_manager(Object *object, void *opaque)
+{
+    PRManagerInfoList ***prev = opaque;
+    PRManagerInfoList *elem;
+    PRManagerInfo *info;
+    PRManager *pr_mgr;
+
+    pr_mgr = (PRManager *)object_dynamic_cast(object, TYPE_PR_MANAGER);
+    if (!pr_mgr) {
+        return 0;
+    }
+
+    elem = g_new0(PRManagerInfoList, 1);
+    info = g_new0(PRManagerInfo, 1);
+    info->id = object_get_canonical_path_component(object);
+    info->connected = pr_manager_is_connected(pr_mgr);
+    elem->value = info;
+    elem->next = NULL;
+
+    **prev = elem;
+    *prev = &elem->next;
+    return 0;
+}
+
+PRManagerInfoList *qmp_query_pr_managers(Error **errp)
+{
+    PRManagerInfoList *head = NULL;
+    PRManagerInfoList **prev = &head;
+    Object *container = container_get(object_get_root(), PR_MANAGER_PATH);
+
+    object_child_foreach(container, query_one_pr_manager, &prev);
+    return head;
+}
 
 type_init(pr_manager_register_types);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 6/6] pr-manager-helper: report event on connection/disconnection
  2018-06-28 19:57 [Qemu-devel] [PATCH v2 0/6] pr-manager/qemu-pr-helper patches for QEMU 3.0 Paolo Bonzini
                   ` (4 preceding siblings ...)
  2018-06-28 19:57 ` [Qemu-devel] [PATCH 5/6] pr-manager: add query-pr-managers QMP command Paolo Bonzini
@ 2018-06-28 19:57 ` Paolo Bonzini
  2018-06-28 20:24   ` Eric Blake
  5 siblings, 1 reply; 9+ messages in thread
From: Paolo Bonzini @ 2018-06-28 19:57 UTC (permalink / raw)
  To: qemu-devel

Let management know if there were any problems communicating with
qemu-pr-helper.  The event is edge-triggered, and is sent every time
the connection status of the pr-manager-helper object changes.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qapi/block.json          | 24 ++++++++++++++++++++++++
 scsi/pr-manager-helper.c | 14 ++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/qapi/block.json b/qapi/block.json
index 8765c29..11f01f2 100644
--- a/qapi/block.json
+++ b/qapi/block.json
@@ -359,6 +359,30 @@
   'data': { 'device': 'str', 'id': 'str', 'tray-open': 'bool' } }
 
 ##
+# @PR_MANAGER_STATUS_CHANGED:
+#
+# Emitted whenever the connected status of a persistent reservation
+# manager changes.
+#
+# @id: The id of the PR manager object
+#
+# @connected: true if the PR manager is connected to a backend
+#
+# Since: 3.0
+#
+# Example:
+#
+# <- { "event": "PR_MANAGER_STATUS_CHANGED",
+#      "data": { "id": "pr-helper0",
+#                "connected": true
+#      },
+#      "timestamp": { "seconds": 1519840375, "microseconds": 450486 } }
+#
+##
+{ 'event': 'PR_MANAGER_STATUS_CHANGED',
+  'data': { 'id': 'str', 'connected': 'bool' } }
+
+##
 # @QuorumOpType:
 #
 # An enumeration of the quorum operation types
diff --git a/scsi/pr-manager-helper.c b/scsi/pr-manager-helper.c
index b11481b..519a296 100644
--- a/scsi/pr-manager-helper.c
+++ b/scsi/pr-manager-helper.c
@@ -17,6 +17,7 @@
 #include "io/channel.h"
 #include "io/channel-socket.h"
 #include "pr-helper.h"
+#include "qapi/qapi-events-block.h"
 
 #include <scsi/sg.h>
 
@@ -38,6 +39,16 @@ typedef struct PRManagerHelper {
     QIOChannel *ioc;
 } PRManagerHelper;
 
+static void pr_manager_send_status_changed_event(PRManagerHelper *pr_mgr)
+{
+    char *id = object_get_canonical_path_component(OBJECT(pr_mgr));
+
+    if (id) {
+        qapi_event_send_pr_manager_status_changed(id, !!pr_mgr->ioc,
+                                                  &error_abort);
+    }
+}
+
 /* Called with lock held.  */
 static int pr_manager_helper_read(PRManagerHelper *pr_mgr,
                                   void *buf, int sz, Error **errp)
@@ -47,6 +58,7 @@ static int pr_manager_helper_read(PRManagerHelper *pr_mgr,
     if (r < 0) {
         object_unref(OBJECT(pr_mgr->ioc));
         pr_mgr->ioc = NULL;
+        pr_manager_send_status_changed_event(pr_mgr);
         return -EINVAL;
     }
 
@@ -72,6 +84,7 @@ static int pr_manager_helper_write(PRManagerHelper *pr_mgr,
             assert(n_written != QIO_CHANNEL_ERR_BLOCK);
             object_unref(OBJECT(pr_mgr->ioc));
             pr_mgr->ioc = NULL;
+            pr_manager_send_status_changed_event(pr_mgr);
             return n_written < 0 ? -EINVAL : 0;
         }
 
@@ -127,6 +140,7 @@ static int pr_manager_helper_initialize(PRManagerHelper *pr_mgr,
         goto out_close;
     }
 
+    pr_manager_send_status_changed_event(pr_mgr);
     return 0;
 
 out_close:
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH 6/6] pr-manager-helper: report event on connection/disconnection
  2018-06-28 19:57 ` [Qemu-devel] [PATCH 6/6] pr-manager-helper: report event on connection/disconnection Paolo Bonzini
@ 2018-06-28 20:24   ` Eric Blake
  2018-06-29 10:15     ` Paolo Bonzini
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Blake @ 2018-06-28 20:24 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 06/28/2018 02:57 PM, Paolo Bonzini wrote:
> Let management know if there were any problems communicating with
> qemu-pr-helper.  The event is edge-triggered, and is sent every time
> the connection status of the pr-manager-helper object changes.

Is this something that guest actions can intentionally trigger, and thus 
cause a DoS attack by flooding the management app with events faster 
than they can process?  If so, this event should use rate-limiting.

> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   qapi/block.json          | 24 ++++++++++++++++++++++++
>   scsi/pr-manager-helper.c | 14 ++++++++++++++
>   2 files changed, 38 insertions(+)

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

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

* Re: [Qemu-devel] [PATCH 6/6] pr-manager-helper: report event on connection/disconnection
  2018-06-28 20:24   ` Eric Blake
@ 2018-06-29 10:15     ` Paolo Bonzini
  0 siblings, 0 replies; 9+ messages in thread
From: Paolo Bonzini @ 2018-06-29 10:15 UTC (permalink / raw)
  To: Eric Blake, qemu-devel

On 28/06/2018 22:24, Eric Blake wrote:
> On 06/28/2018 02:57 PM, Paolo Bonzini wrote:
>> Let management know if there were any problems communicating with
>> qemu-pr-helper.  The event is edge-triggered, and is sent every time
>> the connection status of the pr-manager-helper object changes.
> 
> Is this something that guest actions can intentionally trigger, and thus
> cause a DoS attack by flooding the management app with events faster
> than they can process?

No, unless they find a way to crash qemu-pr-helper and libvirt
immediately restarts it.  If anything libvirt could throttle the restart
of the process, or ultimately not restart it at all, but I don't think
it's necessary.

Paolo

>  If so, this event should use rate-limiting.
> 
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>   qapi/block.json          | 24 ++++++++++++++++++++++++
>>   scsi/pr-manager-helper.c | 14 ++++++++++++++
>>   2 files changed, 38 insertions(+)
> 

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

end of thread, other threads:[~2018-06-29 10:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-28 19:57 [Qemu-devel] [PATCH v2 0/6] pr-manager/qemu-pr-helper patches for QEMU 3.0 Paolo Bonzini
2018-06-28 19:57 ` [Qemu-devel] [PATCH 1/6] pr-helper: fix --socket-path default in help Paolo Bonzini
2018-06-28 19:57 ` [Qemu-devel] [PATCH 2/6] pr-helper: fix assertion failure on failed multipath PERSISTENT RESERVE IN Paolo Bonzini
2018-06-28 19:57 ` [Qemu-devel] [PATCH 3/6] pr-manager-helper: avoid SIGSEGV when writing to the socket fail Paolo Bonzini
2018-06-28 19:57 ` [Qemu-devel] [PATCH 4/6] pr-manager: put stubs in .c file Paolo Bonzini
2018-06-28 19:57 ` [Qemu-devel] [PATCH 5/6] pr-manager: add query-pr-managers QMP command Paolo Bonzini
2018-06-28 19:57 ` [Qemu-devel] [PATCH 6/6] pr-manager-helper: report event on connection/disconnection Paolo Bonzini
2018-06-28 20:24   ` Eric Blake
2018-06-29 10:15     ` Paolo Bonzini

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.