From: William Baker <williamtbakeremail@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
Kevin Willford <Kevin.Willford@microsoft.com>
Cc: Utsav Shah via GitGitGadget <gitgitgadget@gmail.com>,
William Baker <William.Baker@microsoft.com>,
"git@vger.kernel.org" <git@vger.kernel.org>,
Utsav Shah <ukshah2@illinois.edu>
Subject: Re: [PATCH 0/1] fsmonitor: skip sanity check if the index is split
Date: Thu, 14 Nov 2019 08:41:25 -0800 [thread overview]
Message-ID: <beb5a2b4-f07c-c3fd-9e68-dbee85fba2ee@gmail.com> (raw)
In-Reply-To: <xmqqzhh0d0ma.fsf@gitster-ct.c.googlers.com>
On 11/12/19 5:30 PM, Junio C Hamano wrote:
> Thanks. Here is what I came up with to tie the loose ends of this
> thread.
>
> -- >8 --
> From: Junio C Hamano <gitster@pobox.com>
> Subject: [PATCH] fsmonitor: do not compare bitmap size with size of split index
>
> 3444ec2e ("fsmonitor: don't fill bitmap with entries to be removed",
> 2019-10-11) added a handful of sanity checks that make sure that a
> bit position in fsmonitor bitmap does not go beyond the end of the
> index. As each bit in the bitmap corresponds to a path in the
> index, this is the right check most of the time.
>
> Except for the case when we are in the split-index mode and looking
> at a delta index that is to be overlayed on the base index but
> before the base index has actually been merged in, namely in read_
> and write_fsmonitor_extension(). In these codepaths, the entries in
> the split/delta index is typically a small subset of the entire set
> of paths (otherwise why would we be using split-index?), so the
> bitmap used by the fsmonitor is almost always larger than the number
> of entries in the partial index, and the incorrect comparison would
> trigger the BUG().
>
> Reported-by: Utsav Shah <ukshah2@illinois.edu>
> Helped-by: Kevin Willford <Kevin.Willford@microsoft.com>
> Helped-by: William Baker <William.Baker@microsoft.com>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> fsmonitor.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fsmonitor.c b/fsmonitor.c
> index 1f4aa1b150..0477500b39 100644
> --- a/fsmonitor.c
> +++ b/fsmonitor.c
> @@ -55,7 +55,8 @@ int read_fsmonitor_extension(struct index_state *istate, const void *data,
> }
> istate->fsmonitor_dirty = fsmonitor_dirty;
>
> - if (istate->fsmonitor_dirty->bit_size > istate->cache_nr)
> + if (!istate->split_index &&
> + istate->fsmonitor_dirty->bit_size > istate->cache_nr)
> BUG("fsmonitor_dirty has more entries than the index (%"PRIuMAX" > %u)",
> (uintmax_t)istate->fsmonitor_dirty->bit_size, istate->cache_nr);
>
> @@ -83,7 +84,8 @@ void write_fsmonitor_extension(struct strbuf *sb, struct index_state *istate)
> uint32_t ewah_size = 0;
> int fixup = 0;
>
> - if (istate->fsmonitor_dirty->bit_size > istate->cache_nr)
> + if (!istate->split_index &&
> + istate->fsmonitor_dirty->bit_size > istate->cache_nr)
> BUG("fsmonitor_dirty has more entries than the index (%"PRIuMAX" > %u)",
> (uintmax_t)istate->fsmonitor_dirty->bit_size, istate->cache_nr);
>
>
This looks good to me.
Thanks,
William
next prev parent reply other threads:[~2019-11-14 16:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-08 7:09 [PATCH 0/1] fsmonitor: skip sanity check if the index is split Utsav Shah via GitGitGadget
2019-11-08 7:09 ` [PATCH 1/1] " Utsav Shah via GitGitGadget
2019-11-12 11:18 ` SZEDER Gábor
2019-11-12 21:08 ` Utsav Shah
2019-11-11 1:43 ` [PATCH 0/1] " Junio C Hamano
2019-11-11 2:01 ` Junio C Hamano
2019-11-11 16:55 ` Kevin Willford
2019-11-11 17:25 ` Utsav Shah
2019-11-11 18:21 ` Kevin Willford
2019-11-11 17:30 ` William Baker
2019-11-13 1:30 ` Junio C Hamano
2019-11-14 2:55 ` Utsav Shah
2019-11-14 16:41 ` William Baker [this message]
2019-11-15 5:04 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=beb5a2b4-f07c-c3fd-9e68-dbee85fba2ee@gmail.com \
--to=williamtbakeremail@gmail.com \
--cc=Kevin.Willford@microsoft.com \
--cc=William.Baker@microsoft.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=ukshah2@illinois.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).