3939#include " eden/fs/config/CheckoutConfig.h"
4040#include " eden/fs/fuse/FuseChannel.h"
4141#include " eden/fs/fuse/FuseDirList.h"
42+ #include " eden/fs/inodes/AclState.h"
4243#include " eden/fs/inodes/CheckoutAction.h"
4344#include " eden/fs/inodes/CheckoutContext.h"
4445#include " eden/fs/inodes/ChildEntryAttributes.h"
@@ -595,9 +596,11 @@ std::optional<ImmediateFuture<VirtualInode>> TreeInode::rlockGetOrFindChild(
595596 // the id
596597 return getObjectStore ()
597598 .getTree (entry.getObjectId (), context)
598- .thenValue ([mode = entry.getInitialMode ()](
599+ .thenValue ([mode = entry.getInitialMode (), hasACL = entry. hasACL () ](
599600 std::shared_ptr<const Tree>&& tree) {
600- return VirtualInode (std::move (tree), mode);
601+ auto virtualInode = VirtualInode (std::move (tree), mode);
602+ virtualInode.setHasACL (hasACL);
603+ return virtualInode;
601604 });
602605 }
603606 // This is a file, return the DirEntry if this was the last
@@ -758,7 +761,8 @@ std::optional<VirtualInode> TreeInode::rlockCheckChild(
758761 entry.getInitialMode (),
759762 contents.entries .getCaseSensitivity ());
760763 }
761- dirFetch = PendingDirFetch{entry.getObjectId (), entry.getInitialMode ()};
764+ dirFetch = PendingDirFetch{
765+ entry.getObjectId (), entry.getInitialMode (), entry.hasACL ()};
762766 return std::nullopt ;
763767 }
764768 return VirtualInode{UnmaterializedUnloadedBlobDirEntry (entry)};
@@ -830,7 +834,9 @@ folly::coro::now_task<VirtualInode> TreeInode::co_getOrFindChild(
830834 // All locks released before suspension
831835 if (dirFetch.has_value ()) {
832836 auto tree = co_await getObjectStore ().co_getTree (dirFetch->treeId , context);
833- co_return VirtualInode (std::move (tree), dirFetch->mode );
837+ auto virtualInode = VirtualInode (std::move (tree), dirFetch->mode );
838+ virtualInode.setHasACL (dirFetch->hasACL );
839+ co_return virtualInode;
834840 }
835841
836842 auto inode = co_await std::move (loadFuture);
@@ -953,7 +959,9 @@ TreeInode::co_getChildren(
953959 -> folly::coro::Task<VirtualInode> {
954960 co_await folly::coro::co_reschedule_on_current_executor;
955961 auto tree = co_await s->co_getTree (fetch.treeId , ctx);
956- co_return VirtualInode{std::move (tree), fetch.mode };
962+ auto virtualInode = VirtualInode{std::move (tree), fetch.mode };
963+ virtualInode.setHasACL (fetch.hasACL );
964+ co_return virtualInode;
957965 },
958966 store,
959967 *dirFetch,
@@ -997,7 +1005,8 @@ TreeInode::co_getChildrenAttributes(
9971005 RelativePath path,
9981006 const std::shared_ptr<ObjectStore>& objectStore,
9991007 timespec lastCheckoutTime,
1000- const ObjectFetchContextPtr& context) {
1008+ const ObjectFetchContextPtr& context,
1009+ std::optional<bool > ancestorUnderAcl) {
10011010 auto self = inodePtrFromThis ();
10021011
10031012 if (FOLLY_UNLIKELY (isRestricted ())) {
@@ -1022,6 +1031,10 @@ TreeInode::co_getChildrenAttributes(
10221031 names.reserve (contents->entries .size ());
10231032 tasks.reserve (contents->entries .size ());
10241033 inodeLoadCleanUps.reserve (contents->entries .size ());
1034+ auto adjusted = adjustRootAclState (
1035+ getNodeId () == kRootNodeId , ancestorUnderAcl, hasACL ());
1036+ auto thisUnderAcl =
1037+ mergeAncestorAclState (adjusted.ancestorUnderAcl , adjusted.hasACL );
10251038
10261039 for (const auto & [name, _entry] : contents->entries ) {
10271040 auto subPath = path + name;
@@ -1032,6 +1045,7 @@ TreeInode::co_getChildrenAttributes(
10321045 if (sync.has_value ()) {
10331046 tasks.emplace_back (coFetchEntryAttributesFromVI (
10341047 std::move (*sync),
1048+ thisUnderAcl,
10351049 requestedAttributes,
10361050 std::move (subPath),
10371051 objectStore,
@@ -1041,6 +1055,8 @@ TreeInode::co_getChildrenAttributes(
10411055 tasks.emplace_back (coFetchTreeEntryAttributes (
10421056 dirFetch->treeId ,
10431057 dirFetch->mode ,
1058+ dirFetch->hasACL ,
1059+ thisUnderAcl,
10441060 requestedAttributes,
10451061 std::move (subPath),
10461062 objectStore,
@@ -1052,6 +1068,7 @@ TreeInode::co_getChildrenAttributes(
10521068 inodeLoadCleanUps.emplace_back (name, std::move (childResult.second ));
10531069 tasks.emplace_back (coFetchLoadedInodeEntryAttributes (
10541070 std::move (childResult.first ),
1071+ thisUnderAcl,
10551072 requestedAttributes,
10561073 std::move (subPath),
10571074 objectStore,
0 commit comments