diff mbox series

[BlueZ,v1] a2dp: Fix removing local cache on restart

Message ID 20250328144406.3122778-1-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,v1] a2dp: Fix removing local cache on restart | expand

Commit Message

Luiz Augusto von Dentz March 28, 2025, 2:44 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Endpoint cache shall only be removed when the device is being removed
not when just because the service is being removed since that is also
done when bluetoothd is being restarted.

Fixes: https://github.com/bluez/bluez/issues/1146
---
 profiles/audio/a2dp.c | 40 ----------------------------------------
 src/device.c          |  1 +
 2 files changed, 1 insertion(+), 40 deletions(-)

Comments

bluez.test.bot@gmail.com March 28, 2025, 4:12 p.m. UTC | #1
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=948097

---Test result---

Test Summary:
CheckPatch                    PENDING   0.19 seconds
GitLint                       PENDING   0.22 seconds
BuildEll                      PASS      20.75 seconds
BluezMake                     PASS      1527.01 seconds
MakeCheck                     FAIL      13.16 seconds
MakeDistcheck                 FAIL      142.30 seconds
CheckValgrind                 FAIL      215.61 seconds
CheckSmatch                   PASS      285.99 seconds
bluezmakeextell               PASS      101.09 seconds
IncrementalBuild              PENDING   0.33 seconds
ScanBuild                     PASS      883.83 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:

./test-driver: line 107: 32299 Aborted                 (core dumped) "$@" > $log_file 2>&1
make[3]: *** [Makefile:11780: test-suite.log] Error 1
make[2]: *** [Makefile:11888: check-TESTS] Error 2
make[1]: *** [Makefile:12317: check-am] Error 2
make: *** [Makefile:12319: check] Error 2
##############################
Test: MakeDistcheck - FAIL
Desc: Run Bluez Make Distcheck
Output:

Package cups was not found in the pkg-config search path.
Perhaps you should add the directory containing `cups.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cups' found
../../test-driver: line 107: 55106 Aborted                 (core dumped) "$@" > $log_file 2>&1
make[4]: *** [Makefile:11780: test-suite.log] Error 1
make[3]: *** [Makefile:11888: check-TESTS] Error 2
make[2]: *** [Makefile:12317: check-am] Error 2
make[1]: *** [Makefile:12319: check] Error 2
make: *** [Makefile:12240: distcheck] Error 1
##############################
Test: CheckValgrind - FAIL
Desc: Run Bluez Make Check with Valgrind
Output:

tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12907:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12907 | int main(int argc, char *argv[])
      |     ^~~~
./test-driver: line 107: 75148 Aborted                 (core dumped) "$@" > $log_file 2>&1
make[3]: *** [Makefile:11780: test-suite.log] Error 1
make[2]: *** [Makefile:11888: check-TESTS] Error 2
make[1]: *** [Makefile:12317: check-am] Error 2
make: *** [Makefile:12319: check] Error 2
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org March 28, 2025, 6 p.m. UTC | #2
Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Fri, 28 Mar 2025 10:44:05 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> Endpoint cache shall only be removed when the device is being removed
> not when just because the service is being removed since that is also
> done when bluetoothd is being restarted.
> 
> Fixes: https://github.com/bluez/bluez/issues/1146
> 
> [...]

Here is the summary with links:
  - [BlueZ,v1] a2dp: Fix removing local cache on restart
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=78aabd896dbe

You are awesome, thank you!
diff mbox series

Patch

diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 81dbbfae39f6..0eac151db29d 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -880,44 +880,6 @@  static void store_remote_seps(struct a2dp_channel *chan)
 	g_key_file_free(key_file);
 }
 
-static void remove_endpoints_cache(struct btd_service *service)
-{
-	struct btd_device *device = btd_service_get_device(service);
-	char filename[PATH_MAX];
-	char dst_addr[18];
-	GKeyFile *key_file;
-	GError *gerr = NULL;
-	char *data;
-	gsize length = 0;
-
-	ba2str(device_get_address(device), dst_addr);
-
-	create_filename(filename, PATH_MAX, "/%s/cache/%s",
-		btd_adapter_get_storage_dir(device_get_adapter(device)),
-		dst_addr);
-
-	key_file = g_key_file_new();
-	if (!g_key_file_load_from_file(key_file, filename, 0, &gerr)) {
-		g_error_free(gerr);
-		g_key_file_free(key_file);
-		return;
-	}
-	g_key_file_remove_group(key_file, "Endpoints", NULL);
-
-	data = g_key_file_to_data(key_file, &length, NULL);
-	if (length > 0) {
-		create_file(filename, 0600);
-		if (!g_file_set_contents(filename, data, length, &gerr)) {
-			error("Unable set contents for %s: (%s)", filename,
-								gerr->message);
-			g_error_free(gerr);
-		}
-	}
-
-	g_free(data);
-	g_key_file_free(key_file);
-}
-
 static void invalidate_remote_cache(struct a2dp_setup *setup,
 						struct avdtp_error *err)
 {
@@ -3390,7 +3352,6 @@  static int a2dp_source_probe(struct btd_service *service)
 static void a2dp_source_remove(struct btd_service *service)
 {
 	source_unregister(service);
-	remove_endpoints_cache(service);
 }
 
 static int a2dp_sink_probe(struct btd_service *service)
@@ -3405,7 +3366,6 @@  static int a2dp_sink_probe(struct btd_service *service)
 static void a2dp_sink_remove(struct btd_service *service)
 {
 	sink_unregister(service);
-	remove_endpoints_cache(service);
 }
 
 static int a2dp_source_connect(struct btd_service *service)
diff --git a/src/device.c b/src/device.c
index 057d116be6fc..b82a905f9995 100644
--- a/src/device.c
+++ b/src/device.c
@@ -4984,6 +4984,7 @@  static void device_remove_stored(struct btd_device *device)
 	}
 	g_key_file_remove_group(key_file, "ServiceRecords", NULL);
 	g_key_file_remove_group(key_file, "Attributes", NULL);
+	g_key_file_remove_group(key_file, "Endpoints", NULL);
 
 	data = g_key_file_to_data(key_file, &length, NULL);
 	if (length > 0) {