because all callers need a new slice, not an available anchor position.
assert(valid(fileno));
Anchor &s = shared->slots[fileno].anchor;
if (s.lock.lockExclusive()) {
- if (!s.empty()) {
+ // the caller wants a free slice; empty anchor is not enough
+ if (!s.empty() && s.start >= 0) {
// this entry may be marked for deletion, and that is OK
freeChain(fileno, s, false);
debugs(54, 5, "purged entry " << fileno << " from " << path);
/// stop writing the entry, freeing its slot for others to use if possible
void abortWriting(const sfileno fileno);
- /// finds an unlocked entry and frees it or returns false
+ /// either finds and frees an entry with at least 1 slice or returns false
bool purgeOne();
/// copies slice to its designated position