Skip to content

Commit

Permalink
refactor FileInode to avoid using its parent's TreeInode::Entry
Browse files Browse the repository at this point in the history
Summary:
Refactor FileInode and FileData so that they no longer store the
TreeInode::Entry that refers to this file.  The TreeInode::Entry is owned by
the parent TreeInode and is not safe to access without holding the TreeInode
contents_ lock, which the FileInode code never did.  Additionally, once a
FileInode is unlocked the TreeInode::Entry is destroyed.  Previously the
FileInode code would retain its pointer to this now invalid data, and could
still dereference it.

In the future I think it might be worth refactoring the FileInode/FileData
split a bit more, but this at least addresses the issues around invalid
accesses to entry_.

Reviewed By: bolinfest

Differential Revision: D4688058

fbshipit-source-id: 17d5d0c4e756afc6e3c4bb279cb1bb5231f3134f
  • Loading branch information
simpkins authored and facebook-github-bot committed Mar 11, 2017
1 parent 90b44c1 commit d1e1e4c
Show file tree
Hide file tree
Showing 14 changed files with 347 additions and 341 deletions.
4 changes: 3 additions & 1 deletion eden/fs/inodes/Dirstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ class IgnoreChecker {
}

auto data = ignoreInode->getOrLoadData();
data->materializeForRead(O_RDONLY);
auto materializeFuture = data->ensureDataLoaded();
// TODO: Use a future callback rather than blocking here
materializeFuture.get();
ignore->loadFile(data->readAll());
}

Expand Down
Loading

0 comments on commit d1e1e4c

Please sign in to comment.