Skip to content

Commit fbae0c1

Browse files
Orest Kyrylchukfacebook-github-bot
Orest Kyrylchuk
authored andcommitted
Compare inodes for running and configured dirs
Summary: On Devservers that are setup in a similar way as OD we use placeholder user to spin up Eden and clone repos, because of that the running directory looks like ``` /var/localhome/devenv-user-5f6c/local/.eden ``` The configured directory on the other hand looks like ``` ${HOME}/local/.eden ``` When real user reserves a new machine and tries to run `eden doctor` it fails: ``` - Found problem: The running configuration for /data/users/svcscm/configerator is different than " the on-disk state in Eden's configuration file: - Running state directory: /var/localhome/devenv-user-5f6c/local/.eden/clients/configerator - Configured state directory: /home/oresk/local/.eden/clients/configerator Running `eden restart` will cause EdenFS to restart and use the data from the on-disk configuration. ``` However it's not a real issue, because both directories are the same actually as that's because of how we setup real user on reservation, they still point to the same directory just via mount: ``` [[email protected] ~/fbsource/fbcode (387c3a67d)]$ findmnt -T /var/localhome/devenv-user-5f6c/local TARGET SOURCE FSTYPE OPTIONS / /dev/vda3 btrfs rw,relatime,compress-force=zstd:3,ssd,discard,space_cache=v2,subvolid=5,subvol=/ [[email protected] ~/fbsource/fbcode (387c3a67d)]$ findmnt -T /home/oresk/local TARGET SOURCE FSTYPE OPTIONS /home/oresk /dev/vda3[/var/localhome/devenv-user-5f6c] btrfs rw,relatime,compress-force=zstd:3,ssd,discard,space_cache=v2,subvolid=5,subvol=/ ``` Let me know if it makes sense or I need to do extra testing on a different platform like Mac/Windows Differential Revision: D73083956 fbshipit-source-id: c61087c48454b599e515b46d30217e56445f4100
1 parent 4357d39 commit fbae0c1

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

eden/fs/cli/doctor/__init__.py

+24
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,7 @@ def check_mount(
880880
elif checkout.state == MountState.RUNNING:
881881
try:
882882
check_running_mount(
883+
out,
883884
tracker,
884885
instance,
885886
checkout,
@@ -992,6 +993,7 @@ def check_starting_mount(
992993

993994

994995
def check_running_mount(
996+
out: ui.Output,
995997
tracker: ProblemTracker,
996998
instance: EdenInstance,
997999
checkout_info: CheckoutInfo,
@@ -1004,6 +1006,28 @@ def check_running_mount(
10041006
tracker.add_problem(CheckoutNotConfigured(checkout_info))
10051007
return
10061008
elif checkout_info.configured_state_dir != checkout_info.running_state_dir:
1009+
try:
1010+
configured_state_dir_inode = (
1011+
checkout_info.configured_state_dir.stat().st_ino
1012+
if checkout_info.configured_state_dir is not None
1013+
and checkout_info.configured_state_dir.exists()
1014+
else None
1015+
)
1016+
running_state_dir_inode = (
1017+
checkout_info.running_state_dir.stat().st_ino
1018+
if checkout_info.running_state_dir is not None
1019+
and checkout_info.running_state_dir.exists()
1020+
else None
1021+
)
1022+
if (
1023+
configured_state_dir_inode is not None
1024+
and configured_state_dir_inode == running_state_dir_inode
1025+
):
1026+
return
1027+
except OSError as ex:
1028+
# If we fail to confirm they have the same inode, we'll just
1029+
# assume they're different and report the problem.
1030+
out.write(f"Error reading inode for state directories: {ex}", flush=True)
10071031
tracker.add_problem(CheckoutConfigurationMismatch(checkout_info))
10081032
return
10091033

eden/fs/cli/doctor/test/doctor_test.py

+5
Original file line numberDiff line numberDiff line change
@@ -2559,6 +2559,7 @@ def test_missing_config_fix(
25592559
os.unlink(checkout.state_dir / "config.toml")
25602560

25612561
check_running_mount(
2562+
out,
25622563
fixer,
25632564
# pyre-fixme[6]: For 2nd param expected `EdenInstance` but got
25642565
# `FakeEdenInstance`.
@@ -2621,6 +2622,7 @@ def test_corrupted_config_fix(
26212622
print(f.read())
26222623

26232624
check_running_mount(
2625+
out,
26242626
fixer,
26252627
# pyre-fixme[6]: For 2nd param expected `EdenInstance` but got
26262628
# `FakeEdenInstance`.
@@ -2681,6 +2683,7 @@ def test_corrupted_config_fail(
26812683
watchman_info = check_watchman.WatchmanCheckInfo(watchman_roots)
26822684

26832685
check_running_mount(
2686+
out,
26842687
fixer,
26852688
# pyre-fixme[6]: For 2nd param expected `EdenInstance` but got
26862689
# `FakeEdenInstance`.
@@ -2753,6 +2756,7 @@ def test_corrupted_config_fail_oss(
27532756
watchman_info = check_watchman.WatchmanCheckInfo(watchman_roots)
27542757

27552758
check_running_mount(
2759+
out,
27562760
fixer,
27572761
# pyre-fixme[6]: For 2nd param expected `EdenInstance` but got
27582762
# `FakeEdenInstance`.
@@ -2815,6 +2819,7 @@ def test_corrupted_snapshot(
28152819
watchman_info = check_watchman.WatchmanCheckInfo(watchman_roots)
28162820

28172821
check_running_mount(
2822+
out,
28182823
fixer,
28192824
# pyre-fixme[6]: For 2nd param expected `EdenInstance` but got
28202825
# `FakeEdenInstance`.

0 commit comments

Comments
 (0)