Make sure shutdown() errors propagate to unmount() waiters

Summary: Use SharedPromise::setFuture to make sure errors propagate.

Reviewed By: simpkins

Differential Revision: D6515818

fbshipit-source-id: dee95bccdc086a040ead08e60373cbc7daa4db3f
This commit is contained in:
Chad Austin 2017-12-11 18:01:15 -08:00 committed by Facebook Github Bot
parent 0b74d03fbd
commit 5eaddd7921
2 changed files with 5 additions and 5 deletions

View File

@ -542,10 +542,10 @@ void EdenServer::mountFinished(EdenMount* edenMount) {
// Shutdown the EdenMount, and fulfill the unmount promise
// when the shutdown completes
edenMount->shutdown().then(
[unmountPromise = std::move(unmountPromise)]() mutable {
unmountPromise.setValue();
});
edenMount->shutdown().then([unmountPromise = std::move(unmountPromise)](
folly::Try<folly::Unit>&& result) mutable {
unmountPromise.setTry(std::move(result));
});
}
EdenServer::MountList EdenServer::getMountPoints() const {

View File

@ -203,7 +203,7 @@ class EdenServer : private TakeoverHandler {
private:
// Struct to store EdenMount along with SharedPromise that is set
// during unmount to allow synchronizaiton between unmoutFinished
// during unmount to allow synchronization between unmountFinished
// and unmount functions.
struct EdenMountInfo {
std::shared_ptr<EdenMount> edenMount;