diff --git a/eden/fs/inodes/CheckoutContext.cpp b/eden/fs/inodes/CheckoutContext.cpp index a068af0b70..b9bbbdbbf8 100644 --- a/eden/fs/inodes/CheckoutContext.cpp +++ b/eden/fs/inodes/CheckoutContext.cpp @@ -85,6 +85,10 @@ Future> CheckoutContext::finish(RootId newSnapshot) { // This allows any filesystem unlink() or rename() operations to proceed. renameLock_.unlock(); + return flush(); +} + +Future> CheckoutContext::flush() { if (!isDryRun()) { // If we have a FUSE channel, flush all invalidations we sent to the kernel // as part of the checkout operation. This will ensure that other processes diff --git a/eden/fs/inodes/CheckoutContext.h b/eden/fs/inodes/CheckoutContext.h index 4dc6cdeb9d..a7b1a1d4ee 100644 --- a/eden/fs/inodes/CheckoutContext.h +++ b/eden/fs/inodes/CheckoutContext.h @@ -96,6 +96,13 @@ class CheckoutContext { */ folly::Future> finish(RootId newSnapshot); + /** + * Flush the invalidation if needed. + * + * Return the list of conflicts and errors. + */ + folly::Future> flush(); + void addConflict(ConflictType type, RelativePathPiece path); void addConflict(ConflictType type, TreeInode* parent, PathComponentPiece name); diff --git a/eden/fs/inodes/EdenMount.cpp b/eden/fs/inodes/EdenMount.cpp index 07801f729f..ee192cfe70 100644 --- a/eden/fs/inodes/EdenMount.cpp +++ b/eden/fs/inodes/EdenMount.cpp @@ -692,20 +692,17 @@ folly::Future EdenMount::setPathObjectId( }); return collectSafe(getTargetTreeInodeFuture, getRootTreeFuture) - .thenValue([this, ctx, setPathObjectIdTime, stopWatch, rootId]( + .thenValue([ctx, setPathObjectIdTime, stopWatch, rootId]( std::tuple> results) { setPathObjectIdTime->didLookupTreesOrGetInodeByPath = stopWatch.elapsed(); auto [targetTreeInode, incomingTree] = results; targetTreeInode->unloadChildrenUnreferencedByFs(); - // TODO(@yipu): Remove rename lock - ctx->start(this->acquireRenameLock(), {}, rootId, nullptr); - setPathObjectIdTime->didAcquireRenameLock = stopWatch.elapsed(); return targetTreeInode->checkout(ctx.get(), nullptr, incomingTree); }) .thenValue([ctx, setPathObjectIdTime, stopWatch, rootId](auto&&) { setPathObjectIdTime->didCheckout = stopWatch.elapsed(); - return ctx->finish(rootId); + return ctx->flush(); }) .thenValue([ctx, setPathObjectIdTime, stopWatch]( std::vector&& conflicts) { diff --git a/eden/fs/inodes/EdenMount.h b/eden/fs/inodes/EdenMount.h index cdc298b7a7..1cdf3840c4 100644 --- a/eden/fs/inodes/EdenMount.h +++ b/eden/fs/inodes/EdenMount.h @@ -164,7 +164,6 @@ struct CheckoutTimes { struct SetPathObjectIdTimes { using duration = std::chrono::steady_clock::duration; duration didLookupTreesOrGetInodeByPath{}; - duration didAcquireRenameLock{}; duration didCheckout{}; duration didFinish{}; };