Commit Graph

5059 Commits

Author SHA1 Message Date
Chad Austin
938bbbea14 remove some unnecessary includes from ServerState.h
Summary:
ServerState.h is a widely-included header, as it's the dependency
injection seam used by EdenFS's inodes layer.

It included several unnecessary headers. I noticed this by seeing too
many files recompile when changing PrivHelper.h.

Replace the includes with forward-declarations.

Reviewed By: kmancini

Differential Revision: D45260059

fbshipit-source-id: 31a73030c9eb592107e8786be026e32eea80ceb4
2023-05-11 18:29:21 -07:00
Chad Austin
85de7a56d9 move the addBindMount and removeBindMount implementations to EdenServiceHandler
Summary:
EdenMount used to track the set of bind mounts for a checkout. That's
long been removed, and bind mounts are now managed by the CLI (and
rectified against the mount table).

Move these vestigial EdenMount methods into EdenServiceHandler,
simplifying lifetimes and moving us closer to breaking EdenMount's
dependency on PrivHelper.

Reviewed By: kmancini

Differential Revision: D45259970

fbshipit-source-id: e9f1bb1c44fb74e49ece08416fbe1913dd1a6ea1
2023-05-11 18:29:21 -07:00
Chad Austin
73f384fe02 privhelper no longer needs to include sys/wait.h
Summary:
We use SpawnedProcess on all platforms to start the privhelper, so we no longer
need to include sys/wait.h. This removes a conditional #include.

Reviewed By: genevievehelsel

Differential Revision: D45259880

fbshipit-source-id: dd54c60c13e34fc819eec4c4143e3c7da37329b0
2023-05-11 18:29:21 -07:00
Chad Austin
779cee2f1a privhelper is no longer FUSE-specific, so move it to fs/
Summary:
We use privhelper for NFS too, so move fs/fuse/privhelper into
fs/privhelper.

Reviewed By: kmancini

Differential Revision: D45243273

fbshipit-source-id: cfc93b324768809c87075b0085905e873c7ea88d
2023-05-11 18:29:21 -07:00
Chad Austin
dde0445e57 break PeriodicTask's dependency on EdenServer
Summary:
I was hacking on EdenServer.h in an inner loop, and noticed my laptop
was spending time recompiling PeriodicTask every time. PeriodicTask
only needs an EventBase, so break that dependency.

Reviewed By: genevievehelsel

Differential Revision: D45788655

fbshipit-source-id: 9f61601906428dcdf4bff515c623f4b61a763d15
2023-05-11 15:06:37 -07:00
Chad Austin
8560b6db53 silence a GCC warning
Summary: GCC doesn't understand that the memcpy initializes the std::array.

Reviewed By: genevievehelsel

Differential Revision: D45760663

fbshipit-source-id: 5f860a4113a26394e49303fdf1ca59865a86834b
2023-05-11 14:49:34 -07:00
Chad Austin
3761c25dad break EdenMount.h's dependency on Nfsd3.h
Summary:
It's unfortunate that changing NFS code causes most of the inode layer
to recompile. One benefit of FsChannel is we can begin to decouple
EdenMount from FUSE, NFS, and PrjFS. Remove the Nfsd3.h include from
EdenMount.h.

Reviewed By: kmancini

Differential Revision: D45167461

fbshipit-source-id: 41650390cbd053233dfe3baf051c592bc203de56
2023-05-11 11:55:24 -07:00
Chad Austin
f851c66fd0 move waitForPendingWrites into FsChannel
Summary:
waitForPendingWrites is general to any userspace filesystem with
asynchronous write notifications. This could even include FUSE in
writeback caching mode. To remove another ifdef, move
waitForPendingWrites into FsChannel.

Reviewed By: kmancini

Differential Revision: D45167206

fbshipit-source-id: 4daec70845864d90b94739fe2011e8ed90a6a200
2023-05-11 11:55:24 -07:00
Chad Austin
f55c686316 remove an ifdef around getPrjfsChannel
Summary:
Even though PrjfsChannel has no definition on unix, we can still offer
the function. This removes an ifdef. Any attempt to PrjfsChannel
remains limited to Windows.

Reviewed By: kmancini

Differential Revision: D45167158

fbshipit-source-id: b2769ba003c3decf964c9cea06b8b4238ed5887c
2023-05-11 11:55:24 -07:00
Chad Austin
a6486c18d4 make setTestFsChannel platform-independent
Summary:
There's no need setting a test FsChannel needs to be prjfs-specific,
so remove the ifdef and introduce setTestFsChannel.

In the future, it would be nice if the FsChannel was specified at
construction so EdenMount can just be given an appropriate one during
tests.

Reviewed By: kmancini

Differential Revision: D45167055

fbshipit-source-id: 4274e827a8cf0578b88b63214558236aceb12604
2023-05-11 11:55:24 -07:00
Chad Austin
9ea012a432 log fs_channel_type with FsChannel::getName()
Summary:
The only remaining use of EdenMount::getMountProtocol() is for
stringifying into the FinishedMount StructuredLog event. We can use
FsChannel::getName() instead. The only difference is that
FsChannel::getName() is lowercase, but I did not see anything using
the logged value.

Reviewed By: kmancini

Differential Revision: D45159419

fbshipit-source-id: 08b6a21d910bdf9c27f91c3e021c7ca8c902d478
2023-05-11 11:55:24 -07:00
Sean Lawlor
eaf0c27ae7 Vendor v0.8.4 with fix in multi_call
Summary:
Also includes patch that jsgf had included, so I'm removing the patch here

UPDATE: Bumping to 0.8.4 - Includes div-by-0 potential bug in factory stats

Reviewed By: Imxset21

Differential Revision: D45779506

fbshipit-source-id: f7cd2946ae6e2c81b0a6c708165c19b218645b4c
2023-05-11 11:33:10 -07:00
Chad Austin
3f9cee4f2a remove all but one inclusion of folly/String.h in headers
Summary:
We almost never intend to include folly/String.h, especially in
headers, and it's a somewhat expensive header.

We sometimes use the string transformation functions in .cpp files,
but rarely in .h. Therefore, remove that dependency where we can.

Reviewed By: genevievehelsel

Differential Revision: D45672957

fbshipit-source-id: 11743156388aff5c61cfe6b46e385a95687a7a31
2023-05-11 11:10:01 -07:00
Chad Austin
9e3f346765 minor VirtualInode refactoring
Summary:
I'm about to make some changes to VirtualInode. In advance, refactor a
few things I noticed.

Reviewed By: kmancini

Differential Revision: D45672797

fbshipit-source-id: 7edf67ac14fb9b98324d3ed20eecbebb5ff903c6
2023-05-11 11:10:01 -07:00
Chad Austin
f7ac4e9668 port VirtualInode to match
Summary:
I'm about to make some changes to VirtualInode. In advance, clean up
the visits with the new `match` function.

Reviewed By: mshroyer

Differential Revision: D45629562

fbshipit-source-id: f7bab01366f88c2e5a8f3d2a6d8eecef4f769d5a
2023-05-11 11:10:01 -07:00
Chad Austin
39411c9714 port JournalDelta to use match
Summary:
Test out `match` by porting JournalDelta to it from `std::visit`. Much
nicer!

Reviewed By: mshroyer

Differential Revision: D45629545

fbshipit-source-id: 96af83589cdfed26adf4d67f4a97dc2b375caa28
2023-05-11 11:10:01 -07:00
Chad Austin
496e469ae1 introduce a useful pattern-match function over std::visit
Summary:
std::visit is awkward. We typically do a lot of `if constexpr`. It's
nice to match with a set of lambda overloads instead.

Reviewed By: mshroyer

Differential Revision: D45629520

fbshipit-source-id: f4102365a97cfd92910a013ddb6475fed3863eb9
2023-05-11 11:10:01 -07:00
Xavier Deguillard
2c4c6e1433 Back out "remove an unnecessary use of makeSemiFutureWith"
Summary: The SpawnedProcess constructor can throw in some cases. In these, we want to make sure `EdenMount::performBindMounts` returns a failed `SemiFuture`, not throw an exception as throwing an exception will lead to a mount failure while it is instead desirable to continue the mounting process.

Reviewed By: chadaustin

Differential Revision: D45759407

fbshipit-source-id: 9c190bf5e29ae4b4d94089b6d469506deb4572f6
2023-05-10 19:41:19 -07:00
Jeremy Fitzhardinge
08597193a8 third-party/rust: patch ractor with https://github.com/slawlor/ractor/pull/104
Summary:
Use tokio's unstable `tracing` feature to name tasks after their
actors.

This also pulls in https://github.com/slawlor/ractor/pull/102 which had been merged to `main` but not yet released.

Reviewed By: slawlor

Differential Revision: D45739076

fbshipit-source-id: 3bc51d2bafb3278501b291c1391e5349845a8eb2
2023-05-10 18:23:53 -07:00
Chad Austin
29ee0304c4 break Memory.h dependency on FBString.h
Summary:
In my build time benchmarking on Windows, FBString.h is a surprisingly
expensive header. It pulls in a lot of BoostPP. Remove the #include
from our Memory.h.

Reviewed By: genevievehelsel

Differential Revision: D45719327

fbshipit-source-id: b2acfa5efed6fa4e34e9c79210aaac2df0b6888e
2023-05-10 16:26:12 -07:00
Chad Austin
599884f228 remove a folly/Range include from GitBlob.h
Summary: GitBlob doesn't use folly/Range, so break that dependency.

Reviewed By: genevievehelsel

Differential Revision: D45718919

fbshipit-source-id: cbfc5942b2753038834fee18e93e99a6643d4a40
2023-05-10 16:26:12 -07:00
Chad Austin
1c1d1dd7f7 remove includes from StringConv.h
Summary:
StringConv.h showed up as an expensive header in my build-time
benchmarking on Windows. That's because its implementation was a
template. Switching to explicit template instantiations allows us to
move the template into the .cpp.

Reviewed By: genevievehelsel

Differential Revision: D45718855

fbshipit-source-id: 66347227108c21c9d8a22456243d0fc53c4a8edf
2023-05-10 16:26:12 -07:00
generatedunixname226714639793621
ccdbc6b2c8 fbcode/eden/
Reviewed By: genevievehelsel

Differential Revision: D45563720

fbshipit-source-id: 4633e2842f21729b7f690a49f522fe81af213625
2023-05-10 16:16:04 -07:00
Katie Mancini
84902b7a93 only run trace in rage if eden is running
Summary:
Eden trace has a high failure rage - especially on OD it seems.

Our CLI data has very little info on how exactly it's failing, but we recently
added eden trace to rage. So I suspect it's related.

eden trace fails when eden isn't running (desired behavior idk, maybe).
But I think we can just stop these failures and thus alerts, by skipping
trace in eden rage when eden isn't running.

Reviewed By: chadaustin

Differential Revision: D45741612

fbshipit-source-id: 29dc474ac6f89bdb026fce62e3227b04bf223423
2023-05-10 14:25:16 -07:00
Revathy Kasipandian
cc7038c7f7 Do not print warning when eden config file don't exist
Summary:
This diff is to stop printing the  warning when the file do not exist

rkasipandian@devvm4276:fbcode default $ buck2 run mode/opt edenfsctl -- --config-dir=$EDEN_DEV_STATE --checkout-dir=$HOME/fbsource-dev rage
Buck UI: https://www.internalfb.com/buck2/2b4d15a7-8974-4c05-bfd0-4e1c4d01af10
Jobs completed: 9. Time elapsed: 0.3s.
Not reading /home/rkasipandian/.edenrc: toml config is either missing or corrupted : [Errno 2] No such file or directory: '/home/rkasipandian/.edenrc'
⠐ reading data from stdinNot reading /home/rkasipandian/.edenrc: toml config is either missing or corrupted : [Errno 2] No such file or directory: '/home/rkasipandian/.edenrc'
⠐ reading data from stdinNot reading /home/rkasipandian/.edenrc: toml config is either missing or corrupted : [Errno 2] No such file or directory: '/home/rkasipandian/.edenrc'
P726529380: https://www.internalfb.com/intern/paste/P726529380/

Reviewed By: xavierd

Differential Revision: D45718049

fbshipit-source-id: dcf4d4f2a6c41e51b8efd0493675d3be690910f1
2023-05-10 10:17:05 -07:00
Xavier Deguillard
8d49f9808f config: allow BlobMetadata to not be cached in LocalStore
Summary:
One of the yet to be root caused bug happens when the BlobMetadata stored in
the LocalStore contains the wrong value. On macOS in particular, this leads to
files being truncated (or too big), but it's also possible that Buck is
receiving the wrong sha1/size when querying EdenFS.

In order to confirm that the issue is related to the LocalStore, let's add a
configuration that allows the LocalStore to not be used for BlobMetadata, which
would allow to bypass the issue described above.

Reviewed By: chadaustin

Differential Revision: D45625431

fbshipit-source-id: ffb9dbc618486e490bfa6b1e0d4391749de64bfa
2023-05-10 09:27:19 -07:00
Mark Shroyer
ca97f27033 Make doctor's Windows ver check handle bad output
Summary:
Ensures that the doctor check for Windows version, done by running `cmd.exe /c ver`,
can handle non-utf-8 output and report it as a problem instead of terminating
with an unhandled exception.

Reviewed By: xavierd

Differential Revision: D45620254

fbshipit-source-id: c97642b3e48a76a2ff46ebc74d5257ad4c1fec18
2023-05-09 15:31:41 -07:00
Chad Austin
9e85f19db7 remove some unnecessary includes from VirtualInode.h
Summary: VirtualInode included several things it never used. Remove them.

Reviewed By: genevievehelsel

Differential Revision: D45629434

fbshipit-source-id: db937ddba1886c0fa2461ec9f1e5842462275be9
2023-05-09 15:29:04 -07:00
Chad Austin
1a77780c10 give up on trying to keep operator== out of ObjectId
Summary:
I need to use `std::optional<ObjectId>::operator==`, which uses
`ObjectId::operator==`.

I tried to make it hard to accidentally compare ObjectId, but that's
fighting a losing battle, so bring it back.

Reviewed By: genevievehelsel

Differential Revision: D45629405

fbshipit-source-id: 83c88afff0fb2954e40dd59204d0cfc76155fa70
2023-05-09 15:29:04 -07:00
Chad Austin
cef1a3e6e3 break Hash's dependency on folly/Conv
Summary: We use fmt now.

Reviewed By: genevievehelsel

Differential Revision: D45629293

fbshipit-source-id: 642087fc3fb0a1a8df4b2e26271fa52644e4f1d8
2023-05-09 15:29:04 -07:00
Chad Austin
f6210ace67 remove folly::to support from ObjectId
Summary: We use `fmt` now.

Reviewed By: genevievehelsel

Differential Revision: D45621339

fbshipit-source-id: ea61e2c645af822c12e5a9f53e85e40157746c69
2023-05-09 15:29:04 -07:00
Chad Austin
641d1544df fix getdeps build
Summary: This include is no longer necessary, so we can remove it.

Reviewed By: genevievehelsel

Differential Revision: D45620895

fbshipit-source-id: d8d9ae00cc38ad1331f8f6fb1f1c55b9d4276095
2023-05-09 10:27:42 -07:00
Xavier Deguillard
3d94505d6e store: allow LocalStoreCachedBackingStore to be configured
Summary:
One of the main objective of the LocalStoreCachedBackingStore is the ability of
configuring its policy depending on the underlying backing store. For instance,
while some backing store want to cache everything in the LocalStore, others may
only want to cache BlobMetadata. Configuring the policy per-backingstore allows
the removal and special case inside the RocksDbLocalStore of blob caching: this
is now done entirely inside the LocalStoreCachedBackingStore.

Reviewed By: chadaustin

Differential Revision: D45550480

fbshipit-source-id: 386e384f0148e38fad8d4008b4e312f360edb676
2023-05-09 09:52:52 -07:00
Revathy Kasipandian
bcf9089209 Make Prjfs Tracebus Tracebus size configurable by EdenConfig
Summary: Make Prjfs Tracebus Tracebus size configurable by EdenConfig

Reviewed By: kmancini

Differential Revision: D45384455

fbshipit-source-id: 716ad44474db6e5cc1046829f0e0639e1da9771e
2023-05-08 11:04:48 -07:00
Chad Austin
0b877177b2 enable rpc tests on Windows
Summary: There's nothing unix-specific about these tests, so enable them on Windows.

Reviewed By: genevievehelsel

Differential Revision: D45586168

fbshipit-source-id: 5acbcbe81c5c03b16e43fc561762dbafb47696b8
2023-05-08 11:03:07 -07:00
Mark Shroyer
fe7f58d5bf Error if user passes empty --config-dir to edenfsctl
Summary:
If a user relies on an environment variable in their invocation of edenfsctl,
e.g. `--config-dir=$EDEN_DEV_STATE`, then if the user accidentally leaves the
variable unset they may inadvertently specify an empty string as the path to
their config dir.

When running `edenfsctl stop`, the effect of an empty config dir path is to
shut down your main eden daemon instead of your dev daemon, so this has proven
a bit of a footgun.

Reviewed By: xavierd

Differential Revision: D45591968

fbshipit-source-id: 6df6eb8c05d94dafcaee1d6976a52310454a42d4
2023-05-08 10:36:51 -07:00
Revathy Kasipandian
707879fc5c Do not hard-fail when edenrc is corrupted
Summary: Do not hard-fail when edenrc is corrupted

Reviewed By: xavierd

Differential Revision: D45550209

fbshipit-source-id: 88b5e7249a7da2ef4c6df69a4c65f08b7832d8d2
2023-05-08 08:23:03 -07:00
Chad Austin
a3a8586a79 fix a crash in NFS graceful restart
Summary:
After a takeover, the new socket was initialized with a "remote
EventBase", causing stopAccepting to be asynchronous, tripping an
assertion.

There was a latent bug here: it might have been possible for a new
connection to be accepted by the old process after takeover begun.

Reviewed By: xavierd

Differential Revision: D45584154

fbshipit-source-id: cdd8118d82100bc1e19f6f19676cc2fa412b8775
2023-05-05 14:18:00 -07:00
Scott Ramsby
b7a3373ecb Make fmt formatter methods const
Summary:
Staging an update to the latest fmt version triggered lots of build errors due to non-`const` methods on custom formatters. This fixes the `format()` methods to be `const` as they don't mutate any state anyway, as well as `parse()` methods that don't need to mutate internal state. This mitigates many future build errors.

Updates were identified and executed by using regular expression search/replacements such as:
`(constexpr auto parse\(ParseContext& [^)]*\)) \{` -> `$1 const {`
`(constexpr auto parse\(ParseContext& [^)]*\)) ->` -> `$1 const ->`
`(auto format\(.*, FormatContext& [^)]*\)) \{` -> `$1 const {`
`(auto format\(.*, FormatContext& [^)]*\)) ->` -> `$1 const ->`

Any changes to third-party code was then reverted. Some small changes detected from subsequent build errors were then applied.

Reviewed By: vitaut

Differential Revision: D45420948

fbshipit-source-id: 211bf7f3b59616eda3cd228caf4e93ff81d4fc2b
2023-05-04 17:42:27 -07:00
Scott Ramsby
229990b06b Use iterators when calling format_to() on memory buffers
Summary: Newer versions of fmt require that you pass an iterator rather than a direct memory buffer as an output to the `format_to()` family of functions. This does that to unblock an upgrade to a newer fmt version.

Differential Revision: D45555419

fbshipit-source-id: a4e2217299ada0ab5e56942dacc9107153e4260d
2023-05-04 15:09:43 -07:00
Mark Shroyer
02cb019bd0 Doctor check for running as elevated process
Summary:
Adds an `eden doctor` check to report a problem if EdenFS is running in an
elevated process on Windows.

Reviewed By: xavierd

Differential Revision: D45169813

fbshipit-source-id: 41fd500adc1aed5641602d6dfe67cc6061d5b15d
2023-05-04 11:37:31 -07:00
Chad Austin
85b3feaf0c remove the dead Cython-based Thrift client
Summary:
We don't use the Cython-based Thrift client because it never worked in
the open source build. Removing it fixes the tests when run with
nix2rpm Python binaries.

Reviewed By: xavierd

Differential Revision: D45508963

fbshipit-source-id: d6f0e162177082a78504a3a6014a8a4d32670ccc
2023-05-04 10:53:12 -07:00
Andres Suarez
94911445f1 remove solana related crates
Reviewed By: dtolnay

Differential Revision: D45402694

fbshipit-source-id: 60aedf8c2cd8fabbcaa25edb1f0877d10a9ca4f4
2023-05-03 21:19:23 -07:00
Chad Austin
6d50eb6715 remove some redundant logging
Summary:
MountProtocol and FsChannel::getName() are the same information, so
just log the latter in this rare EDEN_BUG situation.

Reviewed By: genevievehelsel

Differential Revision: D45159212

fbshipit-source-id: 4bf4bce7889ffa704a25d7dbebcf7e13520abe1b
2023-05-03 16:22:11 -07:00
Chad Austin
76e8905821 remove some _WIN32 ifdefs
Reviewed By: genevievehelsel

Differential Revision: D45109938

fbshipit-source-id: 5e9f05f3e8bae04866a685239176bcf66e055f9c
2023-05-03 16:22:11 -07:00
Chad Austin
326c6bc189 break EdenMount's dependency on PrjfsChannel.h
Summary:
A primary advantage of existentials over sum types is that they allow
they breaking dependencies. Now that channel_ is an FsChannelPtr, we
no longer need to include PrjfsChannel.h in EdenMount.h.

Reviewed By: kmancini

Differential Revision: D45109931

fbshipit-source-id: 7774804fe4056ef5b897de294707496ff722db28
2023-05-03 16:22:11 -07:00
Chad Austin
9132786f04 unify EdenMount::channel_ on every platform
Summary:
On Windows, macOS, and Linux, EdenMount::channel_ is an
FsChannelPtr. Code that wants to branch on a specific implementation
can use getFuseChannel or getNfsChannel or getPrjfsChannel, though
those will be removed later.

Reviewed By: kmancini

Differential Revision: D45109907

fbshipit-source-id: d4b3b46bd78b9487909bf1cb7c1c754e48b6e9a9
2023-05-03 16:22:11 -07:00
Mark Shroyer
5690394add Add constants lib to Python CLI
Summary:
Our build signals for the Python CLI are currently fragile because other code
pulls main_lib into complex test cases, when it really only wants the CLI's
return code constants.  This decouples main_lib from these external tests.

Reviewed By: genevievehelsel

Differential Revision: D45404900

fbshipit-source-id: 4adb18030ac0ca934c6ceab7cbcd50ebd20c707d
2023-05-03 14:28:04 -07:00
Mark Shroyer
a6dcb211ff Use __EDENFSCTL_RUST to look up Rust binary path
Summary:
Fixes `buck2 run edenfsctl` by ensuring daemon.py knows how to use the
`__EDENFSCTL_RUST` environment variable, which we already plumb through our run
target, to lookup the path to the CLI.  This is needed so that `edenfsctl
start` can perform mounts at startup on macOS, for example.

Reviewed By: chadaustin

Differential Revision: D45533101

fbshipit-source-id: c9df700e506409f734ca98a4fb205f962fd8ed78
2023-05-03 14:19:43 -07:00
Chad Austin
da3b124374 replace force-unmount-tmp and force-unmount-all with a Python script
Summary:
The shell scripts and awk fu did not always work correctly, so use
Python to parse the Linux mount table.

Reviewed By: mshroyer

Differential Revision: D45238375

fbshipit-source-id: 6d8918b8ecbdfe37e8ceba2b0962e5f821794140
2023-05-03 11:53:45 -07:00
generatedunixname89002005307016
0df6d44d2c upgrade pyre version in fbcode/eden - batch 1
Differential Revision: D45492912

fbshipit-source-id: d237f65cb45ba6f71a1465bad7bb973c31ef0e6b
2023-05-02 23:29:54 -07:00
Chad Austin
334837ad44 move acceptStopped into EventBaseState
Summary:
As a follow-up to a code review comment in a previous diff, move
acceptStopped into the EventBaseState to make it clear it's only
accessed on the EventBase thread.

Reviewed By: kmancini

Differential Revision: D45106980

fbshipit-source-id: 5bd201a0652fa2b539e18a7584fae48fd3abd54f
2023-05-02 16:12:46 -07:00
Chad Austin
3ccec5b5e4 add initialization to FsChannel
Summary:
FuseChannel already had an asynchronous initialize(). Lift that to
FsChannel and unify initialization of Prjfs and NFS.

Reviewed By: kmancini

Differential Revision: D45106889

fbshipit-source-id: 632ddfa275c732fc30efc1984bda43f61c37fd5e
2023-05-02 16:12:46 -07:00
Chad Austin
a9fe2e37a5 remove the special case for destroying Nfsd3 on its EventBase in EdenMount
Summary:
EdenMount shouldn't know about the vagaries of FsChannel teardown. In
fact, FuseChannel already has its own requirements, hidden behind a
unique_ptr deleter. Use the same mechanism for NFS, allowing us to
remove a .via() special-case.

Reviewed By: kmancini

Differential Revision: D44810223

fbshipit-source-id: db2f88bc3843b3842de60c5a993dfd9890dc3c15
2023-05-02 16:12:46 -07:00
Xavier Deguillard
f1e93884fc prjfs: keep mount alive during notification handling
Summary:
When unmount is called, the mount is kept alive until all the pending
ProjectedFS callbacks have completed (D45135531) to avoid use-after-free.
However, the notification callback is handled entirely in the background and
would thus not prevent the mount from being unmounted, and not being freed.

In order to fix this, we need to keep the PrjfsChannelInner alive for the
duration of the notifcation handling, which as a side effect will keep the
mount alive.

Reviewed By: mshroyer

Differential Revision: D45251808

fbshipit-source-id: e78afbc388cdf75f6d8d4e774bced8fdf841db5e
2023-05-02 12:38:37 -07:00
generatedunixname89002005287564
4dce3bbeb8 Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: zertosh

Differential Revision: D45487289

fbshipit-source-id: d4a5f0f2ee4d10e8ee1c15ac34e7166945cd6aed
2023-05-02 09:19:48 -07:00
Xavier Deguillard
7193a19e8d store: allow paths to be filtered out at import time
Reviewed By: mshroyer

Differential Revision: D45162165

fbshipit-source-id: 78ae03807ae72533f8c4ec9850c38536757561b5
2023-05-01 19:37:30 -07:00
Xavier Deguillard
b1c645763c prjfs: avoid use-after-free in Prj functions
Summary:
Per Microsoft (Christian Allred), calling any Prj functions after
`PrjStopVirtualizing` will lead to use-after-free due to the internal
virtualization context being freed on `PrjStopVirtualizing`.

In EdenFS, there is a subtle cases where this may happen, in particular, if a
callback is ongoing and detached to a background thread, while
`PrjStopVirtualizing` is called as a result of `PrjfsChannel::stop`. In that case,
the callback will attempt to use a freed virtualization context and crash
EdenFS!

To prevent this, we need to make sure that `PrjStopVirtualizing` is only called
when no in-flight callbacks exits. This can be achieved by simply moving the
`PrjStopVirtualizing` into the `PrjfsChannelInner` destructor: a `shared_ptr` of
`PrjfsChannelInner` is held alive for the duration of callbacks.

After `PrjfsChannel::stop` is called, no new callbacks will be accepted due to
the `PrjfsChannelInner` field being `nullptr` thus failing IO early ensuring
that the lifetime of the mount won't be extended indefinitively.

Reviewed By: mshroyer

Differential Revision: D45135531

fbshipit-source-id: 15b25efc121ab1577c4355e07357148d122cc39f
2023-05-01 13:57:41 -07:00
Revathy Kasipandian
185c6a8345 Make Fuse Tracebus size configurable by EdenConfig
Summary: Make Fuse Tracebus size configurable by EdenConfig

Reviewed By: kmancini

Differential Revision: D45409139

fbshipit-source-id: 7ae0a5e48325ce9e29aaca218ad87a5f73cc3dff
2023-04-30 22:37:07 -07:00
Michael Cuevas
2d0766cfeb E-Menu: avoid crashing due to WndProc failures
Summary: We're seeing even more users that are crashing due to win32 errors. It seems like these sorts of E-Menu issues shouldn't crash Eden entirely. A non-functional E-Menu is better than crashing Eden entirely. Therefore, let's log these as errors for now.

Reviewed By: xavierd

Differential Revision: D45365471

fbshipit-source-id: f4092a9d44c1c5e6749e52d7e656c5de339551d3
2023-04-28 15:19:07 -07:00
Revathy Kasipandian
8860d083e7 make Thrift Tracebus size configurable with EdenConfig
Summary: make Thrift Tracebus size configurable with EdenConfig

Reviewed By: kmancini

Differential Revision: D45362951

fbshipit-source-id: 9590b94a95fbd389889d91cf5ed2cf4570684001
2023-04-28 08:40:40 -07:00
Revathy Kasipandian
acf24d55a9 make Inode Tracebus size configurable with EdenConfig
Summary: To make Inode Tracebus size configurable with EdenConfig

Reviewed By: kmancini

Differential Revision: D45334494

fbshipit-source-id: cba942272b17172ad4dd88361af4bb87ad9d4c3f
2023-04-27 21:36:16 -07:00
Xavier Deguillard
d269a86c28 prjfs: add fault in read-only dispatcher methods
Summary:
This will allow tests to easily block some methods to perform concurrent
operations to them. For instance, this will allow that unmount concurrently to
read will not crash EdenFS.

Reviewed By: mshroyer

Differential Revision: D45186931

fbshipit-source-id: 3bd1fa9191d6e18cec985159914c0ee03a22a107
2023-04-27 14:37:18 -07:00
Katie Mancini
c1d4f54d9b don't collect tace pastes in dry run
Summary:
Background runs of eden rage are making tracing pastes. We should not make these
pastes in dry-run automation runs.

I should have caught this in code review, my bad.

This uses the same fix as D28541898. Perhaps the paste method should not work in automation.

Reviewed By: xavierd

Differential Revision: D45362138

fbshipit-source-id: c28a18bc739921b3dc6e5b906c2491427f501644
2023-04-27 14:27:54 -07:00
Xavier Deguillard
e29f654146 BUILD_MODE.bzl: set NOMINMAX
Summary:
EdenFS doesn't care about the min/max definition from Windows.h, thus define
NOMINMAX. This allows removal of a lone `#define NOMINMAX` in FaultInjector.h.

Reviewed By: janondrusek

Differential Revision: D45359806

fbshipit-source-id: 7f24bda46e9720fdac471c24ff05a32c504d3eff
2023-04-27 14:18:55 -07:00
Michael Cuevas
4aa3c38e5e E-Menu: avoid crashing due to WndProc failures
Summary:
We've seen at least 1 user that crashed due to:

```
E0417 09:41:18.412118 20840 WindowsNotifier.cpp:68] TrackPopupMenuEx failed: Error (0x5a6) Popup menu already active.
F0417 09:41:18.434692 20840 WindowsNotifier.cpp:454] Exception occurred in E-Menu WndProc: TrackPopupMenuEx failed: Error (0x5a6) Popup menu already active.
```

Failures like this really shouldn't cause the entirety of Eden to crash, so let's ignore it for now.

Reviewed By: chadaustin

Differential Revision: D45130458

fbshipit-source-id: f906a17ac359f2a3c48a852d0668f70014ccd63d
2023-04-26 17:01:58 -07:00
Revathy Kasipandian
7ea1f2454b make hg tracebus size configurable with EdenConfig
Summary: make hg tracebus size configurable with EdenConfig

Reviewed By: kmancini

Differential Revision: D45256093

fbshipit-source-id: 20761aed368eb4cdecf4e116a3d3406cb83608c1
2023-04-26 14:52:32 -07:00
Ján Ondrušek
dc3850023f Windows NOMINMAX
Summary: `boost/regex.hpp` probably includes `windows.h` at some point, this causes a `min()` / `max()` macro conflict

Reviewed By: ispeters

Differential Revision: D45318842

fbshipit-source-id: 19fc29b03ca7dbf75fb6bfaef1787d8e73c329c2
2023-04-26 12:26:56 -07:00
David Tolnay
4114b89e5e Update tracing-subscriber from 0.3.16 to 0.3.17
Reviewed By: zertosh

Differential Revision: D45286804

fbshipit-source-id: bb49b1b850f150a865577411de6bb5a0d91b7a20
2023-04-25 15:59:50 -07:00
Michael Vivirito
04fdb682b5 prjfs: disallow crashplan
Summary:
Code42 was known to crawl the repository without taking
into account that files are virtual. It seems that this has been corrected in the new CrashPlan 11.0.1 agent, but we will land this diff as a safety precaution to not allow them to read the repository

Reviewed By: xavierd

Differential Revision: D45282206

fbshipit-source-id: 32f77aa96745bccb36e43d4df8ff47755a7670bc
2023-04-25 14:37:19 -07:00
David Tolnay
b5d3aab8ce Update ref-cast from 1.0.12 to 1.0.16
Reviewed By: zertosh

Differential Revision: D45278283

fbshipit-source-id: 85f83923f4a18e87b60a8ab68ab731fe74fd2a8c
2023-04-25 12:08:03 -07:00
Andres Suarez
b1c2f7d12b Apply RUSTFIX
Reviewed By: dtolnay

Differential Revision: D45273915

fbshipit-source-id: 633fcecbc38b373f6f16352f2ecfeaf41d6f12dd
2023-04-25 11:06:59 -07:00
Chad Austin
6639b2cfaf remove the now-unnecessary memory safety hack from Nfsd3
Summary:
After my previous refactoring, the memory safety bug in Nfsd3 no
longer manifests, and we can remove the unnecessary defer call.

Reviewed By: kmancini

Differential Revision: D44988749

fbshipit-source-id: 2ebd5fbf96d05ce6850fc248a642409f827ffeec
2023-04-25 10:50:52 -07:00
Chad Austin
6d3482922c remove an unnecessary ifdef now that Windows supports NFS
Reviewed By: mshroyer

Differential Revision: D44988728

fbshipit-source-id: c7d450d735756b735f056b4903e19deb84e4b356
2023-04-25 10:50:52 -07:00
Chad Austin
6be30ced2f comment clarity and remove RUNNING from RpcStopReason
Summary:
All of the comments in RpcServer are helpful. I found a couple
opportunities to improve their clarity.

It also helps to decouple RpcStopReason from the connection status.

Reviewed By: kmancini

Differential Revision: D44988608

fbshipit-source-id: 967f35ba09533a9c8c953ef33cd595b51e7c3111
2023-04-25 10:50:52 -07:00
Chad Austin
28bda31ef1 minor takeover refactoring
Summary:
I'm carefully reading the takeover code and noticed a few things to
improve.

Reviewed By: kmancini

Differential Revision: D44946740

fbshipit-source-id: 558441a47425b15c19ca2a6816ae2e8bf3d68019
2023-04-25 10:50:52 -07:00
Chad Austin
18e8b4fe77 capabilites -> capabilities
Summary:
Fix a typo. The word capabilities hurts my eyes when I look at it too
long, but it's the correct spelling, so sed it into place.

Reviewed By: kmancini

Differential Revision: D44945525

fbshipit-source-id: 05e82c058c3015b0590b07d6458840b4c56730b6
2023-04-24 19:11:42 -07:00
Chad Austin
1c3e009c34 use EventBaseState in TakeoverServer
Summary:
Out of curiosity, I'd removed a .via(getEventBase()) from
TakeoverServer, and it manifested as hard-to-understand segmentation
faults in the integration tests. The issue is that FutureUnixSocket
has EventBase affinity and must only be accessed from it.

To make this safer and more obvious, put FutureUnixSocket and the
other takeover connection state in EventBaseState.

Reviewed By: kmancini

Differential Revision: D44945469

fbshipit-source-id: add3af84a35d451385a73afb622f9b63c7cdb217
2023-04-24 19:11:42 -07:00
Chad Austin
03245b04ff move EventBaseState into fs/utils
Summary:
I want to use EventBaseState in TakeoverServer, so move it from
RpcServer to eden/fs/utils.

Reviewed By: kmancini

Differential Revision: D44945418

fbshipit-source-id: b9738162c84ca20da800d3662be6271f4b492acc
2023-04-24 19:11:42 -07:00
Chad Austin
fe121a6a84 simplify futures in TakeoverServer
Summary:
Some dead code, a judicious use of makeFutureWith, and replacement of
thenTryInline+makeAsyncTask with via+thenTry makes the implementation
of TakeoverServer easier to follow.

Reviewed By: kmancini

Differential Revision: D44945165

fbshipit-source-id: 67c7b68b892c5112620bdc1ab2a0feb7df4d1864
2023-04-24 19:11:42 -07:00
Chad Austin
a1cdb1efc2 pass folly::File by value instead of r-value reference
Summary:
For small handle types, passing by value is the correct choice,
because it indicates unconditional ownership transfer. (It also
generates slightly smaller code and is less typing.)

Reviewed By: xavierd

Differential Revision: D44927835

fbshipit-source-id: 5fefee7889e8216e46548f4801e83f51cde8b8c4
2023-04-24 19:11:42 -07:00
Chad Austin
53a027b10b kill the unnecessary getRawHiveLogger
Summary:
Simplify ServerState a bit by returning a const reference to the
member shared_ptr.

Reviewed By: xavierd

Differential Revision: D44924418

fbshipit-source-id: cd5f3a17d92b677ec7be43d9a07ed38dca1a3c24
2023-04-24 19:11:42 -07:00
Chad Austin
b98026e0be RpcConnectionHandler is the ReadCallback
Summary:
No need to have an intermediate object to forward callbacks from
ReadCallback to RpcConnectionHandler. This simplifies both memory
management and data flow.

Reviewed By: kmancini

Differential Revision: D44860344

fbshipit-source-id: af02f7d7f331d6ff3a8c4f49abb5ba1b95db5f85
2023-04-24 19:11:42 -07:00
Chad Austin
c9b5036c4c put portmap state into the EventBase
Summary: Replace another Synchronized with EventBaseState.

Reviewed By: xavierd

Differential Revision: D44860277

fbshipit-source-id: b4a2c070c29f1c484314beca483d4d7618cb8bc5
2023-04-24 16:41:38 -07:00
Revathy Kasipandian
63ca9e021d eden trace --retroactive in eden rage
Summary:
Adding the below cli outputs to eden rage

`eden trace inode --retroactive` (this one is empty though because we don't publish events right now)
`eden trace thrift --retroactive`
`eden trace hg --retroactive`

Reviewed By: kmancini

Differential Revision: D45165616

fbshipit-source-id: f4a89377fdc489e10bd78dc4175bdf89e2992cbf
2023-04-24 12:40:03 -07:00
Giuseppe Ottaviano
748d105053 Add missing re2/re2.h includes
Reviewed By: marksantaniello

Differential Revision: D45210587

fbshipit-source-id: 00af57e84d6f053082171367fe8190e7c4edb402
2023-04-23 16:16:15 -07:00
Rajiv Sharma
32a53eff54 Back out "Back out "[eden] Generalize Hash and add Hash32""
Summary: Backing out the revert of D44173515 to unblock RE with their development. I will revert my own diff instead.

Reviewed By: genevievehelsel

Differential Revision: D45190063

fbshipit-source-id: 2b14fdc2fa118719aed0f3215393d172a162639f
2023-04-22 07:14:52 -07:00
Katie Mancini
b25fc2af3a only register valid ports with portmapper
Summary:
UDS don't have port numbers, so trying to register their port with the
portmapper is going to fail. This can cause eden to fail to start when we
enable uds. The current portmapper version we use can't support
this, so let's just skip attempting to register uds servers with the
portmapper.

Reviewed By: xavierd

Differential Revision: D45196379

fbshipit-source-id: 584e6e04129d1ddbcc756ed66c55a03c3955705a
2023-04-21 17:43:55 -07:00
Xavier Deguillard
3659954679 inodes: on NFS filter AppleDouble from the Overlay
Summary:
Previously, the nfs.allow-apple-double was tentatively rolled out but had to be
rolled back as XCode disliked when an AppleDouble file was present on disk but
a new one couldn't be created. To avoid this issue, let's prevent AppleDouble
from being loaded from the Overlay and re-write the Overlay for directories
that contains one at the same time.

As a slight behavior change, the nfs.allow-apple-double is no longer read on
the fly but only read at startup time to avoid cases where a TreeInode is
already loaded with an AppleDouble and the config is flipped which would cause
XCode to fail to save files.

Reviewed By: chadaustin

Differential Revision: D44854105

fbshipit-source-id: 2c263411719d19eb1d457e26661620e8d6c905ce
2023-04-21 08:33:34 -07:00
Xavier Deguillard
f23137cda1 config: allow unordered_set in config
Summary: A future diff will create a ConfigSetting<std::unordered_set<T>>.

Reviewed By: kmancini

Differential Revision: D45162159

fbshipit-source-id: a67b3b94d708ae694041753d7dffaa6f0ff974de
2023-04-21 08:27:20 -07:00
Rajiv Sharma
2c8e74370b Back out "Generalize Hash and add Hash32"
Reviewed By: markbt

Differential Revision: D45180105

fbshipit-source-id: 94d73b5f95c6495b2953da335ce927f3b5ad9ff0
2023-04-21 07:12:24 -07:00
Chad Austin
892e5c83ff enforce the connection handler set is only updated from the EventBase
Summary:
We don't need folly::Synchronized for the RpcServer state
machine. It's only touched from the EventBase, so make it
EventBaseState.

Reviewed By: xavierd

Differential Revision: D44860240

fbshipit-source-id: bcbc3d02e7cc5f2dc377718065c7f95eed30202d
2023-04-20 18:49:40 -07:00
Chad Austin
e384876d86 rename RpcTcpHandler to RpcConnectionHandler
Summary:
There's nothing TCP-specific about RpcTcpHandler, so give it a more
accurate name.

Reviewed By: xavierd

Differential Revision: D44860198

fbshipit-source-id: 55b9dc95b2caa9d87179a17435313b91bacfee49
2023-04-20 18:49:40 -07:00
Chad Austin
b6ea3bc0ed RpcServer is the AcceptCallback
Summary:
RpcServer can handle the accept callbacks directly. There's no need
for an intermediate object.

Reviewed By: xavierd

Differential Revision: D44860163

fbshipit-source-id: fd2d96735810a52cd287c357534c8f5bae9eee90
2023-04-20 18:49:40 -07:00
Chad Austin
2164cd333a lift StateWrapper into a top-level EventBaseState so we can use it elsewhere
Summary:
I plan to use StateWrapper elsewhere so rename it to EventBaseState
and move it to the top level.

Reviewed By: xavierd

Differential Revision: D44860040

fbshipit-source-id: fb03b3b726df50099bcce144e343be0caeeaf1be
2023-04-20 18:49:40 -07:00
Chad Austin
1d73dd9d2b RpcTcpHandler is the WriteCallback
Summary:
There is no need for an intermediate object: RpcTcpHandler can handle
the write callback methods directly.

Reviewed By: xavierd

Differential Revision: D44860027

fbshipit-source-id: fe1f44b83a371291a21a3b1b26422bef5cbbf2a0
2023-04-20 18:49:40 -07:00
Chad Austin
ba132a7e4e assert that acceptStopped was synchronous
Summary:
To simplify RpcServer further, assert that removal of the accept
callback is a synchronous operation. Previously, it wasn't, because
specifying any EventBase in addAcceptCallback created a RemoteAcceptor
which scheduled operations on the other EventBase.

Reviewed By: xavierd

Differential Revision: D44853408

fbshipit-source-id: 9369cdcb0bd8450d42e195c15738362d4a53d2e7
2023-04-20 18:49:40 -07:00
Chad Austin
d8400c6faa small RpcServer simplifications
Summary:
I'm trying to track down a subtle lifetime rule violation in
EdenMount. While reading RpcServer, I noticed a few possible
simplifications.

Reviewed By: xavierd

Differential Revision: D44849773

fbshipit-source-id: 4c27c47a7e2c211dcd040acce955e9b2f617b55b
2023-04-20 18:49:40 -07:00
Chad Austin
455e7c6efa unify prjfs takeover "handling"
Summary:
This removes an ifdef _WIN32 in mount shutdown by standardizing the
takeover logic on all three platforms.

Projected FS doesn't support takeover, but removing ifdefs allows
simplifying the control flow and unblocking NFS or other FsChannel
implementations on Windows.

Reviewed By: kmancini

Differential Revision: D44737273

fbshipit-source-id: fc6b718e01698ef3700b5c198750c0e3b1f62063
2023-04-20 18:49:40 -07:00
Chad Austin
2c30d06196 unify FUSE and NFS takeover handling
Summary:
By moving NFS's StopData behind FsStopData, the std::variant and
runtime checks during takeover can be unified into one path. The next
diff will do the same for Windows.

Reviewed By: kmancini

Differential Revision: D44737160

fbshipit-source-id: 19ca623f90b367d25385f177cafa44d7bf7ebb62
2023-04-20 18:49:40 -07:00