Commit Graph

15 Commits

Author SHA1 Message Date
Wez Furlong
4c5168658f eden: teach eden redirect to use new apfs helper tool
Summary:
This commit enables mounting and unmounting using the
new helper, and fixes up the behavior of `eden redirect list`
and `eden gc` so that they have reasonable behavior when APFS
is in the mix.

The semantics of the `TARGET` field in the redirect list output
become a bit hazy when using APFS volumes; it's a bit less important
because the data isn't effectively moved to a different part of
the filesystem namespace: we're just mounting a different filesystem
over the top and it can only be accessed through its mountpoint.

Reviewed By: chadaustin

Differential Revision: D19403162

fbshipit-source-id: 136a7b02f605cde0a74016608179924be801eda9
2020-02-03 16:59:18 -08:00
Wez Furlong
c03af477eb eden: remove legacy bind mount concept from redirections
Summary:
Now that we've transitioned to the newer redirections
configuration we can remove the older bind mounts configuration
parsing, and that is what this diff does.

This is helpful because in situations where the user has run
`hg co null` as part of some troubleshooting advice, the legacy
bind mounts would remain mounted and obstruct some of the
steps that would have fixed up the users repo.

Reviewed By: pkaush

Differential Revision: D18337246

fbshipit-source-id: 23f27787d609e1c38a9c98b8b6596bb40743b9ca
2019-12-04 10:47:14 -08:00
Wez Furlong
34636666ac eden: cli: add redirect unmount command
Summary:
The purpose of this command is to unmount/unlink any configured
redirections without removing their configuration.

The intent is to call this for a mount when we are unmounting; I'll do
that bit in a follow on diff.

Reviewed By: pkaush

Differential Revision: D18801872

fbshipit-source-id: 096d9595091da72aa85f4259cbab022a1fe0c01f
2019-12-04 08:45:26 -08:00
Wez Furlong
a0ffcaa0b0 eden: redirect: use hdiutil detach to unmount images
Summary:
unmount will unmount from the VFS but still leave the image
associated with the disk image machinery and visible to `hdiutil info`.

This leaves resources associated with the mount even after it has
logically gone away, and that is undesirable.

This diff switches to using `detach` instead which unmounts and removes
the image from the disk image state.

The effect of this is that running `hg co null ; eden redirect fixup`
will completely unmount the redirections.

However, it doesn't cause them to be unmounted when the eden daemon is
stopped: that is something to address in a separate diff.

Also worth noting: only HFS+ mounts get detached successfully using this method.  APFS mounts will remain regardless, so its another reason for switching to HFS+ in D18795799.

Reviewed By: pkaush

Differential Revision: D18795800

fbshipit-source-id: dfc86d86016a0c78e67f6ae2651db681669a5b14
2019-12-04 08:45:25 -08:00
Wez Furlong
54f8bafbc3 eden: redirect: use HFS+ rather than APFS
Summary:
We've seen occasional weirdness with "resource temporarily unavailable" when working with disk images.

The internet, in the form of this stackoverflow post: https://stackoverflow.com/q/48368389/149111
suggests that this is related to APFS.

This commit switches over to HFS+ in the hope that we won't see it any more.

Reviewed By: chadaustin

Differential Revision: D18795799

fbshipit-source-id: 68e08e852770e311bcf04a8d12cb20670babf889
2019-12-03 14:54:21 -08:00
Wez Furlong
b1ffd9b2d6 eden: improve detection of bind mounts in redirect fixup
Summary:
We've seen some weird situations where the VFS has some surprising
layering.  My favorite example so far had 4 layers of mounts, with the lower 3
layers being dead edenfs mounts that were still present in the mount table but
that had no associated fuse server process.

In that situation the mount table looked approximately like this:

```
/some/path/repo             <-- top of vfs
/some/path/repo/buck-out    invisible because of the mount above
/some/path/repo             an older instance
/some/path/repo/buck-out    invisible because of the mount above
/some/path/repo             an older instance
/some/path/repo/buck-out    invisible because of the mount above
/some/path/repo             the oldest instance
```

aside from being weird this shouldn't impact our behavior, except that it was
because our logic to uncover the effective bind mount configuration just looks
at the mount table and trusts that one of the matches mounts is visible to the
VFS.

The problem is that the top layer has no buck-out bind mount redirection which
leads to buck writing lots of data to the overlay.

To resolve this we need to verify that the mount table entry is visible
in the VFS and for that we can use our existing `is_bind_mount` helper
function.

Reviewed By: pkaush

Differential Revision: D18335468

fbshipit-source-id: 509c8b43f5e69f0a42c292a7011271d81ab97919
2019-11-06 16:44:23 -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
Wez Furlong
357f2bfc1f edenfs: make eden redirect add nop if the config already exists
Summary:
mostafaeweda and otawfik observed that repeating the same `eden redirect
add` call with the same parameters was tearing down and re-mounting the bind
mount.  That shouldn't matter but it isn't as fast as not doing anything, and
sometimes hdiutil on mac can get into a weird state.

This commit compares the existing configuration against the new redirection
entry that we intend to add before applying the config; if they match then
it prints a note about not doing anything and then returns.

Reviewed By: mostafaeweda

Differential Revision: D17639592

fbshipit-source-id: 48d70d11e14a1a191ae655ad7a990c1c90c14953
2019-09-30 16:57:13 -07:00
Wez Furlong
0cd7ac7044 eden: suppress hdiutil output unless it errors out
Summary:
hdiutil is horribly verbose, which in turn causes `eden redirect fixup`
to be horribly verbose on macos, so let's supress its output when successful.

Reviewed By: simpkins

Differential Revision: D17254318

fbshipit-source-id: ed2508e554d70bdcde0f0546e24dd6155e05d258
2019-09-27 07:14:59 -07:00
Wez Furlong
bc76cfc8b3 eden: gc now compacts sparseimage files for macos redirections
Summary:
The sparse images that we mount in place of bind mounts on macos
can grow over time, and don't automatically shrink if their contents are
purged.

This commit teaches `eden gc` to run `hdiutil compact` on these images
to reclaim space.

The output from `hdiutil compact` is really verbose and noisy, so we
suppress it unless there is an error.

Reviewed By: simpkins

Differential Revision: D17254235

fbshipit-source-id: 944b3824717c8b46d8170ec729c04a93323ab7f0
2019-09-27 07:14:58 -07:00
Wez Furlong
4033ad5535 eden: fixup eden redirect fixup boo-boo
Summary:
I added a None check to make redirect fixup work on macos
where we don't return running build information, but this broke the
integration tests (which don't run on mac!) where the build information
is actually the empty string.

Only check the version date if it is truthy, otherwise it will always
evaluate as less than the cutoff date and short-circuit the fixup
command.

Reviewed By: fanzeyi

Differential Revision: D17113336

fbshipit-source-id: 38dff9157a760b747958722e70567871dccd8cc0
2019-08-29 11:05:05 -07:00
Wez Furlong
c7e038e769 eden: add simple version gate for eden redirect fixup
Summary:
We saw some weird cases where we'd get error spew when
folks were using `eden redirect fixup` against really old servers,
despite us having fallback logic for those.

For now let's do a simple manual pre-check; we use july first as
the min server version for this; it was technically available earlier
than that, but this seems like a safe date to use in case of delays
in pushing out that code.

Reviewed By: strager

Differential Revision: D17094330

fbshipit-source-id: 239378906d382cb249a74e1534d0cd363988eaed
2019-08-28 16:49:28 -07:00
generatedunixname89002005289445
01d06886cb Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Reviewed By: sinancepel

Differential Revision: D16863919

fbshipit-source-id: c76f41992b9a1a57080eed932724b65c1fd846f5
2019-08-16 14:44:25 -07:00
Wez Furlong
482f18c982 eden: add .eden-redirections configuration
Summary:
This diff adds a single repo-wide `.eden-redirections` file that is used to
record the redirection configuration for the repo.

The redirection configuration code knows to look at this file and fold it in to
the effective configuration; the legacy bind mounts are applied first, then the
repo redirection configuration and then the user specified redirections.

The intent is that a `post-update` hook will invoke `eden redirect fixup` to
apply the configuration from the repo, and to have the eden daemon also
trigger that after (re-)mounting the repo.

In the future we can extend this to allow different profiles to be enabled
or disabled, but for now this is the minimum viable product.

Reviewed By: strager

Differential Revision: D15867225

fbshipit-source-id: b0a95936dd28283de6c7439ca8e503caef4e7247
2019-06-25 18:42:38 -07:00
Wez Furlong
66eb606372 eden: add eden redirect subcommand
Summary:
This is part of the effort to make our bind-mount configuration more
visible and easier to change.

The idea is to generalize the concept of redirection and add a command to help
manage it.

The `eden redirect add` subcommand allows creating one of two different kinds
of redirection:

* `bind` - allocate some space using `mkscratch` and mount it into the repo
* `symlink` - allocate some space using `mkscratch` and create a symlink
  that points to it from the repo

On Linux we use bind mounts to implement `bind` but on macOS, which doesn't
have a bind mount concept, we create a sparse disk image file that can grow
to match the size of the disk on which it is created (in practice these are a
7-15MB in size to start and grow as the user stores data into them).

The `eden redirect del` subcommand allows removing a redirection, including
the legacy `bind-mounts` configuration from `.eden/client/config.toml`.

The `eden redirect list` subcommand lists the effective set of redirections,
both from the new redirections configuration and the legacy `bind-mounts`
configuration, along with their state.

The `eden redirect fixup` subcommand iterates over the effective set of
redirections and can remove and reinstate any that are in a broken state.

Reviewed By: strager

Differential Revision: D15707319

fbshipit-source-id: a5dd8c44c9f748482d7b48855b1305d44267885c
2019-06-25 18:42:38 -07:00