Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp592720ybh; Wed, 18 Mar 2020 05:42:54 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt27ZfVQBKbjBcSN3zPxBislwPexXLcEIf95h9ZlD4vCWwCiwQsIr+GuUFVSIqcXoB9XQK4 X-Received: by 2002:aca:ab4b:: with SMTP id u72mr3093001oie.26.1584535374335; Wed, 18 Mar 2020 05:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584535374; cv=none; d=google.com; s=arc-20160816; b=CdqJUvciQ9wqVdHT1qJmM3mLq7dxsyZkEdeNoJxIuYhZ46nMmrzfvKK60V95clTI8w ytMn/YihWf2TBEGhhMRqQWdxnO74SS7dl1zmLxSBYzRjd/maCFn4rvWx4B4PoJUpS2/K Qla4p2H6nZGKKqyL+C3vwRtPS5DnGsvkgsB25jInFUVahS37Ktkzii6L/lr+E8FU4BDO itwkhZbzHfJ0m2NvXjeKxcBtobLaBPLjEgeBHgELD7PPRy6MGOTTAumEYMOZcmjtDH4p C34gaq646xX2WguExatsxmwqtjryDXaq8+D744WsBHHZ0QlFmqU/GPBj6Rv8yO4E3qvB 0Tfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=QyuIk5ru+vxMQ+luek8J7yWtiEyJHc8Og658+Ky+1FU=; b=taLoJpQ2QpMsnPvoBzByBpL+lhO8jIDTMu42XHyEPpdSTRd1zWIBy6S5JNbWNm9xTa Ied9lKokJ5ghUZbN/O6uwuNYwpZJZjfQ9aSk+r0UFvxgMf/28ZD9vHjSPPAIVJ7R+n1x ksgXZ/NX501Gk9S8lnpYpmuaN3+5bwYhGk268AErr1QoUdh96Dg32mkc4cNuPPfbwOYB LOxbQUMKIwD5ngZMnDBP7jD/9wT4YBedf6s0IEaH+EHqyhNFN7IZKo3CnCq4c22qokya oegTQebm07I2LN71oB20NAmR1nu7U8kpC+/5+Q28H2P+gy5MtGMjGy6tvRAyH3fbHcjA tJNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jmMiRfPr; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s200si3131396oie.188.2020.03.18.05.42.26; Wed, 18 Mar 2020 05:42:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jmMiRfPr; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726872AbgCRMlx (ORCPT + 99 others); Wed, 18 Mar 2020 08:41:53 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:52873 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726892AbgCRMlw (ORCPT ); Wed, 18 Mar 2020 08:41:52 -0400 Received: by mail-wm1-f66.google.com with SMTP id 11so3174772wmo.2 for ; Wed, 18 Mar 2020 05:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QyuIk5ru+vxMQ+luek8J7yWtiEyJHc8Og658+Ky+1FU=; b=jmMiRfPrn0mWadSDoBmcsi2cKioTKejLUjsdXCnYjD60bCmPM8D1p4zhyk1PFnrYLz enBPJ5VYHVx2JQ74Uptgt9zxdbWxhmi581vkG12yHAEAdcdOZExWhOOt3AVvwsxA8RhB tOs3A5HsPEfmVzrb9Oe4XFQ2HeBhGLAnZXf5/1muLQtzVjdJjpe+z74aZhH702T4wN1v cV03bQh0x3Qvq53r6+4+wqLEzdICsx4RgH/qMYfUmIsFhA6pPQ34VJgmz0avJK6QDkTo IPywcJ0YACrIpiIWEzg+2J3wnie1QZzZD0wpeynf0SNtpV2u93nfRR7zFfX+MALf6441 hXOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QyuIk5ru+vxMQ+luek8J7yWtiEyJHc8Og658+Ky+1FU=; b=MuwG3kmo1JfrqWefR0uujWHJ+gWPoqyrnSI0Z7RgXsvdXDzIm5tlqU0iasNm1zk4EZ ka/UFDk7U7xJTwg1EBgU/0+LpHLMDW9LC9I4oA5wVvJKW7fq0Vxwc5kbq+ivkKPKfBW7 yBe37EGqDm7LntFWGV3Kp6icQEeoxFohr+Oo623ENHLj0usoHDFYMq1ZSOqxVKOlMq9F Wat0YFwVAK3xsAcbPdxsKtMgtAss1fYXFjV5pYSU0AJyZBWHj0P3cO+Avp2AujRRwaPQ u+TsT9I/gZ0aUICy9XpBPYi9Cooqakep++CrZtQY9Xa6WLOc3wfBaNPRXhsoMdNLzhRW YPOQ== X-Gm-Message-State: ANhLgQ1J1pnbuxThcVugvviG8E7VfQXfcAwkyFsxQTc5uUKmvYZy4cMj 1JcQTJGvoktK0We1teciCaCKjhorV+inFwJrAezIhg== X-Received: by 2002:a1c:456:: with SMTP id 83mr5135955wme.54.1584535310089; Wed, 18 Mar 2020 05:41:50 -0700 (PDT) MIME-Version: 1.0 References: <20200316123914.Bluez.v1.1.I2c83372de789a015c1ee506690bb795ee0b0b0d9@changeid> <14E46BF4-0688-4A0B-AE84-46C4426C5E9A@holtmann.org> In-Reply-To: <14E46BF4-0688-4A0B-AE84-46C4426C5E9A@holtmann.org> From: Archie Pusaka Date: Wed, 18 Mar 2020 20:41:38 +0800 Message-ID: Subject: Re: [Bluez PATCH v1] input: disconnect intr channel before ctrl channel To: Marcel Holtmann Cc: Luiz Augusto von Dentz , linux-bluetooth Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org > > I see, we shutdown the socket immediately since the socket API itself > > don't seem to have a concept of disconnect syscall not sure if other > > values could be passed to shutdown second parameter to indicate we > > want to actually wait it to be disconnected. I don't think the second parameter matters, I tried every possible valid values and intr_watch_cb is still called without waiting for the response. > > in a blocking synchronous system call world we have SO_LINGER for that. In the world of asynchronous IO handling (what we do), we need to check what is the right way of handling this. > I spot this piece of code [1] which utilizes getsockopt to query socket connection information from the kernel space to the user space. We can use a similar method to query whether (sk->sk_state == BT_CLOSED), which is only true when we get the response. What do you think? [1] https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/tree/net/bluetooth/l2cap_sock.c#n476