]> git.ipfire.org Git - thirdparty/knot-resolver.git/commit
cache/api: prevent deadlock on kr_cache_remove with multiple processes
authorMarek Vavruša <mvavrusa@cloudflare.com>
Tue, 21 Aug 2018 06:59:24 +0000 (23:59 -0700)
committerMarek Vavruša <mvavrusa@cloudflare.com>
Fri, 7 Sep 2018 17:45:21 +0000 (10:45 -0700)
commit159b5e48705869ee3044404f3f9bec2073ce5470
tree382d33ce6c41aa17407e01b77cfeb6dcfacbfc82
parent16d699e1ee4e3025bdb70388c480104b16cfa329
cache/api: prevent deadlock on kr_cache_remove with multiple processes

Only the `kr_cache_remove_subtree` called `kr_cache_sync` to commit
the write transaction after cache removal operation. This wasn't
done in the `kr_cache_remove` so the write transaction could be
long-lived.

With two or more processes, if one help the write transaction open,
no other process could open it. If the process holding the transaction
would call IPC to other processes and wait, it would never release
it and the other processes could never acquire it, and deadlock
would occur.
lib/cache/api.c