From: Kevin Dewald <kevin@simpleble.org>
To: linux-bluetooth@vger.kernel.org
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
Kevin Dewald <kevin@simpleble.org>
Subject: [PATCH BlueZ 0/2] adapter: Fix Discovering staying true when stopping fails
Date: Tue, 27 Oct 2026 10:19:21 -0700 [thread overview]
Message-ID: <20261027171923.82919-1-kevin@simpleble.org> (raw)
When the Stop Discovery bluetoothd sends for the last discovery client
fails, stop_discovery_complete() removes the client but leaves
Discovering true. The next StartDiscovery with the same filter then
returns success without starting a discovery, as reported in
bluez/bluez#2547 and, before it, #807.
The first patch treats Rejected as stopped: the kernel returns it when
the discovery already ended, or another mgmt client stopped it, just
before the command was processed. The second clears Discovering when
the kernel reports the discovery as stopped with no client left, which
covers the other failures, such as the scan disable timing out. That
needs the kernel to leave the stopping state after a failed stop, which
"Bluetooth: MGMT: Fix discovery stuck after a failed Stop Discovery",
posted separately, does.
I reproduced both with functional tests that hold the emulated
controller by stopping btvirt with SIGSTOP. In the first, a second mgmt
client stops the discovery before bluetoothd does, so the kernel
rejects bluetoothd's stop; in the second, the controller stays held
until the kernel times out the scan disable. Without its patch, the
first fails with InProgress from StopDiscovery and the second with
Discovering staying true (3 of 3 runs each); with them both pass (5 of
5 each, the second on bluetooth-next with the kernel fix). I can send
the tests as well if you want them.
make check passes, and so do the functional tests that use discovery.
Kevin Dewald (2):
adapter: Fix Discovering staying true after a rejected stop
adapter: Fix Discovering staying true after a failed stop
src/adapter.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
base-commit: b0bf49270d445da0852851f393cd67a0a1e5f05e
--
2.54.0 (Apple Git-157)
next reply other threads:[~2026-10-27 17:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 17:19 Kevin Dewald [this message]
2026-10-27 17:19 ` [PATCH BlueZ 1/2] adapter: Fix Discovering staying true after a rejected stop Kevin Dewald
2026-10-27 20:29 ` adapter: Fix Discovering staying true when stopping fails bluez.test.bot
2026-10-27 17:19 ` [PATCH BlueZ 2/2] adapter: Fix Discovering staying true after a failed stop Kevin Dewald
2026-10-28 19:50 ` [PATCH BlueZ 0/2] adapter: Fix Discovering staying true when stopping fails patchwork-bot+bluetooth
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=20261027171923.82919-1-kevin@simpleble.org \
--to=kevin@simpleble.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox