Repository navigation
Conversation
ceph-fuse works now |
|
jenkins retest this please |
|
Hi Dan, I've been out of submitting for some time, but my previous experienc is that large patchsets are hard to review and take forever to get commited. So I would definitly cut this into (a lot) of smaller changes, each relevant to certain topics. But happy to see some of the commits actually address things I have in my current FreeBSD tree as well. |
|
Regarding libcephfs_proxy - instead of sprinkling ifdefs all over the place can you just disable it on your build? I doubt you need it for your use case right? |
@dvanders hi Dan, i concur with @wjwithagen on this. 66 commits are a little bit overwhelming even to the enthusiastic reviewers, as it'd be difficult to actually approve it without reading all of them, line by line. i'd suggest split it into smaller batches. so, we can review them in smaller batches, in parallel. |
|
Thanks all -- I'm working split this up into several PRs now. |
Agreed, and done — that is the better answer. I reverted the four Two fixes stayed, because neither was about Darwin: |
The strlen()/strncmp()/strncpy() arithmetic over sizeof(CLS_PREFIX) and sizeof(CLS_SUFFIX) is hard to follow and easy to get wrong, so replace it. The accepted names do not change. Signed-off-by: Kefu Chai <[email protected]>
Two of these files include <endian.h> and neither uses anything from it: there is no htobe*(), be*toh() or __BYTE_ORDER anywhere in the component. Drop it. It is a glibc header, so this is also what stops proxy_link.h from being included at all on Darwin, and with it every file that reaches for the link layer. proxy_mount.c does use PATH_MAX, for the thread-local buffer that proxy_path_iterator_resolve() resolves symlinks into, and never includes <limits.h>. It is reaching the definition through some other header on Linux; ask for it directly. Assisted-by: claude-code:claude-opus-5 Signed-off-by: Dan van der Ster <[email protected]>
proxy_helpers.c hashes with EVP_sha256() and is built into both the daemon and the client library, but only the daemon is told about OpenSSL. The client library gets away with it on Linux because /usr/include is searched anyway and a shared library is allowed to leave the symbols to be resolved at load time. Neither holds everywhere. Homebrew keeps openssl@3 keg-only, so the headers are not on any default search path and the compile fails outright with 'openssl/evp.h' file not found - for the client library only, the daemon having brought the include directory in with the target it already links. Assisted-by: claude-code:claude-opus-5 Signed-off-by: Dan van der Ster <[email protected]>
libcephfsd shares a single libcephfs mount between processes over a Unix socket, for the container cases that want it, and is written to Linux throughout: it marshals fscrypt's UAPI structures by size from <linux/fscrypt.h>, holds an unnamed file open with O_TMPFILE and names it later with linkat(AT_EMPTY_PATH), and asks recvmsg() for MSG_CMSG_CLOEXEC. None of that has a Darwin spelling, and O_TMPFILE and AT_EMPTY_PATH are absent on FreeBSD too, so the component cannot have been building anywhere but Linux. Spreading conditionals through it to make it compile elsewhere is the wrong answer - nothing on a macOS developer's cluster wants the daemon. Gate it the way the mount helper immediately above it is already gated. Suggested-by: John Mulligan <[email protected]> Assisted-by: claude-code:claude-opus-5 Signed-off-by: Dan van der Ster <[email protected]>
compat.h only forward declared cpu_set_t on Darwin, which is not enough for the callers that have to declare one - OSD::numa_cpu_set is a member, and OSDMonitor has a local. Define it, shaped like the Windows shim further down the file; numa.cc's non-Linux stubs never inspect the value. PROCPREFIX was defined for Linux and FreeBSD only, so the /proc readers in common/util.cc and common/MemoryModel.h did not compile anywhere else. Darwin has no procfs; define it empty so they build and fail at runtime instead, which they already handle. off64_t goes next to the existing lseek64 shim. Darwin's off_t is already 64 bits wide, and include/types.h has the same typedef for callers that include it instead. numa.h has to include compat.h to see cpu_set_t, as it already does on Windows. Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
memset_s() is only declared when __STDC_WANT_LIB_EXT1__ is defined before <string.h> is first included. compat.cc did define it, but only just above its own #include <string.h>, by which point include/compat.h at the top of the file had already pulled <string.h> in and the include guard made the second one a no-op. ceph_memzero_s() then failed to compile wherever HAVE_MEMSET_S was set. Move the feature macro above the first include. Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
Darwin has no Linux struct tcp_info and none of the TCP_* connection state constants; it exposes connection statistics as struct tcp_connection_info via TCP_CONNECTION_INFO, which shares no fields with the Linux structure. Reuse the stub the Windows build already uses. Mapping the Darwin structure onto the same formatter keys would be a reasonable follow-up. Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
block_device_run_smartctl(), block_device_get_metrics() and block_device_run_nvme() are defined in the Linux, FreeBSD and generic branches of blkdev.cc, but not in the Darwin one, so anything linking libmon or libosd failed with undefined symbols. Add the same -EOPNOTSUPP stubs the generic branch uses. Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
The rgw needs posix_fadvise(2), which Darwin does not have. The call is purely advisory - it hints the page cache and nothing more - so ignoring it is a faithful degradation, and it is what the bundled RocksDB already does on this platform. Keep the Linux numbering for the POSIX_FADV_* values, because they reach the callers through configuration options (rgw_d3n_l1_fadvise, rgw_d4n_l1_fadvise) rather than as literals. Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
The fscrypt code in the client (Client.cc, FSCrypt.cc) and the RGW POSIX driver (rgw_sal_posix.cc) return -ENOKEY for a missing key, and the fscrypt and keyring tests expect it. Darwin has no such errno, so those translation units do not compile there. (fuse_ll.cc already guards its entry in cephfs_errno_to_system_errno with #if defined(ENOKEY); with the define, that entry now applies on Darwin too.) Define it beside the EUCLEAN, EREMOTEIO and EKEYREJECTED fallbacks that are already in the Darwin block, keeping the Linux value 126 the way those keep theirs - the value matters, because it is what arrives over the wire and what common/darwin_errno.cc converts from. Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
RaiseHook arms a POSIX per-process timer to deliver a delayed signal. The code was gated on !WIN32, but Windows is not the only platform without timer_create(2) - Darwin does not implement POSIX timers either. Probe for timer_create() and gate on that. _POSIX_TIMERS is not a usable proxy: Darwin defines it as -1, which per POSIX means the feature is declared but unsupported. Refuse "raise --after" with -ENOTSUP wherever the timer is not built, as Windows already did, rather than failing to arm it and returning -EAGAIN. acconfig.h has to be included explicitly, because admin_socket.h does not pull it in and the macro would otherwise be invisible everywhere, quietly disabling the hook on platforms that do support timers. Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
The four AdminSocketRaise tests that exercise "raise --after" were skipped on Windows only. The asok raise hook now builds its delayed path only when HAVE_TIMER_CREATE, since Darwin, like Windows, does not implement the POSIX per-process timers, and there the tests hang until they time out. Skip on the same condition the hook is compiled under, and keep the WIN32 check in StopCont, which additionally needs SIGSTOP and SIGCONT. Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
The !HAVE_GETENTROPY && !_WIN32 branch defines the CryptoRandom members without opening namespace TOPNSPC::auth, while the #endif that follows all three branches closes it. The branch therefore cannot compile. Both of the other branches open the namespace, and no platform built in CI takes this one, so the mistake went unnoticed. Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
rgw_file_int.h already spells the timespec members both ways where it writes them, under HAVE_STAT_ST_MTIMESPEC_TV_NSEC, because Darwin calls them st_atimespec rather than st_atim. The two places that read them were missed and name the Linux members directly. Use the same guard, so the file is consistent with itself. Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
Check that an AF_INET entity_addr_t encodes to the same bytes as on Linux, and that entity_addr_t and entity_addrvec_t both reject an address one byte longer than a sockaddr_in. Both pass on Linux before and after the fix. On macOS, each half of the decode test fails without the matching decode fix in msg_types.h and msg_types.cc. Assisted-by: Claude-Code-v2.1.287:claude-opus-5-5 Signed-off-by: Dan van der Ster <[email protected]>
entity_addr_t and the legacy sockaddr_storage encoding carry the address family as a number, and every reader assumes Linux's values. AF_INET is 2 everywhere, but AF_INET6 is 10 on Linux, 23 on Windows, 28 on FreeBSD and 30 on macOS. encode() and decode() mapped it to and from AF_INET6_LINUX only on Windows, so an IPv6 address from a FreeBSD or macOS daemon reaches a Linux peer with a family the peer does not recognise, and the reverse. Define AF_INET6_LINUX everywhere and map in both the msgr2 and the legacy encoding. On Linux the mapping is a no-op. A FreeBSD or macOS daemon still decodes the native value an older daemon of the same OS sends. Fixes: https://tracker.ceph.com/issues/81504 Assisted-by: Claude-Code-v2.1.287:claude-opus-5-5 Signed-off-by: Dan van der Ster <[email protected]>
entity_addrvec_t::decode() decodes a single msgr2 address (marker 1) with its own copy of entity_addr_t::decode(), and that copy stores the wire family as is. An IPv6 address decoded that way keeps AF_INET6_LINUX (10) on FreeBSD, macOS and Windows, where AF_INET6 is 28, 30 and 23. Split the msgr2 part of entity_addr_t::decode() into decode_after_marker(), alongside decode_legacy_addr_after_marker(), and call it from entity_addrvec_t::decode() instead of the copy. Add a test that decodes an encoded msgr2 IPv6 address as an entity_addrvec_t. Move the comment for the oversized-address test back to that test. Assisted-by: Claude-Code-v2.1.303:claude-opus-5-5 Signed-off-by: Dan van der Ster <[email protected]>
entity_addr_t's conversions to and from ceph_entity_addr put the address family in network byte order with htons() and ntohs(). sa_family_t is a single byte on the BSDs and macOS, so the swapped value is truncated to 0 and the family is lost. FreeBSD was already excluded by name; macOS was not. Swap only where the family is two bytes wide, which covers both. Suggested-by: Kefu Chai <[email protected]> Assisted-by: Claude-Code-v2.1.322:claude-fable-5-2 Signed-off-by: Dan van der Ster <[email protected]>
decode() only writes the bytes that the encoding carries. When the entity_addr_t already holds an address, the rest of the sockaddr union keeps its old bytes: an IPv4 address decoded over an IPv6 one compares unequal to the same address decoded into a new object, and a blank address leaves the old one in place. Most callers decode into a new object, so this has not shown up. Clear the union in both decode paths, as the constructors do. Suggested-by: Kefu Chai <[email protected]> Assisted-by: Claude-Code-v2.1.322:claude-fable-5-2 Signed-off-by: Dan van der Ster <[email protected]>
TestAddrDecodeIntoUsedAddr decodes an IPv4 and then a blank address into an entity_addr_t that held an IPv6 address, in both encodings, and expects the same value as from a new object. It fails without the previous commit. TestAddrCephEntityAddrRoundTrip converts to ceph_entity_addr and back. On macOS it fails without the byte-swap fix: the family comes back as 0. Assisted-by: Claude-Code-v2.1.322:claude-fable-5-2 Signed-off-by: Dan van der Ster <[email protected]>
ceph_arch_arm_probe() reads the ELF auxiliary vector, so its whole body is under #if __linux__ and every flag it exports stays zero elsewhere. On Darwin that silently disabled the accelerated paths that the flags guard even though the hardware has them: crc32c.cc kept the portable implementation, and the zlib plugin's factory refused ISA-L because it asks for ceph_arch_aarch64_pmull && ceph_arch_neon. Darwin has no getauxval(3); the kernel publishes the optional CPU features as sysctl(3) nodes instead, so read them from there. A node the running kernel does not register reads back as an error, which is the answer we want for a feature that is not there. On this M-series machine the probe now reports neon, crc32 and pmull, crc32c dispatches to ceph_crc32c_aarch64 - 7383 MB/s against 1263 MB/s for the sctp fallback in unittest_crc32c - and unittest_compression exercises the zlib plugin as "zlib/isal" rather than skipping it. Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
macFUSE installs libfuse2 and libfuse3 side by side, in /usr/local/include/fuse and /usr/local/include/fuse3, and adds a compatibility shim at /usr/local/include/fuse.h whose entire content is #include "fuse/fuse.h" so a bare <fuse.h> resolves to libfuse2. Apple clang searches /usr/local/include ahead of every -isystem directory, and CMake hands an imported target's include directories over as -isystem, so the libfuse3 directory can never win that lookup. ceph_fuse.h then gets the libfuse2 declarations while fuse_ll.cc's own <fuse_lowlevel.h> gets the libfuse3 ones, and the two disagree about every shared type: /usr/local/include/fuse3/fuse_opt.h:77:8: error: redefinition of 'fuse_opt' /usr/local/include/fuse/fuse_opt.h:76:8: note: previous definition is here Marking the target IMPORTED_NO_SYSTEM emits -I instead, which is searched before /usr/local/include and picks the intended version. The property needs CMake 3.23; on anything older it is ignored and such a build has to point FUSE_INCLUDE_DIR at a single version by hand. Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
macFUSE's libfuse3 defaults FUSE_DARWIN_ENABLE_EXTENSIONS to 1, which routes the declarations through FUSE_DARWIN_EXTEND_FUNCTION and FUSE_DARWIN_EXTEND_OPERATION and hands back the Darwin flavour of the API: fuse_reply_entry() takes a fuse_darwin_entry_param, fuse_reply_attr() a fuse_darwin_attr, and the xattr operations carry an extra uint32_t position. fuse_ll.cc is written against upstream libfuse3, so every one of those call sites fails to compile. Ask for the vanilla API instead, before fuse_common.h applies its default. Ceph uses none of the Darwin extensions - no birth time, no backup time, no setvolname - so nothing is given up. That leaves the position argument on fuse_ll_setxattr() and fuse_ll_getxattr(), which has been guarded by a bare __APPLE__ since the osxfuse days. It belongs to the FUSE 2 API, where macFUSE declares it under a plain #ifdef __APPLE__ with no way to opt out, and it must not appear against vanilla libfuse3. Qualify the guard with the version so both libraries build. Verified on macOS 26.6 with macFUSE 5.3.3 (libfuse 3.18.2) against a vstart memstore cluster: ceph-fuse mounts file system 'a', and read, write, mkdir, rename, truncate, chmod, symlink, hard link, statfs and clean unmount all behave. A 64 MiB file round trips to the same sha256, arriving as 18 objects in the data pool, and the xattr paths touched here answer for both user xattrs and the ceph.* virtual ones. Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
Companion to do_freebsd.sh. Points cmake at the keg-only homebrew packages, selects the virtualenv interpreter that carries Cython, and disables what either cannot build on Darwin or wants dependencies beyond the base set. The mon, the OSD on memstore, the client libraries, libcephsqlite and the offline tools are on. The mgr, the MDS and the RGW are off, not because they fail to build - they do build, and run - but because each needs packages the base set does not pull in; doc/dev/macos.rst covers those. BlueStore is off because it needs libaio or io_uring and the Linux block layer. Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
The page still described a 2018 build: a brew-installed clang because Xcode's was too old for C++17, hand-written paths into /usr/local/Cellar with pinned nss and openssl versions, and the conclusion that FUSE and librados applications were the practical uses. None of that holds. The Apple clang from the Command Line Tools builds the tree, do_cmake_macos.sh replaces the hand-written cmake line, and a vstart cluster runs the mon, the OSD, the mgr, the MDS and the RGW together on memstore, with RADOS, RBD, CephFS through ceph-fuse and S3 all working against it. The ARM accelerated paths - hardware crc32c, NEON gf-complete and the ISA-L erasure code plugin - are picked up too. Rewrite around what someone actually has to do: the dependencies, the submodules that must not be cloned shallow, the extra packages and options the mgr, the MDS and the RGW each want, how to mount CephFS with ceph-fuse, and the handful of Darwin behaviours that read as bugs the first time - a full memstore looking like a hang, mgr commands hanging when no mgr is running, and radosgw aborting in the Objective-C runtime because it forks without exec. Build the optional daemons with WITH_SYSTEM_BOOST=OFF rather than homebrew's boost-python3. The separate formula is built against whichever [email protected] it pins, and Ceph would then have to embed that same interpreter; letting Ceph build Boost itself keeps the choice of python in the reader's hands and needs no extra package. Say plainly what is out of scope: BlueStore needs libaio or io_uring and the Linux block layer, so memstore is the object store here. Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
A build on a clean Mac stops at configure for want of dependencies the page never listed: lua for cls_lua, which builds everywhere but Windows; pkgconf, which Findsnappy requires; and the src/isa-l submodule, which WITH_EC_ISA_PLUGIN turns on by itself on arm64. With the submodule present, isal_ext-configure then fails without autoconf, automake and libtool, because ISA-L is built with its autogen.sh. uv was used but never installed. Add them to the brew line and the submodule list, and have do_cmake_macos.sh check for the submodule and the autotools up front: the errors CMake and the ExternalProject give for them do not name the cause. Also set pipefail, so that a failed cmake is not hidden by the tee into cmake.log. Document the tapi error a mismatched SDK and Command Line Tools linker gives on the first compiler check. Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
Two changes on main since the guide was written: - src/pybind stops when Python and Ceph link different OpenSSL versions. The Python that uv downloads brings its own (3.5 against Homebrew's openssl@3 3.6), so build the venv on Homebrew's [email protected]. - WITH_RADOSGW_LANCEDB is on by default on arm64 and needs cargo 1.91 or later; turn it off with the other optional RGW parts. Reported-by: Bryan Stillwell <[email protected]> Assisted-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Dan van der Ster <[email protected]>
1f0f7b6 to
87f400d
Compare
|
Refreshed on main 10bcb6d: the branch is now main plus the current heads of #72484, #71886, #71888, #72446 and #71889 (30 commits). New since the last refresh are the three commits added to #72446 on 16 November. Built natively on macOS 27.2 (Apple silicon); a vstart cluster with mon, mgr, osd, mds and rgw comes up, and RADOS, RBD and CephFS smoke checks pass. |
Not for merging. This has been split into the PRs below, which are the ones to review. This draft stays open only as a single branch with everything together, for anyone who wants to build and run Ceph on a Mac: it is
mainplus the open PRs below, in order.Still open:
Already merged: #71883 (portability problems a stricter toolchain turns up), #71884 (fixed-width types), #71885 (build dependencies), #71887 (AppleClang and arm64), @wjwithagen's #71445 (entity_addr_t encoding), #72479 (container_ios) and @tchaikov's #72482 (
le32toh()).Refreshed on 2026-11-10 on main 0c8e89d. On macOS (Apple silicon, Mac Studio), everything in
doc/dev/macos.rstbuilds exceptceph-fuse, which was left out because that machine has no macFUSE;vstart.sh --memstorebrings up all five daemons: CephFS is created, a 4 MiB RADOS object round-trips, an RBD image can be created, and RGW answers HTTP 200.The goal is a local vstart cluster on a MacBook, so Ceph development can happen there without a Linux VM. The client libraries, the mon, the OSD (memstore only), the mgr, the MDS, the RGW and the offline tools build with Apple clang, and
vstart.sh --memstorebrings all five daemons up. The ARMv8 accelerated paths (hardware crc32c, NEON gf-complete, the ISA-L erasure code plugin) come along too. BlueStore is out of scope: it needs the Linux block layer.See
doc/dev/macos.rst.Checklist