Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754860AbbHDQnH (ORCPT ); Tue, 4 Aug 2015 12:43:07 -0400 Received: from mail-la0-f43.google.com ([209.85.215.43]:34768 "EHLO mail-la0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752932AbbHDQnG (ORCPT ); Tue, 4 Aug 2015 12:43:06 -0400 MIME-Version: 1.0 In-Reply-To: <20150622225321.GA5702@kroah.com> References: <1428999893-6062-1-git-send-email-l.skalski@samsung.com> <20150622225321.GA5702@kroah.com> Date: Tue, 4 Aug 2015 18:43:03 +0200 Message-ID: Subject: Re: [PATCH v2] kdbus: do not append the same connection to the queue twice From: David Herrmann To: Greg KH Cc: Lukasz Skalski , Daniel Mack , Djalal Harouni , linux-kernel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2594 Lines: 65 Hi Lukasz & Greg On Tue, Jun 23, 2015 at 12:53 AM, Greg KH 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 >> >> 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/