-
Simon McVittie authored
We need to hold an exclusive lock while carrying out GC, because any number of processes could be trying to create temporary copies there at the same time, and if that's happening then it's unsafe for the GC pass to be looking at the temporary copies concurrently. Only do the GC pass opportunistically, if we can get an exclusive lock without waiting. Conversely, while we're creating the temporary copies, we continue to take out a non-exclusive lock; but if another process is in the middle of a GC pass, we want to wait for it instead of just failing. Signed-off-by:
Simon McVittie <smcv@collabora.com>
Simon McVittie authoredWe need to hold an exclusive lock while carrying out GC, because any number of processes could be trying to create temporary copies there at the same time, and if that's happening then it's unsafe for the GC pass to be looking at the temporary copies concurrently. Only do the GC pass opportunistically, if we can get an exclusive lock without waiting. Conversely, while we're creating the temporary copies, we continue to take out a non-exclusive lock; but if another process is in the middle of a GC pass, we want to wait for it instead of just failing. Signed-off-by:
Simon McVittie <smcv@collabora.com>