From patchwork Fri Mar 17 16:03:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Merey X-Patchwork-Id: 66523 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 86551385087E for ; Fri, 17 Mar 2023 16:03:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 86551385087E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679069011; bh=XQ8euKj5v+tfkFHfCREncmtubNUks6O/XpTES/8ylDM=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Help:List-Subscribe:From:Reply-To:From; b=lwOlPfu64n62mX09InQ9asD0LkgGAHTS4RvIwmjJIL3mzFUORwpKl7mtHRsTtYuMp wxnwwsPlPQ/OgMEP+5ca8KsZtKnoAhEGZBd1wJZYm+aO+zmjDPExuz26zmJzGBFojz h6JxlAU1LKxH2VqP5vcqNvMyjrZbMgeB/eUxxXU4= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 425DB385B523 for ; Fri, 17 Mar 2023 16:03:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 425DB385B523 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-252-JFauMim6MPGbMDiG7O5dlA-1; Fri, 17 Mar 2023 12:03:11 -0400 X-MC-Unique: JFauMim6MPGbMDiG7O5dlA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9C349185A791 for ; Fri, 17 Mar 2023 16:03:11 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.34.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6CF302166B26; Fri, 17 Mar 2023 16:03:11 +0000 (UTC) To: elfutils-devel@sourceware.org Cc: Aaron Merey Subject: [PATCH OB] debuginfod-client.c: Skip empty file creation for cancelled queries Date: Fri, 17 Mar 2023 12:03:09 -0400 Message-Id: <20230317160309.41211-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Aaron Merey via Elfutils-devel From: Aaron Merey Reply-To: Aaron Merey Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Committing as obvious. Empty files in the client cache are used to indicate that contacted servers could not find a requested resource. Future queries for this resource will not be attempted until the cache_miss_s duration has passed. Currently these empty files are also created when a query is cancelled through the client's progressfn. This can occur, for example, when a user cancels a download with ctrl-c. This prevents user-cancelled queries from being retried promptly without having to modify cache_miss_s. Fix this by skipping the creation of an empty cache file when progressfn cancels a query. Signed-off-by: Aaron Merey --- debuginfod/ChangeLog | 5 +++++ debuginfod/debuginfod-client.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index f861eb72..5db5a753 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,8 @@ +2023-03-17 Aaron Merey + + * debuginfod-client.c (debuginfod_query_server): Do not create an + empty file in the cache if the query was cancelled by the progressfn. + 2023-02-07 Aaron Merey * debuginfod-client.c (cache_find_section): Avoid returning -ENOENT diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index ef4d47e3..b33408eb 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -1667,9 +1667,9 @@ debuginfod_query_server (debuginfod_client *c, } } while (num_msg > 0); - /* Create an empty file named as $HOME/.cache if the query fails - with ENOENT.*/ - if (rc == -ENOENT) + /* Create an empty file in the cache if the query fails with ENOENT and + it wasn't cancelled early. */ + if (rc == -ENOENT && !c->progressfn_cancel) { int efd = open (target_cache_path, O_CREAT|O_EXCL, DEFFILEMODE); if (efd >= 0)