New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cephfs: potential adjust failure in lru_expire #19277
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,14 +157,14 @@ class LRU { | |
|
||
// expire -- expire a single item | ||
LRUObject *lru_get_next_expire() { | ||
adjust(); | ||
// look through tail of bot | ||
while (bottom.size()) { | ||
LRUObject *p = bottom.back(); | ||
if (!p->lru_pinned) return p; | ||
|
||
// move to pintail | ||
pintail.push_front(&p->lru_link); | ||
adjust(); | ||
} | ||
|
||
// ok, try head then | ||
|
@@ -174,7 +174,6 @@ class LRU { | |
|
||
// move to pintail | ||
pintail.push_front(&p->lru_link); | ||
adjust(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This loop probably isn't well tested because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. int adjust(): both lru_get_size() and num_pinned do not change when moving item to pintail There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great point. Thanks Zheng. |
||
} | ||
|
||
// no luck! | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this
adjust()
is necessary because the size of bottom is changing so it may be necessary to move objects fromtop
tobottom
.