Here is the relevant code portion from __wt_cache_eviction_worker, the function that the application thread calls when it is forced to evict:
The for loop resets the return value, ret = 0, and hence, in general, doesn't let EBUSY from the eviction attempt be leaked to the caller. This is true even when all the attempts to evict the page return busy, and the call returns. This is desired as the callers to __wt_cache_eviction_worker might not check for EBUSY returns and a caller like page_in could then return EBUSY to the application. We would not like the application call to fail because eviction did not succeed.
But, at the end of the loop, we have the code that checks if the application thread doesn't want to wait too long. In such a case, we stop trying to evict past a timeout period. But, if the page had last failed to evict with EBUSY, we do not end up suppressing the error. This would be a bug and lead to the application call failing instead of going through with the operation.
On the other hand, if an application thread can't get space in the cache and needs to fail, it should result in a WT_ROLLBACK error. Look at the code past the err: label, specifically the following line:
If the last attempt at eviction before timeout failed with EBUSY and we decide that this transaction needs to be rolled-back, we end up returning EBUSY instead of WT_ROLLBACK. This is because we are using WT_TRET and an error is already set. Also, in this case we will have EBUSY returned with a rollback reason set, which is an inconsistent API return.