[Mesa-dev] [PATCH V2 6/6] util: disable cache if we have no build-id and timestamp is zero
Bas Nieuwenhuizen
bas at basnieuwenhuizen.nl
Wed Sep 19 22:59:25 UTC 2018
R-b
On Thu, 20 Sep 2018, 00:54 Timothy Arceri, <tarceri at itsqueeze.com> wrote:
> Timestamp can be zero for example when Flatpak is used. In this
> case just disable the cache rather then segfaulting when
> incompatible cache items are loaded.
>
> V2: actually return false when mtime is 0.
> ---
> src/amd/vulkan/radv_device.c | 4 ----
> src/util/disk_cache.h | 8 ++++++++
> 2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
> index f9169d9d012..7d915c68aaa 100644
> --- a/src/amd/vulkan/radv_device.c
> +++ b/src/amd/vulkan/radv_device.c
> @@ -61,10 +61,6 @@ radv_get_build_id(void *ptr, struct mesa_sha1 *ctx)
> } else
> #endif
> if (disk_cache_get_function_timestamp(ptr, ×tamp)) {
> - if (!timestamp) {
> - fprintf(stderr, "radv: The provided filesystem
> timestamp for the cache is bogus!\n");
> - }
> -
> _mesa_sha1_update(ctx, ×tamp, sizeof(timestamp));
> } else
> return false;
> diff --git a/src/util/disk_cache.h b/src/util/disk_cache.h
> index 962a26ffc8c..185e05f200e 100644
> --- a/src/util/disk_cache.h
> +++ b/src/util/disk_cache.h
> @@ -101,7 +101,15 @@ disk_cache_get_function_timestamp(void *ptr,
> uint32_t* timestamp)
> if (stat(info.dli_fname, &st)) {
> return false;
> }
> +
> + if (!st.st_mtime) {
> + fprintf(stderr, "Mesa: The provided filesystem timestamp for the
> cache "
> + "is bogus! Disabling On-disk cache.\n");
> + return false;
> + }
> +
> *timestamp = st.st_mtime;
> +
> return true;
> }
>
> --
> 2.17.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180920/cdc4a1b2/attachment.html>
More information about the mesa-dev
mailing list