Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754302AbbDNI1r (ORCPT ); Tue, 14 Apr 2015 04:27:47 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:44388 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752329AbbDNI1l (ORCPT ); Tue, 14 Apr 2015 04:27:41 -0400 X-AuditID: cbfec7f5-b7f1e6d00000617c-73-552ccecc21a2 Message-id: <552CCF79.4050903@samsung.com> Date: Tue, 14 Apr 2015 10:27:37 +0200 From: Lukasz Skalski User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-version: 1.0 To: Sergei Zviagintsev Cc: gregkh@linuxfoundation.org, daniel@zonque.org, dh.herrmann@gmail.com, tixxdz@opendz.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kdbus: do not append the same connection to the queue twice References: <1428934446-32364-1-git-send-email-l.skalski@samsung.com> <20150413214834.GE8500@localhost.localdomain> In-reply-to: <20150413214834.GE8500@localhost.localdomain> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDLMWRmVeSWpSXmKPExsVy+t/xK7pnzumEGpxp1rJo+vuKxWJe61EW i+bF69ksLu+aw2Zx49Q8RouVv7ezObB57Jx1l91j/9w17B4rfh1h93jScozd4/MmOY/tu5ez BLBFcdmkpOZklqUW6dslcGU865rCXjCTv6Jp6hSWBsZX3F2MnBwSAiYSpx40s0LYYhIX7q1n 62Lk4hASWMoo8WDnGWYI5yOjxOwrU5lAqngFtCQmz3/LAmKzCKhK7Nj1kh3EZhPQkXhy8j5Y jahAhMT8Y6+ZIeoFJX5MvgdWLyKgIXHq71uwbcwC1RJzD/0HqxcWCJC43tMCNkdIoFRi9vYF YDangJXE/VUnGLsYOYDq9STuX9SCaJWX2LzmLfMERoFZSDbMQqiahaRqASPzKkbR1NLkguKk 9FwjveLE3OLSvHS95PzcTYyQEP+6g3HpMatDjAIcjEo8vB/ydUKFWBPLiitzDzFKcDArifAG HQYK8aYkVlalFuXHF5XmpBYfYmTi4JRqYNQt1RWa/bhY/FXijo93ZB041wtWbPgss7Si7bJV RtdWm082uVxftN2nv122JWZ/j6Tlmn9zy4y85J66bAnburmcS+HIdOF368vu3OjZu+OSM+fl CVsnH883P98eWrHELHvDz5qfu3h5BB6eu+OiGVbN3nCP4+X21Ipj/5cyXyyd/vn+pvg++59K LMUZiYZazEXFiQCnBT7+TwIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2123 Lines: 74 On 04/13/2015 11:48 PM, Sergei Zviagintsev wrote: > Hi Lukasz, > Hi, > On Mon, Apr 13, 2015 at 04:14:06PM +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..a546a84 100644 >> --- a/ipc/kdbus/names.c >> +++ b/ipc/kdbus/names.c >> @@ -353,10 +353,23 @@ 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 here? > Right. I've just sent v2. Thanks! >> + } >> + } >> + >> + 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 >> >> -- >> 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/ > Cheers, -- Lukasz Skalski Samsung R&D Institute Poland Samsung Electronics l.skalski@samsung.com -- 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/