Module: Mesa
Branch: master
Commit: 67911fa4b88aedc709a92c1630c1de9ea3a30d1f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=67911fa4b88aedc709a92c1630c1de9ea3a30d1f

Author: Grazvydas Ignotas <[email protected]>
Date:   Sat Mar 18 22:58:54 2017 +0200

util/disk_cache: delete .tmp if target exists

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.

Signed-off-by: Grazvydas Ignotas <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>

---

 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 79ec63080c..36b27d95ed 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -843,8 +843,10 @@ cache_put(void *job, int thread_index)
     * (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

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to