Skip to content

Commit eeff442

Browse files
MichaelCuevasfacebook-github-bot
authored andcommitted
add ErrnoUtils library
Summary: # This diff Adds a library function for determining whether a given errno could stem from a hanging mount point. We can expand this library later if we discover more hanging mount failure modes # Context Crashes during graceful restart are plaguing macOS. Although these happen in the background, these greatly affect users because they cause Eden daemons to exit uncleanly. Because of the unclean exit, mount points get left in the mount table and cause all sorts of issues. The biggest issues are: 1) Any attempts to perform IO into the mount point fail 2) Any subsequent attempts to remount the mount point fail. These attempts fail because of #1, and Eden's startup/mount codepaths haven't been taught how to deal with this. The goal of this stack is to: 1) Introduce a mechanism to easily repro graceful restart crashes (both crashes that occur in the TakeoverClient and TakeoverServer) 2) Use the new mechanism to troubleshoot issue #2 above 3) Use the learnings from #2 to make EdenFS automatically recover from graceful restart crashes (unmount stale mounts and successfully remount any mounts that were mounted prior to the crash). Reviewed By: jdelliot Differential Revision: D72490699 fbshipit-source-id: 2d42f9961f39953abb6ad0bc12b305498e446a3e
1 parent 29df772 commit eeff442

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

eden/common/utils/ErrnoUtils.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
#pragma once
9+
10+
#include <cerrno>
11+
12+
namespace facebook::eden {
13+
14+
inline bool isErrnoFromHangingMount(int err, bool isNFS) {
15+
if (isNFS) {
16+
// Hard NFS mounts tend to return EIO, whereas soft NFS mounts return
17+
// ETIMEDOUT
18+
return err == ENOTCONN || err == EIO || err == ETIMEDOUT;
19+
} else {
20+
// FUSE mounts (seem to) always return ENOTCONN when the mount is hanging
21+
return err == ENOTCONN || err == EIO;
22+
}
23+
}
24+
} // namespace facebook::eden

0 commit comments

Comments
 (0)