[Mesa-dev] [PATCH 1/2] util/disk_cache: delete .tmp if target exists
Timothy Arceri
tarceri at itsqueeze.com
Sun Mar 19 21:27:06 UTC 2017
On 19/03/17 07:58, Grazvydas Ignotas wrote:
> At the time of target file check, .tmp file is already created and file
> lock is held, so we should remove the .tmp, like in other error paths.
>
> With this, piglit no longer leaves large amount of empty .tmp files
> behind, which waste directory entries and may interfere with eviction.
Thanks! I'd been meaning to look into why we were ending up with the
.tmp files. Both patches pushed.
>
> Signed-off-by: Grazvydas Ignotas <notasas at gmail.com>
> ---
> src/util/disk_cache.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
> index 6c91f23..f6768d5 100644
> --- a/src/util/disk_cache.c
> +++ b/src/util/disk_cache.c
> @@ -841,12 +841,14 @@ cache_put(void *job, int thread_index)
> * another process won the race between when we saw that the file
> * didn't exist and now. In this case, we don't do anything more,
> * (to ensure the size accounting of the cache doesn't get off).
> */
> fd_final = open(filename, O_RDONLY | O_CLOEXEC);
> - if (fd_final != -1)
> + if (fd_final != -1) {
> + unlink(filename_tmp);
> goto done;
> + }
>
> /* OK, we're now on the hook to write out a file that we know is
> * not in the cache, and is also not being written out to the cache
> * by some other process.
> *
>
More information about the mesa-dev
mailing list