Commit Graph

9 Commits

Author SHA1 Message Date
Genevieve Helsel
2c54a86698 refactor OverlayFileAccess errors
Summary:
This moves error handling with `OverlayFile` closer to the source of the error with the use of `folly::Expected`.

This is for future IOReference counting but also lets us transform all of these generic `std::system_error`s into InodeErrors (which is a subclass of `std::system_error` that can include inode path in the error message).

Another option for error handling would be to throw folly::checkUnixError inside the `OverlayFile` instead of returning a `folly::Expected`, but I am always hesitant to assume that the user of this class wants the error to be thrown, since they may want to do some other work (cleanup etc) before throwing an error.

Reviewed By: chadaustin

Differential Revision: D18215242

fbshipit-source-id: 5e38fdc7e6efe7d646dd3895932c9b2f26674b36
2019-11-06 18:24:58 -08:00
Genevieve Helsel
054af7d73e provide File wrapper to ensure writes are not allowed when overlay is closed from FileInode
Summary: This file wrapper is returned instead of a `folly::File` when talking with the `Overlay`. This is basework for supporting closing the `Overlay` class even if it is still in use so file modifications on files given from the `Overlay` can be denied if the `Overlay` is closed.

Reviewed By: chadaustin

Differential Revision: D17973664

fbshipit-source-id: e4b9778b3a830b6310fda4a9e66b459530b9fe17
2019-11-06 18:24:58 -08:00
Andres Suarez
fbdb46f5cb Tidy up license headers
Reviewed By: chadaustin

Differential Revision: D17872966

fbshipit-source-id: cd60a364a2146f0dadbeca693b1d4a5d7c97ff63
2019-10-11 05:28:23 -07:00
Adam Simpkins
aa5e6c7295 update license headers in C++ files
Summary:
Update the copyright & license headers in C++ files to reflect the
relicensing to GPLv2

Reviewed By: wez

Differential Revision: D15487078

fbshipit-source-id: 19f24c933a64ecad0d3a692d0f8d2a38b4194b1d
2019-06-19 17:02:45 -07:00
Eamonn Kent
e8a8830e72 Isolate low-level overlay logic into FsOverlay
Summary:
In this change, we separate the low-level code that manipulates the overlay
into the FsOverlay class. The Overlay class makes use of the FsOverlay and
InodeMetaData table to support its Overlay interfaces. The FsOverlay class
is decoupled from the Overlay class, allowing other classes to manipulate
the overlay independently. We have a need for this in order to add
fsck to the c++ code base : described in T40728883.

Reviewed By: simpkins

Differential Revision: D14218281

fbshipit-source-id: 66c587f2b341579b8075ca5e5eeb4da6ffadf6f5
2019-03-11 17:30:21 -07:00
Chad Austin
eafd6107de add missing gflags headers
Summary:
Not sure why gflags is automatically included on Linux and not in
mode/mac, but add the includes nonetheless!

Reviewed By: strager

Differential Revision: D14389458

fbshipit-source-id: 27811ec4bb65b03e73b15bb51de1264dbfe053dc
2019-03-08 14:43:24 -08:00
Adam Simpkins
42b4ffd194 add an Overlay::initialize() function
Summary:
Add an Overlay::initialize() function, and consolidate all Overlay
initializtion logic in this function.  Previously some initialization was done
by the Overlay constructor, and some was done in `EdenMount::initialize()`

Overlay::initialize() returns a folly::SemiFuture as it may perform a
non-trivial amount of disk I/O.  However, at the moment it currently performs
all I/O in the current thread before it returns.  I plan to move this work to
a separate thread in a subsequent diff.

Reviewed By: strager

Differential Revision: D13981140

fbshipit-source-id: b59eaef88012a8e74fcb770a9c93ca3f9bde32a0
2019-03-06 20:33:42 -08:00
Adam Simpkins
798ccc750a track EdenMounts while they are initializing
Summary:
This updates the logic in EdenServer to add the EdenMount to the mountPoints_
map as soon as it is created, so that we track mount points as they are
initializing.

I don't expect this change to have any major impact in functionality yet.  In
a subsequent diff I also plan have EdenServer keep mount points in the
mountPoints_ map longer while they are shutting down.  I expect that change to
matter a bit more, as that will allow us to do a better job reporting and
debugging when mount points are taking a non-trivial amount of time to become
unreferenced and fully shut down.

Reviewed By: strager

Differential Revision: D13503050

fbshipit-source-id: 2e0e8dfde64c6a005efd6dcf503ad7577f314356
2019-01-16 19:35:09 -08:00
Chad Austin
2e53003e4a introduce an OverlayFileAccess class with a handle cache
Summary:
Move the overlay IO logic out of FileInode into a centralized OverlayFileAccess class. It keeps the last 100 overlay file handles open.

FileInode's changes are coming in D13325079.

Reviewed By: strager

Differential Revision: D13324995

fbshipit-source-id: 04fb3fe50114b0f19b78acd17a9684c92f8e8072
2018-12-12 17:10:29 -08:00