mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 07:07:52 +01:00
If we do underflow the know usage of a storage, recalculate it
Fixes bug #22424 on 0.3.1.1-alpha.
This commit is contained in:
parent
69b234a0a8
commit
79725289e1
1 changed files with 10 additions and 0 deletions
|
@ -418,6 +418,16 @@ storage_dir_reduce_usage(storage_dir_t *d, uint64_t removed_file_size)
|
||||||
* actual usage (rather than relaying on cached usage), and the call to
|
* actual usage (rather than relaying on cached usage), and the call to
|
||||||
* this function. */
|
* this function. */
|
||||||
d->usage -= removed_file_size;
|
d->usage -= removed_file_size;
|
||||||
|
} else {
|
||||||
|
/* If we underflowed the cached directory size, re-check the sizes of all
|
||||||
|
* the files in the directory. This makes storage_dir_shrink() quadratic,
|
||||||
|
* but only if a process is continually changing file sizes in the
|
||||||
|
* storage directory (in which case, we have bigger issues).
|
||||||
|
*
|
||||||
|
* We can't just reset usage_known, because storage_dir_shrink() relies
|
||||||
|
* on knowing the usage. */
|
||||||
|
storage_dir_rescan(d);
|
||||||
|
(void)storage_dir_get_usage(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue