I'm just replying to your comment that you didn't see why `evict_lock` is required before the call to `__wt_evict_clear_tree_walk`.  If we don't need to clear the eviction walk, we shouldn't need the lock.

My reading is that compact just needs to wait for `btree->lru_count` to go to zero.  The problem is that without disabling eviction temporarily, there is no guarantee that eviction will eventually drain.

Given that compact is a heavyweight operation, I think what you've got is fine: use the same code for compact to drain eviction as we do for other operations that need exclusive access to the tree.