From patchwork Wed Sep 8 08:29:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12480595 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 836CAC433F5 for ; Wed, 8 Sep 2021 08:29:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 699B66113D for ; Wed, 8 Sep 2021 08:29:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348143AbhIHIan (ORCPT ); Wed, 8 Sep 2021 04:30:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343797AbhIHIam (ORCPT ); Wed, 8 Sep 2021 04:30:42 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86FE9C061757 for ; Wed, 8 Sep 2021 01:29:34 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id q26so1971921wrc.7 for ; Wed, 08 Sep 2021 01:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=rYlesStfd2WQNMGrKUNbD2OPdQmWiXeYgEAZmRB2QLk=; b=R0y3M2MUeW8bfPyFuplRkM3l5zyRtYaKNX28N89qT1r9ErpPUBRg74owi0+cbfpG0C zo23Y1EZDVN6l2uI6L5xftve0f/0u5W4GIkTxBmuA/Xw87EzYVIAbUZ8dFXhJzU0Q8aX gnTYn09SN3EDnmD8SiWvlQR//luXrWumWflQU48B9tQ8kHW5O2znezSaMN6D5+wHq6y3 9+Oj9eGgRVhcNs9KPGXSCuJMYLvg6y9QFUk9qCcIrn9u51cRYGKchiVc5IIS7J8OSk1N FRAEfAINyDku9FjOPNj1gLl9xJ4FW+wykz2H4LhcEXYa2bDYgG//oYG2aY94ThiFTHwg Yq+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=rYlesStfd2WQNMGrKUNbD2OPdQmWiXeYgEAZmRB2QLk=; b=ascgwQGiB6QyJ9WXCdI0/dqCO/cfh6c/PWdibjdccmKMf6VAyWQCfnkesqeGo4eg3o FAHehga55YlWBaXQdhoVdvWeTTc5OVeT1XzyRn6khE2jlaKAeyJ8BqQ5PaBSTb5NlTHb hMSMknSEiUyscHPeybb0rqSAwVwVDfHSMK4R6g3tDRx1wTt3C/vg+pez9jjVqw1ZmD6u 2gQknJr3Oo+1uGnBMPjQA1whp9XZFBoKdbSCDJ0l6HkzVsKclNJoUGj0M32gkGfusYTt m8QmUWqCqIKUVkBitHj/ESvzPh2z/F3x8HQ9HfkwptPdDzYeJ2QPF9qBWPMUawTUDArM buKQ== X-Gm-Message-State: AOAM530/v5ml76TdHF3N2c3OoJxazfslM8YvnxDGr4fO/AhW4adH3+wn kk3mdTugkMieHMTE0IgChoInGgAAHOQ= X-Google-Smtp-Source: ABdhPJz1+Jtc3W4fbGN8FPYFxj5a3IjRKTRKir5ORt7KHNfGVBDqLmS86+7yo/R87o+WfIFk8RhB+Q== X-Received: by 2002:a05:6000:124f:: with SMTP id j15mr2681044wrx.101.1631089773154; Wed, 08 Sep 2021 01:29:33 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id l15sm1267272wms.38.2021.09.08.01.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Sep 2021 01:29:32 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Wed, 08 Sep 2021 08:29:30 +0000 Subject: [PATCH 1/2] commit-graph: when closing the graph, also release the slab Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin The slab has information about the commit graph. That means that it is meaningless (and even misleading) when the commit graph was closed. This seems not to matter currently, but we're about to fix a Windows-specific bug where `git pull` does not close the object store before fetching (risking that an implicit auto-gc fails to remove the now-obsolete pack file(s)), and once we have that bug fix in place, it does matter: after that bug fix, we will open the object store, do some stuff with it, then close it, fetch, and then open it again, and do more stuff. If we close the commit graph without releasing the corresponding slab, we're hit by a symptom like this in t5520.19: BUG: commit-reach.c:85: bad generation skip 9223372036854775807 > 3 at 5cd378271655d43a3b4477520014f02213ad1546 Signed-off-by: Johannes Schindelin --- commit-graph.c | 1 + 1 file changed, 1 insertion(+) diff --git a/commit-graph.c b/commit-graph.c index 3860a0d8477..09984455150 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -713,6 +713,7 @@ static void close_commit_graph_one(struct commit_graph *g) if (!g) return; + clear_commit_graph_data_slab(&commit_graph_data_slab); close_commit_graph_one(g->base_graph); free_commit_graph(g); } From patchwork Wed Sep 8 08:29:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12480597 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4043DC433FE for ; Wed, 8 Sep 2021 08:29:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A11061154 for ; Wed, 8 Sep 2021 08:29:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348163AbhIHIao (ORCPT ); Wed, 8 Sep 2021 04:30:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348098AbhIHIam (ORCPT ); Wed, 8 Sep 2021 04:30:42 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17488C06175F for ; Wed, 8 Sep 2021 01:29:35 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id q26so1971960wrc.7 for ; Wed, 08 Sep 2021 01:29:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=p+x9BvFGhU04iV74kIWz4YoTMzxuqJHJw5UUhuR/gc4=; b=ZyoustQLLtSv1J7lDBz6cj17GEjBnsmTSzBcFum8To2s+AEjFMv1iU0KWz+OiJSE+Q YrhQWOhKRU445vMDrKst4S+wmbs9sPfiV8e0HSNJ2fmRo1xnOaGV/rnbQidoFLyPi+rM 2oV0ksH0Y3AxLzOOQzPb6gFENfuYFZ4MySJ8N6hjKKVRQwNrBo8BCGIj4vI7B31ZNkk/ UXu7IflH2xH9gKVHZN8SPXS8dRgs8OorB+iOSYMJ5IA25JV2WSMKKsKhT946CV2jwRi1 OgB9BUOkRZTlirmHl2UqmHARurk3k4Qi7xq/JJ957QXQ2Rgf0i8CbEO2YMRsdOz0JlXJ owjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=p+x9BvFGhU04iV74kIWz4YoTMzxuqJHJw5UUhuR/gc4=; b=OZyITNxFmXbRDpcV7iYStOiZLW7ZlPGHpbJSebb6namuOHj1uZJGk3oyXw3CpbHmVw WTBbs1iS0vxrflpS2J7LCdXwP+RsGP2OYXrMGYMMzjAdMSyLUypwhSdBkx2ZJzEp69it +b3aOEiJkVluWtOf5JNVwZ/teQQWhfSMUq5nH+E4OWa2mg8PHquJkH32el5sQr5Vs6hy Tzyu/R4yKpW+iTiNlApCuU4ytxw2eesqzS/AeWQPJlIgAdH9ieXTqgoXSR9xP1fnZauq tv47eiml3m12oo0FsmRmi/spiDkdRsCrQEG9858rJiDFoBfwdPNYISvi1TrxvFH1g9+a 08qg== X-Gm-Message-State: AOAM532q4bK2J4tUIm4nJI82NquH9Tixf7bUnPUseSaYnfdAziBGT6ls Ztz2ONPt/wCzcUw2M35cXbuA0E0I5OE= X-Google-Smtp-Source: ABdhPJwGxZgT0R44LJM6ogEpSrSO93L2gB+c23YgCQ8MuTetOymgF9AyU0YhM2L3POOw8mK+xfoQFQ== X-Received: by 2002:a5d:4e47:: with SMTP id r7mr1193448wrt.417.1631089773671; Wed, 08 Sep 2021 01:29:33 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id t14sm1326174wmi.12.2021.09.08.01.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Sep 2021 01:29:33 -0700 (PDT) Message-Id: <0e956ae7bba906277c77103ae329bce6d6da4cfe.1631089771.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 08 Sep 2021 08:29:31 +0000 Subject: [PATCH 2/2] pull: release packs before fetching Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin On Windows, files cannot be removed nor renamed if there are still handles held by a process. To remedy that, we try to release all open handles to any `.pack` file before e.g. repacking (which would want to remove the original `.pack` file(s) after it is done). Since the `read_cache_unmerged()` and/or the `get_oid()` call in `git pull` can cause `.pack` files to be opened, we need to release the open handles before calling `git fetch`: the latter process might want to spawn an auto-gc, which in turn might want to repack the objects. This commit is similar in spirit to 5bdece0d705 (gc/repack: release packs when needed, 2018-12-15). This fixes https://github.com/git-for-windows/git/issues/3336. Signed-off-by: Johannes Schindelin --- builtin/pull.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builtin/pull.c b/builtin/pull.c index 3e13f810843..d9f0156d969 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -26,6 +26,7 @@ #include "wt-status.h" #include "commit-reach.h" #include "sequencer.h" +#include "packfile.h" /** * Parses the value of --rebase. If value is a false value, returns @@ -998,6 +999,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix) oidclr(&rebase_fork_point); } + close_object_store(the_repository->objects); if (run_fetch(repo, refspecs)) return 1;