PR26125 patch: debuginfod client cache cleanup
Sat May 1 17:59:37 GMT 2021
On Mon, 2021-04-26 at 11:54 -0400, Frank Ch. Eigler via Elfutils-devel wrote:
> PR26125: debuginfod client cache - rmdir harder
> With PR25365, we accidentally lost the ability to rmdir client-cache
> directories corresponding to buildids. Bring this back, with some
> attention to a possible race between a client doing cleanup and
> another client doing lookups at the same time.
OK. So if I understand correctly the trailing / in the regexp made
directories not match (because their name doesn't actually end in a /)?
And even with the new check:
> if (now - f->fts_statp->st_mtime >= max_unused_age)
there is still a super tiny race if multiple clients might be running,
pass this check, then another client tries to create the dir and file,
but right before:
> + fd = mkstemp (target_cache_tmppath);
one of the other clients gets to run the rmdir.
But then we just retry again and hope no other client was stuck right
before the rmdir.
Looks good. I cannot think of a better way to resolve this race.
More information about the Elfutils-devel