Commit Graph

808 Commits

Author SHA1 Message Date
Xavier Deguillard
97814429bc overlay: check if we're about to save an empty path
Summary:
On Windows, we've had a couple of cases where the overlay is corrupted which
prevent remounting EdenFS. In this case, one entry of a directory was an empty
path. Let's try to catch the error when it happens, instead of after the fact.

Reviewed By: wez

Differential Revision: D21443002

fbshipit-source-id: 47e59aee803cc0b4befd6e0585836d5c68e905b1
2020-05-07 17:56:52 -07:00
Xavier Deguillard
018da41a93 service: enable several service handlers
Summary:
All of these were simply NOT_IMPLEMENTED on Windows, but the code compiles
and doesn't break any existing tests. The underlying called functions might
have been implemented already, or are NOT_IMPLEMENTED, either way, this reduces
the amount of `#ifdef _WIN32`.

Reviewed By: chadaustin

Differential Revision: D21405622

fbshipit-source-id: bdc2de41d6a57e1c0b532e76eeb2c0c86180d558
2020-05-07 09:52:18 -07:00
Xavier Deguillard
5fc68d15f9 inodes: enable RenameTest on Windows
Summary:
Only the mtime test had to be disabled due to getMetadata not being tracked
on Windows.

Reviewed By: wez

Differential Revision: D21312680

fbshipit-source-id: 5678956ed2b8b45b38d44c459557161aa6fd222e
2020-05-05 18:14:55 -07:00
Xavier Deguillard
6d726d574a inodes: enable RemoveTest for Windows
Summary:
Fairly straightforward, one change to the test was necessary as reading an
unlinked file cannot be done on Windows.

Reviewed By: wez

Differential Revision: D21312681

fbshipit-source-id: c8cca5eeca7825983176ef618007c514b8e02140
2020-05-05 18:14:54 -07:00
Xavier Deguillard
6d4a55a3ea win: change the argument order for writeFile
Summary:
This brings it closer to folly::writeFile which should help in avoiding ifdef
whenever we want to use it.

Reviewed By: wez

Differential Revision: D21319020

fbshipit-source-id: 80fbf7fba671b18b5ef68375910e1a2a8869f590
2020-05-05 18:14:54 -07:00
Xavier Deguillard
84b25c7abb eden: fix Windows build
Summary:
The MSVC compiler complains that it doesn't have the full definition of
PrivHelper, causing the build to fail. Include the right header to fix this.

Reviewed By: genevievehelsel

Differential Revision: D21381946

fbshipit-source-id: 0d0389ee8db44a36786973404c38487a94e8c4df
2020-05-04 11:53:33 -07:00
Adam Simpkins
129d87fe23 use the normal PrivHelper.h header file on Windows
Summary:
While EdenFS does not use a separate privhelper process on Windows, it still
defines a stub PrivHelper class.  However, this class was previously defined
in a separate win/utils/Stub.h header file, which led to awkward `#ifdef`s to
include the correct platform-specific header file.

This diff moves the definition of the dummy PrivHelper class in Windows into
the same `PrivHelper.h` header file used on POSIX platforms.  This results in
a few more `ifdef`s in the PrivHelper files, but fewer `ifdef`s in the calling
code, and will make it easier to start unifying more of the `EdenMain` logic
on Windows and non-Windows platforms.

Reviewed By: xavierd

Differential Revision: D21332568

fbshipit-source-id: c63bf2b4a8b7e767d7db7dcda28675f735c23bf8
2020-05-01 14:01:40 -07:00
Chad Austin
ec00e91309 disallow setting suid, sgid, and sticky bits
Summary:
FUSE_HANDLE_KILLPRIV expects that any write() call is handled by
clearing the setuid and setgid bits in the userspace. To avoid
implementing that behavior, disallow setting setuid or setgid in the
first place.

Reviewed By: xavierd

Differential Revision: D21333703

fbshipit-source-id: eb084ee8b00afe74c0da26e41c32c2cb742723da
2020-04-30 15:18:35 -07:00
Adam Simpkins
c55781c666 move UserInfo to eden/fs/utils/
Summary:
Move the `UserInfo` code from `fuse/privhelper` to `utils`, and also unify the
POSIX and Windows implementations of this class.

This code was originally put in the `fuse/privhelper` directory since it was
written at the same time as the privhelper.  However, it's really a
lower-level library that doesn't depend on FUSE or any of the other code in
the `fuse/` subdirectory.

Reviewed By: wez

Differential Revision: D21296594

fbshipit-source-id: f58682f6ce86bba0328472c491bb4c0dc3370319
2020-04-29 17:21:12 -07:00
Wez Furlong
28706ca81b eden: implement getFileInformation on windows
Summary:
The operation originally wanted to operate on the fuse `Attr`
structure which we don't have on Windows, so I repurposed the
`InodeBase::getattr` into `InodeBase::stat` and moved the conversion
of `struct stat` to `Dispatcher::Attr` to the `EdenDispatcher::getattr`
method (and a couple of other adhoc places that were doing a similar
conversion).

Reviewed By: chadaustin

Differential Revision: D20562459

fbshipit-source-id: 6b538110038352e9b5590fcb5ff5c33fe84ac1d8
2020-04-28 22:10:15 -07:00
Xavier Deguillard
a624458b82 inodes: enable InodeTimestampsTest on Windows
Summary:
The only change I had to make was due to the fact that MSVC wasn't smart
enough to realize that the shift value couldn't be negative, so a manual
folly::to_unsigned was added to silence the warnings.

Reviewed By: simpkins

Differential Revision: D21268634

fbshipit-source-id: e65f15d58d5ea23bfa6796bab23cf1f5c2e7c12c
2020-04-28 21:37:50 -07:00
Xavier Deguillard
b4fe0765f9 inodes: add InodePtrTest to Windows
Summary:
On Windows, the expected refcount is one less than what it is on Linux, due
to the .eden directory not being present.

Reviewed By: simpkins

Differential Revision: D21268203

fbshipit-source-id: 91cfe742fa4d576917d552964d9541dc68ad2c75
2020-04-28 21:37:49 -07:00
Chad Austin
61e738cd84 use enumValue instead of static_cast<int>
Summary:
Where appropriate, replace uses of `static_cast<int>` with
`enumValue`.

Reviewed By: simpkins

Differential Revision: D20975196

fbshipit-source-id: 581643366ea7eda5d1961238b0693cf45c4eec94
2020-04-28 18:59:34 -07:00
Genevieve Helsel
cfb64a0a2d clean up EdenMount destruction process
Summary:
In the past, if an EdenMount got stuck while shutting down (inodes still referenced), the EdenMount would already be removed from the server's `mounPoint's` map while stuck. This resulted in `eden list` showing that the mount was not mounted, and then if we tried to remount the mount, we'd get a confusing error message about the not being able to grab the overlay lock. This also made it so if we tried to attach with gdb, or if we core dumped and tried to look at the data, we wouldn't be able to examine the object.

Instead, we should only remove the mount from the `mounPoints_` map after it has completely been shutdown. This will allow us to get better signal on the state of the mount (it will be in the `SHUTTING_DOWN` state in `eden list` instead of `(not mounted)`) and it will allow us to better debug these situations (where a mount is stuck shutting down) since we can get more information about the mount that is in this state.

Reviewed By: simpkins

Differential Revision: D21211544

fbshipit-source-id: 97ff11df67d0a80f47cf6b9f563876e17bd76622
2020-04-28 12:44:12 -07:00
Xavier Deguillard
04b66ffe7e use uint32_t for UnloadedInode::numFuseReferences
Summary:
From looking at the code, it appears that the FUSE refcount is always a
uint32_t, except when serialized. Let's do the signedness conversion and
narrowing then.

Reviewed By: simpkins

Differential Revision: D21240161

fbshipit-source-id: 877c6cb6881cb36346c64cf92d99b1e588aed580
2020-04-28 10:14:55 -07:00
Xavier Deguillard
d3e2ed6ac7 inodes: enable InodeLoaderTest for Windows
Summary: All the tests are passing

Reviewed By: simpkins

Differential Revision: D21265852

fbshipit-source-id: 5e038c22cde5dbaf1e45e9a15e31390dac3a85a1
2020-04-28 08:34:48 -07:00
Xavier Deguillard
b1d9127dfb inodes: enable GlobNodeTest on Windows
Summary:
The disabled test uses chmod and symlinks that aren't present in the WIN32
build. I'm not exactly sure why the .eden couldn't be found though.

Reviewed By: simpkins

Differential Revision: D21264070

fbshipit-source-id: da7385d9de4002c99fcbe79f37bd09acd41fbec8
2020-04-28 08:34:47 -07:00
Xavier Deguillard
456ed17674 enable Checkout.modifyThenRevert
Summary:
At the end of the test, the test assumes that an old uncommited version of
the file can be retrieved thanks to the files living in the overlay. On
Windows, the files are written directly onto the Projected FS cache, and thus
the old version of the file cannot be retrieved.

Reviewed By: pkaush

Differential Revision: D21193209

fbshipit-source-id: a4db6fb2bfc68817601725f97a6d47f2319b83c7
2020-04-26 21:14:24 -07:00
Xavier Deguillard
ad570291e4 enable the checkout tests on Windows
Summary:
While I had to disable a bunch of them at first, this allow them to compile
properly and run. Future diffs will attempt to enable the disabled ones.

Reviewed By: pkaush

Differential Revision: D21188118

fbshipit-source-id: 154fec49c76563b0856fa36e78b2bbd09f0f2381
2020-04-26 21:14:24 -07:00
Wez Furlong
15f27eae3f eden: enable globFiles on windows
Summary:
This enables globFiles for Windows, with some
minor tweaks around dtype to enable the build and make
the results consistent between watchman and eden.

Reviewed By: chadaustin

Differential Revision: D20536715

fbshipit-source-id: b1c8184dc664910e4d052a21b4cd993ddfaadf25
2020-04-24 15:57:27 -07:00
Puneet Kaushik
139717db04 Add DiffTest to CMake build
Summary: This diff ports DiffTest on Windows and enables them for the CMake builds.

Reviewed By: simpkins

Differential Revision: D20480869

fbshipit-source-id: 77eda5ef53e4cd19552f0da52de4ff53d9807cc3
2020-04-24 14:57:43 -07:00
Puneet Kaushik
db6ac0136e Add InodeBaseTest and TreeInodeTest to CMake build
Summary: This diff adds readdir tests for Windows and enables InodeBaseTest and TreeInodeTest for CMake build.

Reviewed By: simpkins

Differential Revision: D20480866

fbshipit-source-id: 44fb33448c2e6cdb3ecce08136bf8b9e1d5c398a
2020-04-24 14:57:43 -07:00
Puneet Kaushik
2fc667fc2a Add InodeMapTest to CMake build
Summary: This diff make the InodeMapTest work on Windows and enables this test on all the platforms for CMake build.

Reviewed By: wez

Differential Revision: D20480865

fbshipit-source-id: 8f13f88bb3655475c635c889851e39672ce5b9c7
2020-04-24 14:57:43 -07:00
Puneet Kaushik
be9628b2bc Enable hg update on Eden Windows
Summary: This diff enables running source control update and rebase operations on Eden Windows clones.

Reviewed By: wez

Differential Revision: D20480873

fbshipit-source-id: 9e7cd6acdd9aedc87ddfe126718f48509d1d7c4f
2020-04-24 12:46:19 -07:00
Puneet Kaushik
4fb5762206 Clean up prjfs cache on update
Reviewed By: wez

Differential Revision: D20480872

fbshipit-source-id: ec006be468e231de3292466bfcc0df8292341fc5
2020-04-24 12:46:19 -07:00
Puneet Kaushik
2cc0d4385c Update EdenDispatcher to use Inode backed fs data on Windows
Summary:
This diff updates the EdenDispatcher to fetch/update the FS info in EdenMount which is backed by InodeTree. This helps to store the FS state in the Inode structure, which are used for source control status and update operations.

Also added a custom formatter definition for RelativePathPiece to make it easy to log relative paths.

Reviewed By: simpkins

Differential Revision: D20480861

fbshipit-source-id: b4bf1da3eeebeaee46a4a187eea9193302182068
2020-04-24 12:46:18 -07:00
Puneet Kaushik
74bc023b18 Remove old EdenMount code
Summary: Eden Windows now shares the common EdenMount code. We can remove the unused version of EdenMount.

Reviewed By: simpkins

Differential Revision: D20993231

fbshipit-source-id: 943ee540c5f2aa30827afb73658cb0250143e4af
2020-04-24 12:46:17 -07:00
Puneet Kaushik
133e5faa7c Switch to new EdenMount
Summary:
This diff enabled building the Inodes code on the Windows platform. With this we also swtich to using the new merged version of EdenMount.
From this diff onwards Eden Windows works with Inodes.

Reviewed By: simpkins

Differential Revision: D20955997

fbshipit-source-id: 9b9d8bf56c352c98a3018e5bb389e35489ebd6fb
2020-04-24 08:33:27 -07:00
Puneet Kaushik
69aaf55c2d Update EdenMount to handle FS operations on Windows
Summary: These API will handle the file system requests for each mount.

Reviewed By: simpkins

Differential Revision: D20480868

fbshipit-source-id: 84149af4449d258149fce97bb227d45d8d3d0e3a
2020-04-24 08:33:26 -07:00
Puneet Kaushik
9a2c23cfcf Implement readdir for ProjectedFS requests
Summary: Adds a new version of readdir which populates FileMetadata. This version of readdir is used to return the result to Projected FS.

Reviewed By: wez

Differential Revision: D20480876

fbshipit-source-id: dae99753225bc3124e734e3926e777fb629b2a64
2020-04-24 08:33:25 -07:00
Puneet Kaushik
d366d86e61 Merge Windows and POSIX version of EdenMount
Summary: The diff merge the Windows version of EdenMount into POSIX version. We don't start using the new all platform version of EdenMount in this diff. This switch needs few more changes and is done later in this diff stack.

Reviewed By: simpkins

Differential Revision: D20480878

fbshipit-source-id: 42bfaee8769beb7a2ac45cfcff5dda2a52a7dcb0
2020-04-23 12:41:47 -07:00
Puneet Kaushik
b2cb66890b Add readdir to Eden Windows
Summary: This diff implements DirList for Windows and use it for readdir implemetation. On Windows readdir will return all the entries in one single call.

Reviewed By: simpkins

Differential Revision: D20480871

fbshipit-source-id: 15abb337c55c5016debeb0680a1a3a7063b341c3
2020-04-23 12:41:47 -07:00
Puneet Kaushik
38299c2d3a Sqlite Overlay for Inode support on Windows
Summary:
This diff introduces a sqlite based overlay, which stores the directory inode and its entries in the sqlite database. This is similar to FsOverlay but doesn't support all the functionality. Sqlite overlay in this diff is only designed to handles the requirement for Eden on Windows.

We did not build sqlite overlay as a virtual class because as of this diff the interface and functionality of this is different from fsOverlay.

Reviewed By: simpkins

Differential Revision: D20480870

fbshipit-source-id: c87cb2ffd11c6c0c7a10bc8dfaf6164e0e442b2b
2020-04-23 12:41:47 -07:00
Chad Austin
db73eb37fd make deleted default constructors explicit
Summary:
Some of our types were vulnerable to the issue described in
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1008r0.pdf so
make all deleted default constructors explicit.

Reviewed By: simpkins

Differential Revision: D21008976

fbshipit-source-id: 5b21923f25121dabf4bb0ea55f94536fb3532e6b
2020-04-14 12:47:03 -07:00
Adam Simpkins
7adf1f3e3c fix an off-by-one issue in the fsck code when formatting dates
Summary:
The `tm_mon` field returned by `localtime_r()` has a range of 0 to 11.
We want to show human-readable month numbers of 1 to 12 in the fsck directory
name and log timestamps.  Fix the formatting by adding 1 to the `tm_mon`
value.

Reviewed By: fanzeyi

Differential Revision: D20909591

fbshipit-source-id: 8625d09306b625e4e71dab9e0679fed3abc7bcf6
2020-04-09 00:18:18 -07:00
Lee Howes
dead099771 Rename collectXSemiFuture to collectX
Summary:
Migration from Future-returning executor-erasing collectX forms to
SemiFuture-returning forms, that are less risky in particular with coroutines.

Earlier changes added collectXSemiFuture and collectXUnsafe as a migration
path. We then migrated collectX callsites to collectXSemiFuture or
collectXUnsafe and switched the implementation of collectX to the SemiFuture
form.

This diff renames uses of collectXSemiFuture to collectX, as the two are
identical.

Reviewed By: simpkins

Differential Revision: D20833464

fbshipit-source-id: c14aa40f8cce121632ff922300ef271721c1d695
2020-04-03 17:15:08 -07:00
Puneet Kaushik
3bb8cfbef8 Inode support on Windows
Summary: This diff ports TreeInode, FileInode, InodeMap and related classes to Windows. We don't build or test it here, there are more dependcies we need to port. The built script and the test are part of other diffs in this stack.

Reviewed By: simpkins

Differential Revision: D19956266

fbshipit-source-id: 9eb754233bca3d5a336f465c2400512a8593ca4f
2020-04-01 14:53:30 -07:00
Wez Furlong
0a6aa21d77 eden: fix multiply defined symbols issue with ImportPriority
Summary:
This is a rough pass that resolves a linker issue on MSVC by
switching to inline static member functions.

Reviewed By: chadaustin

Differential Revision: D20529163

fbshipit-source-id: 578ed440758c685091d3e039e261638e027db17a
2020-03-20 10:56:08 -07:00
Wez Furlong
9972789892 eden: make bitfield usage in DirEntry.h more portable
Summary:
the type of `mode_t` that we were using for this on Windows
recently changed in the folly portability layer, resulting in a padding/alignment
problem that breaks our assumption at the size of this struct.

I don't believe that we were using bitfields correctly here; in my experience
all of the members must have the same type in order to get packed in the
struct correctly, because the standard doesn't define much in the way
of bitfield behavior beyond the syntax.

This commit uses an unsigned integer type for all of the bitfields
and takes a stab at using a cast when returning the actual mode
member for macOS.  This may not be right; I'm just throwing up this
diff first in order to be able to get it on a mac machine.

Reviewed By: simpkins

Differential Revision: D20529006

fbshipit-source-id: e9362bf263fab03d51cc8aa97f94f00806650618
2020-03-20 10:56:07 -07:00
Zeyi (Rice) Fan
fff1c76996 make open calls from fuse high priority
Summary: This diff bumps the open call from FUSE to High priority (which is higher than any other blob open request atm). This has shown improvement on the user experience of EdenFS when it's importing many other things from other channels (thrift, etc.)

Reviewed By: chadaustin

Differential Revision: D20287389

fbshipit-source-id: 319bc44ef8be5c904d7cf0db7cc2f8be28b4760a
2020-03-17 02:31:25 -07:00
Ratnadeep Joshi
8e4b04107c Add an option to mount a checkout read-only
Summary: Added option to mount command

Reviewed By: chadaustin

Differential Revision: D20256352

fbshipit-source-id: e52fbd10f318221777b7e2d21ed9ba0a17ce1687
2020-03-11 21:38:48 -07:00
Genevieve Helsel
3d6aecb849 don't allow checkout calls to queue
Summary: We should disallow `checkout` calls to queue. In practice, this is hard to encounter because of the Mercurial repository lock, but edge cases can slip through (user running a long `hg up` and control-cing the command and then running `hg up` again). There is not a use case in which `checkout` calls should queue, and keeping the Thrift queue clear of unnecessary (possibly) expensive commands should generally help user experience.

Reviewed By: simpkins

Differential Revision: D19894583

fbshipit-source-id: 2b6f0d6bd1f801872fa6fa66dc7728dc9c83d158
2020-03-11 09:28:22 -07:00
Puneet Kaushik
ef671b4e4e Add BlobCache to Windows EdenMount
Reviewed By: simpkins

Differential Revision: D19956271

fbshipit-source-id: d5a88ea8570421a1c61900fbad8a0f9d3e311458
2020-03-10 12:27:50 -07:00
Puneet Kaushik
db5d20b303 Move Windows EdenMount and RepoConfig to fs/inodes/win
Summary: Moving these two files to integrate them better with rest of the Inodes code.

Reviewed By: simpkins

Differential Revision: D19956267

fbshipit-source-id: 5bf8165a6dc70a0c03f71f3f73b383991f21eb56
2020-03-10 12:27:50 -07:00
Puneet Kaushik
aed430d676 Add mode_t size in DirEntry
Summary: Windows sdk doesn't define mode_t. On Windows we use mode to store the file type info which should fix in 16 bits - S_FMT is defined as 0xf000.

Reviewed By: simpkins

Differential Revision: D19956270

fbshipit-source-id: 81acd2cd708f1c82674b8b75cd607d4f5b41a156
2020-03-10 12:27:50 -07:00
Lee Howes
f15fdeec84 collectX to collectUnsafe
Summary:
Migration from Future-returning executor-erasing collectX forms to
SemiFuture-returning forms, that are less risky in particular with coroutines.

Earlier diffs added SemiFuture and Unsafe versions. This codemod migrates
collect versions to the Unsafe versions to allow the basic collect versions to
be made safe.

Reviewed By: simpkins

Differential Revision: D20331206

fbshipit-source-id: efc8dff487d45f7d53ee55e8c4696bd3eed0e6da
2020-03-10 11:36:09 -07:00
Victor Zverovich
639073cdd0 Make errnoStr return std::string instead of fbstring
Summary:
The result of `errnoStr` is often converted to `std::string` so returning `fbstring` adds an extra copy. Make it return `std::string` instead. This will also allow removing dependency between `String.h` and `FBString.h`.

(Note: this ignores all push blocking failures!)

Reviewed By: yfeldblum

Differential Revision: D20195395

fbshipit-source-id: 0dc65f1566911156be3fcb715dd105c58f2a8822
2020-03-10 10:50:44 -07:00
Hezi Zhang
d7fa579a9c Track readlink() requests during checkout and status
Summary: Pass a valid ObjectFetchContext down into certain untracked requests.

Reviewed By: chadaustin

Differential Revision: D20243575

fbshipit-source-id: e7112c3bab1265803a26130c4d72905c25f2e729
2020-03-06 11:58:25 -08:00
Chad Austin
c82a570d32 report conflicts when tree containing modified files is removed
Summary:
Eden SCM expects that DRY_RUN reports the same conflicts as a normal
checkout, but EdenFS would skip traversing deleted trees in dry run
mode. Fix that and add a test.

Reviewed By: genevievehelsel

Differential Revision: D19782543

fbshipit-source-id: 7a269e67a41b7ad6ce6c54fde37e8f74fcc1ef51
2020-02-19 11:20:55 -08:00
Wez Furlong
28f7b4a0b0 eden: show desktop notification for blob/tree fetch errors
Summary:
This commit causes a desktop notification to be shown if we generate
EIO or ETIMEDOUT responses via fuse; the prompt is intended to make it obvious
to the user that they need to connect to the VPN.

The commit by itself doesn't show a notification, it allows configuring a
command that can be run to do something to show a notification.

The test plan includes one such configuration for our corp environment.

* It doesn't trigger for thrift-originated downloads (eg: prefetch), only for
  VFS operations through FUSE.
* Ideally we'd know exactly when we have a network related error in the store
  code and use that to trigger the notification.  However, we have a rather
  convoluted set of importers and fallbacks today, one of which is interpreting
  a generic response returned from a pipe, so it is not especially clear
  exactly where we should locate the logic

Reviewed By: chadaustin

Differential Revision: D17513364

fbshipit-source-id: 45134f3672679cb5580cb0c1bc12a0d6e38525ca
2020-02-10 08:28:49 -08:00