Skip to content

Commit 07c632f

Browse files
committed
leave comment about stats cachedump locks
It's safe based on a technicality, which may not stay true for long. Same was true for stats sizes.
1 parent 90593dc commit 07c632f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

items.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,12 @@ int do_item_replace(item *it, item *new_it, const uint32_t hv) {
432432
}
433433

434434
/*@null@*/
435+
/* This is walking the line of violating lock order, but I think it's safe.
436+
* If the LRU lock is held, an item in the LRU cannot be wiped and freed.
437+
* The data could possibly be overwritten, but this is only accessing the
438+
* headers.
439+
* It may not be the best idea to leave it like this, but for now it's safe.
440+
*/
435441
char *do_item_cachedump(const unsigned int slabs_clsid, const unsigned int limit, unsigned int *bytes) {
436442
unsigned int memlimit = 2 * 1024 * 1024; /* 2MB max response size */
437443
char *buffer;
@@ -553,6 +559,10 @@ void do_item_stats(ADD_STAT add_stats, void *c) {
553559

554560
/** dumps out a list of objects of each size, with granularity of 32 bytes */
555561
/*@null@*/
562+
/* Locks are correct based on a technicality. Holds LRU lock while doing the
563+
* work, so items can't go invalid, and it's only looking at header sizes
564+
* which don't change.
565+
*/
556566
void do_item_stats_sizes(ADD_STAT add_stats, void *c) {
557567

558568
/* max 1MB object, divided into 32 bytes size buckets */

0 commit comments

Comments
 (0)