forked from pool/elfutils
51 lines
2.0 KiB
Diff
51 lines
2.0 KiB
Diff
|
From 31d6b1fe74ab89138b4d256742997b730dc5cba8 Mon Sep 17 00:00:00 2001
|
||
|
From: "Frank Ch. Eigler" <fche@redhat.com>
|
||
|
Date: Mon, 15 Aug 2022 06:20:10 -0400
|
||
|
Subject: [PATCH] PR29474: debuginfod
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
Previous code sometimes confused debuginfod with concurrent queries
|
||
|
targeting the same RPM. One thread fetching & prefetching, the other
|
||
|
thread misinterpreted the sudden presence of its target file in the
|
||
|
fdcache as a mere unnecessary prefetch duplicate. But if it was the
|
||
|
other thread's target file, previous code would -skip- it completely,
|
||
|
resulting in a 404 error. New code allows the other thread to also
|
||
|
decompress the target file and return it, and still continue to its
|
||
|
own prefetching process for other files.
|
||
|
|
||
|
There's a performance trade-off here. Another option would be for the
|
||
|
other thread to check the fdcache regularly and abort its own
|
||
|
prefetch/fetch/prefetch loop early in case of a sudden target file
|
||
|
hit. That'd save CPU probably but it'd stop prefetching of later
|
||
|
segments of the input archive, which could save future time.
|
||
|
|
||
|
Automated testing is too time/load sensitive to attempt. Confirmed
|
||
|
working with Martin's stress tester.
|
||
|
|
||
|
Reported-By: Martin Liška <mliska@suse.cz>
|
||
|
Signed-Off-By: Frank Ch. Eigler <fche@redhat.com>
|
||
|
---
|
||
|
debuginfod/ChangeLog | 6 ++++++
|
||
|
debuginfod/debuginfod.cxx | 3 ++-
|
||
|
2 files changed, 8 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
|
||
|
index a089d0bd..9245be53 100644
|
||
|
--- a/debuginfod/debuginfod.cxx
|
||
|
+++ b/debuginfod/debuginfod.cxx
|
||
|
@@ -1742,7 +1742,8 @@ handle_buildid_r_match (bool internal_req_p,
|
||
|
if ((r == 0) && (fn != b_source1)) // stage 1
|
||
|
continue;
|
||
|
|
||
|
- if (fdcache.probe (b_source0, fn)) // skip if already interned
|
||
|
+ if (fdcache.probe (b_source0, fn) && // skip if already interned
|
||
|
+ fn != b_source1) // but only if we'd just be prefetching, PR29474
|
||
|
continue;
|
||
|
|
||
|
// extract this file to a temporary file
|
||
|
--
|
||
|
2.37.1
|
||
|
|