All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Lukasz Skalski <l.skalski@samsung.com>
Cc: daniel@zonque.org, dh.herrmann@gmail.com, tixxdz@opendz.org,
	sergei@s15v.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] kdbus: do not append the same connection to the queue twice
Date: Thu, 4 Jun 2015 14:51:28 +0900	[thread overview]
Message-ID: <20150604055128.GA29341@kroah.com> (raw)
In-Reply-To: <1428999893-6062-1-git-send-email-l.skalski@samsung.com>

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

  reply	other threads:[~2015-06-04  5:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-06-04  6:19   ` David Herrmann
2015-06-22 22:53 ` Greg KH
2015-08-04 16:43   ` David Herrmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150604055128.GA29341@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=daniel@zonque.org \
    --cc=dh.herrmann@gmail.com \
    --cc=l.skalski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sergei@s15v.net \
    --cc=tixxdz@opendz.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.