All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bluez PATCH v2] device: Fix device can't be scanned for 5 mins after reboot
@ 2022-01-13  7:46 Archie Pusaka
  2022-01-13  9:30 ` [Bluez,v2] " bluez.test.bot
  0 siblings, 1 reply; 3+ messages in thread
From: Archie Pusaka @ 2022-01-13  7:46 UTC (permalink / raw)
  To: linux-bluetooth, Luiz Augusto von Dentz, Marcel Holtmann
  Cc: CrosBT Upstreaming, Archie Pusaka

From: Archie Pusaka <apusaka@chromium.org>

After the patches which limit the attempts of doing remote name
resolving, there's an issue which prevents BlueZ to RNR new devices
for 5 minutes after reboot. It's caused by failed_time is init to 0,
and is then treated as the timestamp when the device failed RNR.
However, actually there is no failure yet.

This patch fixes it by always allowing RNR when failed_time = 0.
---

Changes in v2:
* Separate the one big if into multiple smaller ifs for clarity

 src/device.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/device.c b/src/device.c
index f2447c478e..6d29eb8966 100644
--- a/src/device.c
+++ b/src/device.c
@@ -4487,12 +4487,24 @@ bool device_is_name_resolve_allowed(struct btd_device *device)
 
 	clock_gettime(CLOCK_MONOTONIC, &now);
 
-	/* If now < failed_time, it means the clock has somehow turned back,
-	 * possibly because of system restart. Allow name request in this case.
+	/* failed_time is empty (0), meaning no prior failure. */
+	if (device->name_resolve_failed_time == 0)
+		return true;
+
+	/* now < failed_time, meaning the clock has somehow turned back,
+	 * possibly because of system restart. Allow just to be safe.
+	 */
+	if (now.tv_sec < device->name_resolve_failed_time)
+		return true;
+
+	/* now >= failed_time + name_request_retry_delay, meaning the
+	 * period of not sending name request is over.
 	 */
-	return now.tv_sec < device->name_resolve_failed_time ||
-		now.tv_sec >= device->name_resolve_failed_time +
-					btd_opts.name_request_retry_delay;
+	if (now.tv_sec >= device->name_resolve_failed_time +
+					btd_opts.name_request_retry_delay)
+		return true;
+
+	return false;
 }
 
 void device_name_resolve_fail(struct btd_device *device)
-- 
2.34.1.575.g55b058a8bb-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [Bluez,v2] device: Fix device can't be scanned for 5 mins after reboot
  2022-01-13  7:46 [Bluez PATCH v2] device: Fix device can't be scanned for 5 mins after reboot Archie Pusaka
@ 2022-01-13  9:30 ` bluez.test.bot
  2022-01-13 21:36   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: bluez.test.bot @ 2022-01-13  9:30 UTC (permalink / raw)
  To: linux-bluetooth, apusaka

[-- Attachment #1: Type: text/plain, Size: 995 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=605104

---Test result---

Test Summary:
CheckPatch                    PASS      1.44 seconds
GitLint                       PASS      0.97 seconds
Prep - Setup ELL              PASS      42.40 seconds
Build - Prep                  PASS      0.70 seconds
Build - Configure             PASS      8.52 seconds
Build - Make                  PASS      1403.75 seconds
Make Check                    PASS      12.08 seconds
Make Check w/Valgrind         PASS      437.97 seconds
Make Distcheck                PASS      232.37 seconds
Build w/ext ELL - Configure   PASS      8.66 seconds
Build w/ext ELL - Make        PASS      1365.55 seconds
Incremental Build with patchesPASS      0.00 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Bluez,v2] device: Fix device can't be scanned for 5 mins after reboot
  2022-01-13  9:30 ` [Bluez,v2] " bluez.test.bot
@ 2022-01-13 21:36   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2022-01-13 21:36 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Archie Pusaka

Hi Archie,

On Thu, Jan 13, 2022 at 6:50 AM <bluez.test.bot@gmail.com> wrote:
>
> This is automated email and please do not reply to this email!
>
> Dear submitter,
>
> Thank you for submitting the patches to the linux bluetooth mailing list.
> This is a CI test results with your patch series:
> PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=605104
>
> ---Test result---
>
> Test Summary:
> CheckPatch                    PASS      1.44 seconds
> GitLint                       PASS      0.97 seconds
> Prep - Setup ELL              PASS      42.40 seconds
> Build - Prep                  PASS      0.70 seconds
> Build - Configure             PASS      8.52 seconds
> Build - Make                  PASS      1403.75 seconds
> Make Check                    PASS      12.08 seconds
> Make Check w/Valgrind         PASS      437.97 seconds
> Make Distcheck                PASS      232.37 seconds
> Build w/ext ELL - Configure   PASS      8.66 seconds
> Build w/ext ELL - Make        PASS      1365.55 seconds
> Incremental Build with patchesPASS      0.00 seconds
>
>
>
> ---
> Regards,
> Linux Bluetooth

Applied, thanks.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-13 21:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13  7:46 [Bluez PATCH v2] device: Fix device can't be scanned for 5 mins after reboot Archie Pusaka
2022-01-13  9:30 ` [Bluez,v2] " bluez.test.bot
2022-01-13 21:36   ` Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.