masaori335 commented on code in PR #13608:
URL: https://github.com/apache/trafficserver/pull/13608#discussion_r4021486258
##########
src/iocore/cache/CacheDir.cc:
##########
@@ -683,21 +669,17 @@ Directory::remove(const CacheKey *key, StripeSM *stripe,
Dir *del)
int b = key->slice32(1) % this->buckets;
Dir *seg = this->get_segment(s);
Dir *e = nullptr, *p = nullptr;
-#ifdef LOOP_CHECK_MODE
- int loop_count = 0;
-#endif
CHECK_DIR(vol);
e = dir_bucket(b, seg);
if (dir_offset(e)) {
+ int loop_count = 0;
do {
-#ifdef LOOP_CHECK_MODE
- loop_count++;
- if (loop_count > DIR_LOOP_THRESHOLD) {
- if (this->bucket_loop_fix(dir_bucket(b, seg), s))
- return 0;
+ // Past the longest legitimate chain, so this is provably a cycle.
+ if (++loop_count > this->max_bucket_depth()) {
+ this->bucket_loop_fix(dir_bucket(b, seg), s);
Review Comment:
Good catch! b2763ee9b00c1e42a52c9985f2131c65e84c2d4a marks the flag in
`Directory::init_segment`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]