return -EINVAL;
}
+ // remove any pending entries whose tag timeout has expired. until expiry,
+ // these pending entries will prevent us from applying suggested changes
real_time cur_time = real_clock::now();
auto iter = cur_disk.pending_map.begin();
while(iter != cur_disk.pending_map.end()) {
}
}
- CLS_LOG(20, "cur_disk.pending_map.empty()=%d op=%d cur_disk.exists=%d cur_change.pending_map.size()=%d cur_change.exists=%d",
+ CLS_LOG(20, "cur_disk.pending_map.empty()=%d op=%d cur_disk.exists=%d "
+ "cur_disk.index_ver=%d cur_change.exists=%d cur_change.index_ver=%d",
cur_disk.pending_map.empty(), (int)op, cur_disk.exists,
- (int)cur_change.pending_map.size(), cur_change.exists);
+ (int)cur_disk.index_ver, cur_change.exists,
+ (int)cur_change.index_ver);
+
+ if (cur_change.index_ver < cur_disk.index_ver) {
+ // a pending on-disk entry was completed since this suggestion was made,
+ // don't apply it yet. if the index really is inconsistent, the next
+ // listing will get the latest version and resend the suggestion
+ continue;
+ }
if (cur_disk.pending_map.empty()) {
if (cur_disk.exists) {