From d567d9f2263d05b0dbb6e90fc98f8c1bf81094fc Mon Sep 17 00:00:00 2001 From: Jeff Olivier Date: Wed, 15 Jan 2025 22:53:41 -0700 Subject: [PATCH] DAOS-15136 client: Switch to using libfused (#14077) Switch to using libfused instead of libfuse3 This enables the following: customization of libfuse for dfuse use case Ability to release the library without breaking other fuse users. fused is a fork of libfuse that renames the library and header file directory. Change-Id: If6d2abe9dd4d02fe6b78c92c9b091cbad1838494 Co-authored-by: Ashley Pittman Signed-off-by: Jeff Olivier --- debian/control | 2 +- site_scons/components/__init__.py | 13 ++++ site_scons/prereq_tools/base.py | 114 ++++++++---------------------- src/client/dfuse/SConscript | 34 ++------- src/client/dfuse/dfuse.h | 5 +- src/client/dfuse/dfuse_fuseops.c | 16 ++--- src/client/dfuse/dfuse_main.c | 5 +- src/client/dfuse/dfuse_thread.c | 5 +- utils/build.config | 5 +- utils/cq/words.dict | 1 + utils/rpms/daos.spec | 12 +--- 11 files changed, 69 insertions(+), 143 deletions(-) diff --git a/debian/control b/debian/control index a4bd0232dc7..7644d5b29c6 100644 --- a/debian/control +++ b/debian/control @@ -18,7 +18,7 @@ Build-Depends: debhelper (>= 10), python3-distro, libabt-dev, libpmemobj-dev (>= 2.1.0), - libfuse3-dev, + libfused-dev, libprotobuf-c-dev, libjson-c-dev, dpdk-dev (>= 21.11.2), diff --git a/site_scons/components/__init__.py b/site_scons/components/__init__.py index 2525b448671..05f5cb5ad8d 100644 --- a/site_scons/components/__init__.py +++ b/site_scons/components/__init__.py @@ -1,4 +1,6 @@ # Copyright 2016-2024 Intel Corporation +# Copyright 2025 Google LLC +# Copyright 2025 Hewlett Packard Enterprise Development LP # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -309,6 +311,17 @@ def define_components(reqs): required_progs=['libtoolize', 'ninja', 'meson'], out_of_src_build=True) + reqs.define('fused', libs=['fused'], defines=['FUSE_USE_VERSION=35'], + retriever=GitRepoRetriever(), + commands=[['meson', 'setup', '--prefix=$FUSED_PREFIX', '-Ddisable-mtab=True', + '-Dudevrulesdir=$FUSED_PREFIX/udev', '-Dutils=False', + '--default-library', 'static', '../fused'], + ['meson', 'setup', '--reconfigure', '../fused'], + ['ninja', 'install']], + headers=['fused/fuse.h'], + required_progs=['libtoolize', 'ninja', 'meson'], + out_of_src_build=True) + # Tell SPDK which CPU to optimize for, by default this is native which works well unless you # are relocating binaries across systems, for example in CI under GitHub actions etc. There # isn't a minimum value needed here, but getting this wrong will cause daos server to exit diff --git a/site_scons/prereq_tools/base.py b/site_scons/prereq_tools/base.py index 07b2280527d..dbea455f065 100644 --- a/site_scons/prereq_tools/base.py +++ b/site_scons/prereq_tools/base.py @@ -448,71 +448,25 @@ def __init__(self, env, opts): RUNNER.initialize(self.__env) - opts.Add( - PathVariable( - "PREFIX", "Installation path", install_dir, PathVariable.PathIsDirCreate - ) - ) - opts.Add( - "ALT_PREFIX", - f"Specifies {os.pathsep} separated list of alternative paths to add", - None, - ) - opts.Add( - PathVariable( - "BUILD_ROOT", - "Alternative build root directory", - "build", - PathVariable.PathIsDirCreate, - ) - ) - opts.Add( - "USE_INSTALLED", "Comma separated list of preinstalled dependencies", "none" - ) - opts.Add(("MPI_PKG", "Specifies name of pkg-config to load for MPI", None)) - opts.Add( - BoolVariable("FIRMWARE_MGMT", "Build in device firmware management.", False) - ) - opts.Add( - BoolVariable("STACK_MMAP", "Allocate ABT ULTs stacks with mmap()", False) - ) - opts.Add(BoolVariable("STATIC_FUSE", "Build with static libfuse library", True)) - opts.Add( - EnumVariable( - "BUILD_TYPE", - "Set the build type", - "release", - ["dev", "debug", "release"], - ignorecase=1, - ) - ) - opts.Add( - EnumVariable( - "TARGET_TYPE", - "Set the prerequisite type", - "default", - ["default", "dev", "debug", "release"], - ignorecase=1, - ) - ) - opts.Add( - EnumVariable( - "COMPILER", - "Set the compiler family to use", - "gcc", - ["gcc", "covc", "clang", "icc"], - ignorecase=2, - ) - ) - opts.Add( - EnumVariable( - "WARNING_LEVEL", - "Set default warning level", - "error", - ["warning", "warn", "error"], - ignorecase=2, - ) - ) + opts.Add(PathVariable('PREFIX', 'Installation path', install_dir, + PathVariable.PathAccept)) + opts.Add('ALT_PREFIX', f'Specifies {os.pathsep} separated list of alternative paths to add', + None) + opts.Add(PathVariable('BUILD_ROOT', 'Alternative build root directory', "build", + PathVariable.PathIsDirCreate)) + opts.Add('USE_INSTALLED', 'Comma separated list of preinstalled dependencies', 'none') + opts.Add(('MPI_PKG', 'Specifies name of pkg-config to load for MPI', None)) + opts.Add(BoolVariable('FIRMWARE_MGMT', 'Build in device firmware management.', False)) + opts.Add(BoolVariable("STACK_MMAP", "Allocate ABT ULTs stacks with mmap()", False)) + + opts.Add(EnumVariable('BUILD_TYPE', "Set the build type", 'release', + ['dev', 'debug', 'release'], ignorecase=1)) + opts.Add(EnumVariable('TARGET_TYPE', "Set the prerequisite type", 'default', + ['default', 'dev', 'debug', 'release'], ignorecase=1)) + opts.Add(EnumVariable('COMPILER', "Set the compiler family to use", 'gcc', + ['gcc', 'covc', 'clang', 'icc'], ignorecase=2)) + opts.Add(EnumVariable('WARNING_LEVEL', "Set default warning level", 'error', + ['warning', 'warn', 'error'], ignorecase=2)) opts.Update(self.__env) @@ -584,21 +538,11 @@ def __init__(self, env, opts): def run_build(self, opts): """Build and dependencies""" - common_reqs = [ - "ofi", - "hwloc", - "mercury", - "boost", - "uuid", - "crypto", - "protobufc", - "lz4", - "isal", - "isal_crypto", - ] - client_reqs = ["fuse", "json-c", "capstone", "aio"] - server_reqs = ["argobots", "pmdk", "spdk", "ipmctl"] - test_reqs = ["cmocka"] + common_reqs = ['ofi', 'hwloc', 'mercury', 'boost', 'uuid', 'crypto', 'protobufc', + 'lz4', 'isal', 'isal_crypto'] + client_reqs = ['fused', 'json-c', 'capstone', 'aio'] + server_reqs = ['argobots', 'pmdk', 'spdk', 'ipmctl'] + test_reqs = ['cmocka'] reqs = [] reqs = common_reqs @@ -945,7 +889,7 @@ def get_prebuilt_path(self, comp, name): if not os.path.exists(ipath): ipath = None lpath = None - for lib in ["lib64", "lib"]: + for lib in comp.lib_path: lpath = os.path.join(path, lib) if not os.path.exists(lpath): lpath = None @@ -1202,7 +1146,7 @@ def _parse_config(self, env, opts): and not self.component_prefix == "/usr" ): path_found = False - for path in ["lib", "lib64"]: + for path in self.lib_path: config = os.path.join(self.component_prefix, path, "pkgconfig") if not os.path.exists(config): continue @@ -1439,7 +1383,7 @@ def _patch_rpaths(self): if not os.path.exists(comp_path): return - for libdir in ["lib64", "lib"]: + for libdir in self.lib_path: path = os.path.join(comp_path, libdir) if os.path.exists(path): norigin.append(os.path.normpath(path)) @@ -1451,14 +1395,14 @@ def _patch_rpaths(self): comp = self.prereqs.get_component(prereq) subpath = comp.component_prefix if subpath and not subpath.startswith("/usr"): - for libdir in ["lib64", "lib"]: + for libdir in self.lib_path: lpath = os.path.join(subpath, libdir) if not os.path.exists(lpath): continue rpath.append(lpath) continue - for libdir in ["lib64", "lib"]: + for libdir in self.lib_path: path = os.path.join(rootpath, libdir) if not os.path.exists(path): continue diff --git a/src/client/dfuse/SConscript b/src/client/dfuse/SConscript index 12ef33841d4..36a909e35ba 100644 --- a/src/client/dfuse/SConscript +++ b/src/client/dfuse/SConscript @@ -141,7 +141,7 @@ def check_ioctl_def(context, ctype): context.Message(f'Checking if fuse ioctl is type {ctype} ') # pylint: disable-next=consider-using-f-string - src = """#include + src = """#include extern void my_ioctl (fuse_req_t req, fuse_ino_t ino, %s cmd, @@ -167,31 +167,13 @@ def configure_fuse(cenv): if check.CheckFuseIoctl('unsigned int'): pass - elif check.CheckFuseIoctl('int'): - cenv.AppendUnique(CPPDEFINES={'FUSE_IOCTL_USE_INT': '1'}) else: - print('Could not determine type of fuse ioctl type') + print('Expected unsigned int ioctl type') Exit(2) check.Finish() -def find_static_fuse(cenv): - """Find and copy static fuse library""" - - fuse_prefix = '/usr' - if os.path.exists(cenv.subst('$FUSE_PREFIX')): - fuse_prefix = cenv.subst('$FUSE_PREFIX') - - for path in ['lib64', 'lib/x86_64-linux-gnu', 'lib/aarch64-linux-gnu', 'lib']: - fuselib = os.path.join(fuse_prefix, path, "libfuse3.a") - if os.path.exists(fuselib): - return [File(fuselib)] - - print("Could not find libfuse3.a") - return [] - - def scons(): """Scons function""" @@ -230,14 +212,8 @@ def scons(): cenv.AppendUnique(LIBS=['dfs', 'duns']) cenv.require('hwloc') - if cenv.get('STATIC_FUSE'): - cenv.require('fuse', headers_only=True) - static_fuse = find_static_fuse(cenv) - extra_libs = ['dl'] - else: - cenv.require('fuse') - static_fuse = [] - extra_libs = ['dl'] + cenv.require('fused') + extra_libs = ['dl'] configure_fuse(cenv) @@ -247,7 +223,7 @@ def scons(): for src in OPS_SRC: dfuse_obj += cenv.Object(os.path.join('ops', f'{src}.c')) cenv.AppendUnique(LIBS=['gurt'] + extra_libs) - dfuse_bin = cenv.d_program('dfuse/dfuse', common + dfuse_obj + static_fuse) + dfuse_bin = cenv.d_program('dfuse/dfuse', common + dfuse_obj) Default(dfuse_bin) diff --git a/src/client/dfuse/dfuse.h b/src/client/dfuse/dfuse.h index 1745d104e71..47725aaed71 100644 --- a/src/client/dfuse/dfuse.h +++ b/src/client/dfuse/dfuse.h @@ -1,5 +1,6 @@ /** * (C) Copyright 2016-2024 Intel Corporation. + * (C) Copyright 2025 Google LLC * * SPDX-License-Identifier: BSD-2-Clause-Patent */ @@ -9,8 +10,8 @@ #include -#include -#include +#include +#include #include #include diff --git a/src/client/dfuse/dfuse_fuseops.c b/src/client/dfuse/dfuse_fuseops.c index 38f98576740..cb9fd9fdbf4 100644 --- a/src/client/dfuse/dfuse_fuseops.c +++ b/src/client/dfuse/dfuse_fuseops.c @@ -1,10 +1,11 @@ /** * (C) Copyright 2016-2024 Intel Corporation. + * (C) Copyright 2025 Google LLC * * SPDX-License-Identifier: BSD-2-Clause-Patent */ -#include +#include #include "dfuse_common.h" #include "dfuse.h" @@ -44,16 +45,15 @@ dfuse_show_flags(void *handle, unsigned int cap, unsigned int want) SHOW_FLAG(handle, cap, want, FUSE_CAP_PARALLEL_DIROPS); SHOW_FLAG(handle, cap, want, FUSE_CAP_POSIX_ACL); SHOW_FLAG(handle, cap, want, FUSE_CAP_HANDLE_KILLPRIV); - -#ifdef FUSE_CAP_CACHE_SYMLINKS + SHOW_FLAG(handle, cap, want, FUSE_CAP_HANDLE_KILLPRIV_V2); SHOW_FLAG(handle, cap, want, FUSE_CAP_CACHE_SYMLINKS); -#endif -#ifdef FUSE_CAP_NO_OPENDIR_SUPPORT SHOW_FLAG(handle, cap, want, FUSE_CAP_NO_OPENDIR_SUPPORT); -#endif -#ifdef FUSE_CAP_EXPLICIT_INVAL_DATA SHOW_FLAG(handle, cap, want, FUSE_CAP_EXPLICIT_INVAL_DATA); -#endif + SHOW_FLAG(handle, cap, want, FUSE_CAP_EXPIRE_ONLY); + SHOW_FLAG(handle, cap, want, FUSE_CAP_SETXATTR_EXT); + SHOW_FLAG(handle, cap, want, FUSE_CAP_DIRECT_IO_ALLOW_MMAP); + SHOW_FLAG(handle, cap, want, FUSE_CAP_PASSTHROUGH); + SHOW_FLAG(handle, cap, want, FUSE_CAP_NO_EXPORT_SUPPORT); if (cap) DFUSE_TRA_WARNING(handle, "Unknown capability flags %#x", cap); diff --git a/src/client/dfuse/dfuse_main.c b/src/client/dfuse/dfuse_main.c index 02db62cc4e9..22b9adcfbdf 100644 --- a/src/client/dfuse/dfuse_main.c +++ b/src/client/dfuse/dfuse_main.c @@ -1,5 +1,6 @@ /** * (C) Copyright 2016-2024 Intel Corporation. + * (C) Copyright 2025 Google LLC * * SPDX-License-Identifier: BSD-2-Clause-Patent */ @@ -8,8 +9,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/src/client/dfuse/dfuse_thread.c b/src/client/dfuse/dfuse_thread.c index 4e06e4335ce..99c425a39f1 100644 --- a/src/client/dfuse/dfuse_thread.c +++ b/src/client/dfuse/dfuse_thread.c @@ -1,12 +1,13 @@ /** - * (C) Copyright 2020-2023 Intel Corporation. + * (C) Copyright 2020-2024 Intel Corporation. + * (C) Copyright 2025 Google LLC * * SPDX-License-Identifier: BSD-2-Clause-Patent */ #include -#include +#include #define D_LOGFAC DD_FAC(dfuse) #include "dfuse.h" diff --git a/utils/build.config b/utils/build.config index a14ad039c15..47be22c45d8 100644 --- a/utils/build.config +++ b/utils/build.config @@ -3,7 +3,7 @@ component=daos [commit_versions] argobots=v1.1 -fuse=fuse-3.16.2 +fused=v1.0.0 pmdk=2.1.0 isal=v2.30.0 isal_crypto=v2.23.0 @@ -15,7 +15,7 @@ ucx=v1.14.1 [repos] argobots=https://github.com/pmodels/argobots.git -fuse=https://github.com/libfuse/libfuse.git +fused=https://github.com/daos-stack/fused.git pmdk=https://github.com/pmem/pmdk.git isal=https://github.com/intel/isa-l.git isal_crypto=https://github.com/intel/isa-l_crypto.git @@ -27,6 +27,5 @@ ucx=https://github.com/openucx/ucx.git [patch_versions] spdk=https://github.com/spdk/spdk/commit/b0aba3fcd5aceceea530a702922153bc75664978.diff,https://github.com/spdk/spdk/commit/445a4c808badbad3942696ecf16fa60e8129a747.diff -fuse=https://github.com/libfuse/libfuse/commit/c9905341ea34ff9acbc11b3c53ba8bcea35eeed8.diff mercury=https://raw.githubusercontent.com/daos-stack/mercury/f3dc286fb40ec1a3a38a2e17c45497bc2aa6290d/na_ucx.patch pmdk=https://github.com/pmem/pmdk/commit/2abe15ac0b4eed894b6768cd82a3b0a7c4336284.diff diff --git a/utils/cq/words.dict b/utils/cq/words.dict index 102ca21a882..5bbb5fd9826 100644 --- a/utils/cq/words.dict +++ b/utils/cq/words.dict @@ -27,6 +27,7 @@ IOR ISA KVM Launchable +LLC Lustre MPI Makefile diff --git a/utils/rpms/daos.spec b/utils/rpms/daos.spec index 8c6d2a9862f..7b4a1994d4f 100644 --- a/utils/rpms/daos.spec +++ b/utils/rpms/daos.spec @@ -50,11 +50,7 @@ BuildRequires: libjson-c-devel BuildRequires: boost-devel %endif BuildRequires: libpmemobj-devel >= 2.1.0 -%if (0%{?rhel} >= 8) -BuildRequires: fuse3-devel >= 3 -%else -BuildRequires: fuse3-devel >= 3.4.2 -%endif +BuildRequires: fused-devel %if (0%{?suse_version} >= 1500) BuildRequires: go-race BuildRequires: libprotobuf-c-devel @@ -170,7 +166,6 @@ Requires: mercury >= %{mercury_version} Requires: libfabric >= %{libfabric_version} %if (0%{?suse_version} >= 1500) Requires: libfabric1 >= %{libfabric_version} -Requires: libfuse3-3 >= 3.4.2 %endif Requires: /usr/bin/fusermount3 %{?systemd_requires} @@ -222,11 +217,6 @@ Requires: libcapstone-devel Requires: Lmod Requires: capstone-devel %endif -%if (0%{?rhel} >= 8) -Requires: fuse3-devel >= 3 -%else -Requires: fuse3-devel >= 3.4.2 -%endif Requires: pciutils-devel %if (0%{?suse_version} > 0) Requires: libndctl-devel