Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp245899ybh; Tue, 17 Mar 2020 22:26:17 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvP/4Zb4kaePWIfFbgSV791sglosh/tHBT2Jz1O9P/1FANtRDf9+T1HgY9cQyUwqmC3GXs9 X-Received: by 2002:a9d:264a:: with SMTP id a68mr2470476otb.176.1584509177107; Tue, 17 Mar 2020 22:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584509177; cv=none; d=google.com; s=arc-20160816; b=zlCqq+kbxL4/kllKHiV2LTQCimYiB3FpO1nmIPM7FbzNHlYUOXGfW1oSHkPoq5w3lq LgbMQ6Nk69ZqrsAsP06A9HosTGVEh3ordmPawYI+tbDOMxSqIyrSHTp09CAOOu8ov8kt KZUI9N/hwlpmnSKR4yLBtNgQXlsgyh4F3hNQFP2wQjuP21MESWF6d+lnwXsLiGLsVpqb GBZQIdsb3gtSU8iyu7E7lZ6X3aAEnrmF6apFY/QWjhYLY61sw8BEAv+fQlsf502k4z6n VFJRFC0jRYgHZ6V3jxMUwinZfbJvpJceuMy1QTpNADlmRbCvkUMqP1xplSO2nP7p4SqZ leCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=qYDjMj/mYnbONHuVPOpHka9NPIamhJZSkVfXUlu3wVI=; b=XO6n4G9DWJd31sXBsDI4/qcZpURKXB+bB9aHNeZdgx5fzPMz6DQznrIoAuFlDYvQmF 79BlEMO9SmYlOSWUBhYhSI+xom8LpYVCbW8lSm+FiqNIiaNicsNK7mBLFykT3V46Qwlz J+gf28qTCyYXej9FtyZbx0NOr2R0gK31oYQbRndDIBPsPwYXU0BTQpt/qurNZZfOEXxn It0WqXCbbRKPFUUPV6K0NW84K4bCCWJ8RK7X4ca2jBNRbPLJwji+boU8hRq+u6JXnCmc ENxFx/aCP3faaCDAXJkhv7SIdUf/AwmbwAR8QhK16Q+2ivWMCfc0M2ZbrUakzkYa7oAS Nxiw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d20si2792071oti.311.2020.03.17.22.25.47; Tue, 17 Mar 2020 22:26:17 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726950AbgCRFZb convert rfc822-to-8bit (ORCPT + 99 others); Wed, 18 Mar 2020 01:25:31 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:56511 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726478AbgCRFZb (ORCPT ); Wed, 18 Mar 2020 01:25:31 -0400 Received: from [192.168.1.91] (p4FEFC5A7.dip0.t-ipconnect.de [79.239.197.167]) by mail.holtmann.org (Postfix) with ESMTPSA id 1991ECECF0; Wed, 18 Mar 2020 06:35:00 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Subject: Re: [Bluez PATCH v1] input: disconnect intr channel before ctrl channel From: Marcel Holtmann In-Reply-To: Date: Wed, 18 Mar 2020 06:24:59 +0100 Cc: Archie Pusaka , linux-bluetooth Content-Transfer-Encoding: 8BIT Message-Id: <14E46BF4-0688-4A0B-AE84-46C4426C5E9A@holtmann.org> References: <20200316123914.Bluez.v1.1.I2c83372de789a015c1ee506690bb795ee0b0b0d9@changeid> To: Luiz Augusto von Dentz X-Mailer: Apple Mail (2.3608.60.0.2.5) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Luiz, >> Luckily you asked, because I found out that actually the patch didn't >> wait for the disconnection response for any case. It does delay the >> disconnection of the ctrl channel slightly though, but that doesn't >> guarantee a proper order of disconnection. Therefore, as of now, this >> patch is not fixing anything. >> >> Digging more into this matter, I found out by removing this condition >> (sk->sk_shutdown == SHUTDOWN_MASK) in [1], it makes intr_watch_cb() >> called after truly receiving the interrupt disconnection response. >> However, I haven't checked whether removal of such condition will >> break other things. >> Do you have any suggestions? > > 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. 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. Regards Marcel