* [PATCH v2] kdbus: do not append the same connection to the queue twice
@ 2015-04-14 8:24 Lukasz Skalski
2015-06-04 5:51 ` Greg KH
2015-06-22 22:53 ` Greg KH
0 siblings, 2 replies; 5+ messages in thread
From: Lukasz Skalski @ 2015-04-14 8:24 UTC (permalink / raw)
To: gregkh, daniel, dh.herrmann, tixxdz; +Cc: sergei, linux-kernel, Lukasz Skalski
As it was discussed on systemd ML [1], the same connection should be
queued up only once for a given well-known name.
[1] http://lists.freedesktop.org/archives/systemd-devel/2015-April/030494.html
Signed-off-by: Lukasz Skalski <l.skalski@samsung.com>
diff --git a/ipc/kdbus/names.c b/ipc/kdbus/names.c
index 657008e..df99e4d 100644
--- a/ipc/kdbus/names.c
+++ b/ipc/kdbus/names.c
@@ -353,10 +353,24 @@ int kdbus_name_acquire(struct kdbus_name_registry *reg,
} else if (flags & KDBUS_NAME_QUEUE) {
/* add to waiting-queue of the name */
- ret = kdbus_name_pending_new(e, conn, flags);
- if (ret >= 0)
- /* tell the caller that we queued it */
- rflags |= KDBUS_NAME_IN_QUEUE;
+ struct kdbus_name_pending *p;
+ bool in_queue = false;
+
+ list_for_each_entry(p, &e->queue, name_entry) {
+ if (p->conn == conn) {
+ /* connection is already queued */
+ rflags |= KDBUS_NAME_IN_QUEUE;
+ in_queue = true;
+ break;
+ }
+ }
+
+ if (!in_queue) {
+ ret = kdbus_name_pending_new(e, conn, flags);
+ if (ret >= 0)
+ /* tell the caller that we queued it */
+ rflags |= KDBUS_NAME_IN_QUEUE;
+ }
} else {
/* the name is busy, return a failure */
ret = -EEXIST;
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] kdbus: do not append the same connection to the queue twice
2015-04-14 8:24 [PATCH v2] kdbus: do not append the same connection to the queue twice Lukasz Skalski
@ 2015-06-04 5:51 ` Greg KH
2015-06-04 6:19 ` David Herrmann
2015-06-22 22:53 ` Greg KH
1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2015-06-04 5:51 UTC (permalink / raw)
To: Lukasz Skalski; +Cc: daniel, dh.herrmann, tixxdz, sergei, linux-kernel
On Tue, Apr 14, 2015 at 10:24:53AM +0200, Lukasz Skalski wrote:
> As it was discussed on systemd ML [1], the same connection should be
> queued up only once for a given well-known name.
>
> [1] http://lists.freedesktop.org/archives/systemd-devel/2015-April/030494.html
>
> Signed-off-by: Lukasz Skalski <l.skalski@samsung.com>
>
> diff --git a/ipc/kdbus/names.c b/ipc/kdbus/names.c
> index 657008e..df99e4d 100644
> --- a/ipc/kdbus/names.c
> +++ b/ipc/kdbus/names.c
> @@ -353,10 +353,24 @@ int kdbus_name_acquire(struct kdbus_name_registry *reg,
> } else if (flags & KDBUS_NAME_QUEUE) {
> /* add to waiting-queue of the name */
>
> - ret = kdbus_name_pending_new(e, conn, flags);
> - if (ret >= 0)
> - /* tell the caller that we queued it */
> - rflags |= KDBUS_NAME_IN_QUEUE;
> + struct kdbus_name_pending *p;
> + bool in_queue = false;
> +
> + list_for_each_entry(p, &e->queue, name_entry) {
> + if (p->conn == conn) {
> + /* connection is already queued */
> + rflags |= KDBUS_NAME_IN_QUEUE;
> + in_queue = true;
> + break;
> + }
> + }
> +
> + if (!in_queue) {
> + ret = kdbus_name_pending_new(e, conn, flags);
> + if (ret >= 0)
> + /* tell the caller that we queued it */
> + rflags |= KDBUS_NAME_IN_QUEUE;
> + }
> } else {
> /* the name is busy, return a failure */
> ret = -EEXIST;
David, did you miss this patch in your last round of kdbus updates?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] kdbus: do not append the same connection to the queue twice
2015-06-04 5:51 ` Greg KH
@ 2015-06-04 6:19 ` David Herrmann
0 siblings, 0 replies; 5+ messages in thread
From: David Herrmann @ 2015-06-04 6:19 UTC (permalink / raw)
To: Greg KH
Cc: Lukasz Skalski, Daniel Mack, Djalal Harouni, Sergei Zviagintsev,
linux-kernel
Hi
On Thu, Jun 4, 2015 at 7:51 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Tue, Apr 14, 2015 at 10:24:53AM +0200, Lukasz Skalski wrote:
>> As it was discussed on systemd ML [1], the same connection should be
>> queued up only once for a given well-known name.
>>
>> [1] http://lists.freedesktop.org/archives/systemd-devel/2015-April/030494.html
>>
>> Signed-off-by: Lukasz Skalski <l.skalski@samsung.com>
>>
>> diff --git a/ipc/kdbus/names.c b/ipc/kdbus/names.c
>> index 657008e..df99e4d 100644
>> --- a/ipc/kdbus/names.c
>> +++ b/ipc/kdbus/names.c
>> @@ -353,10 +353,24 @@ int kdbus_name_acquire(struct kdbus_name_registry *reg,
>> } else if (flags & KDBUS_NAME_QUEUE) {
>> /* add to waiting-queue of the name */
>>
>> - ret = kdbus_name_pending_new(e, conn, flags);
>> - if (ret >= 0)
>> - /* tell the caller that we queued it */
>> - rflags |= KDBUS_NAME_IN_QUEUE;
>> + struct kdbus_name_pending *p;
>> + bool in_queue = false;
>> +
>> + list_for_each_entry(p, &e->queue, name_entry) {
>> + if (p->conn == conn) {
>> + /* connection is already queued */
>> + rflags |= KDBUS_NAME_IN_QUEUE;
>> + in_queue = true;
>> + break;
>> + }
>> + }
>> +
>> + if (!in_queue) {
>> + ret = kdbus_name_pending_new(e, conn, flags);
>> + if (ret >= 0)
>> + /* tell the caller that we queued it */
>> + rflags |= KDBUS_NAME_IN_QUEUE;
>> + }
>> } else {
>> /* the name is busy, return a failure */
>> ret = -EEXIST;
>
> David, did you miss this patch in your last round of kdbus updates?
I already talked to Lukasz off-list. There are some more changes
required, they'll be included in round #2.
Thanks
David
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] kdbus: do not append the same connection to the queue twice
2015-04-14 8:24 [PATCH v2] kdbus: do not append the same connection to the queue twice Lukasz Skalski
2015-06-04 5:51 ` Greg KH
@ 2015-06-22 22:53 ` Greg KH
2015-08-04 16:43 ` David Herrmann
1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2015-06-22 22:53 UTC (permalink / raw)
To: Lukasz Skalski; +Cc: daniel, dh.herrmann, tixxdz, sergei, linux-kernel
On Tue, Apr 14, 2015 at 10:24:53AM +0200, Lukasz Skalski wrote:
> As it was discussed on systemd ML [1], the same connection should be
> queued up only once for a given well-known name.
>
> [1] http://lists.freedesktop.org/archives/systemd-devel/2015-April/030494.html
>
> Signed-off-by: Lukasz Skalski <l.skalski@samsung.com>
>
> diff --git a/ipc/kdbus/names.c b/ipc/kdbus/names.c
> index 657008e..df99e4d 100644
> --- a/ipc/kdbus/names.c
> +++ b/ipc/kdbus/names.c
> @@ -353,10 +353,24 @@ int kdbus_name_acquire(struct kdbus_name_registry *reg,
> } else if (flags & KDBUS_NAME_QUEUE) {
> /* add to waiting-queue of the name */
>
> - ret = kdbus_name_pending_new(e, conn, flags);
> - if (ret >= 0)
> - /* tell the caller that we queued it */
> - rflags |= KDBUS_NAME_IN_QUEUE;
> + struct kdbus_name_pending *p;
> + bool in_queue = false;
> +
> + list_for_each_entry(p, &e->queue, name_entry) {
> + if (p->conn == conn) {
> + /* connection is already queued */
> + rflags |= KDBUS_NAME_IN_QUEUE;
> + in_queue = true;
> + break;
> + }
> + }
> +
> + if (!in_queue) {
> + ret = kdbus_name_pending_new(e, conn, flags);
> + if (ret >= 0)
> + /* tell the caller that we queued it */
> + rflags |= KDBUS_NAME_IN_QUEUE;
> + }
> } else {
> /* the name is busy, return a failure */
> ret = -EEXIST;
> --
> 1.9.3
David, what happened with this, should it be applied?
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] kdbus: do not append the same connection to the queue twice
2015-06-22 22:53 ` Greg KH
@ 2015-08-04 16:43 ` David Herrmann
0 siblings, 0 replies; 5+ messages in thread
From: David Herrmann @ 2015-08-04 16:43 UTC (permalink / raw)
To: Greg KH; +Cc: Lukasz Skalski, Daniel Mack, Djalal Harouni, linux-kernel
Hi Lukasz & Greg
On Tue, Jun 23, 2015 at 12:53 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Tue, Apr 14, 2015 at 10:24:53AM +0200, Lukasz Skalski wrote:
>> As it was discussed on systemd ML [1], the same connection should be
>> queued up only once for a given well-known name.
>>
>> [1] http://lists.freedesktop.org/archives/systemd-devel/2015-April/030494.html
>>
>> Signed-off-by: Lukasz Skalski <l.skalski@samsung.com>
>>
>> diff --git a/ipc/kdbus/names.c b/ipc/kdbus/names.c
>> index 657008e..df99e4d 100644
>> --- a/ipc/kdbus/names.c
>> +++ b/ipc/kdbus/names.c
>> @@ -353,10 +353,24 @@ int kdbus_name_acquire(struct kdbus_name_registry *reg,
>> } else if (flags & KDBUS_NAME_QUEUE) {
>> /* add to waiting-queue of the name */
>>
>> - ret = kdbus_name_pending_new(e, conn, flags);
>> - if (ret >= 0)
>> - /* tell the caller that we queued it */
>> - rflags |= KDBUS_NAME_IN_QUEUE;
>> + struct kdbus_name_pending *p;
>> + bool in_queue = false;
>> +
>> + list_for_each_entry(p, &e->queue, name_entry) {
>> + if (p->conn == conn) {
>> + /* connection is already queued */
>> + rflags |= KDBUS_NAME_IN_QUEUE;
>> + in_queue = true;
>> + break;
>> + }
>> + }
>> +
>> + if (!in_queue) {
>> + ret = kdbus_name_pending_new(e, conn, flags);
>> + if (ret >= 0)
>> + /* tell the caller that we queued it */
>> + rflags |= KDBUS_NAME_IN_QUEUE;
>> + }
>> } else {
>> /* the name is busy, return a failure */
>> ret = -EEXIST;
>> --
>> 1.9.3
>
> David, what happened with this, should it be applied?
Sorry for the delay. I finally came around restructuring
name-acquisition so we follow the dbus-space (including the change
from Lukasz here). It's the last thing I had on my TODO list (so also
the last non-trivial patch that is pending).
See here: https://github.com/systemd/kdbus/commit/95a96676295cd633f66822659ec248398259a8fc
I will send it to LKML later/tomorrow.
Thanks, and sorry for the delay!
David
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-08-04 16:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-14 8:24 [PATCH v2] kdbus: do not append the same connection to the queue twice Lukasz Skalski
2015-06-04 5:51 ` Greg KH
2015-06-04 6:19 ` David Herrmann
2015-06-22 22:53 ` Greg KH
2015-08-04 16:43 ` David Herrmann
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.