Skip to content

Commit

Permalink
DAOS-15136 client: Switch to using libfused (#14077)
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jeff Olivier <[email protected]>
  • Loading branch information
jolivier23 and ashleypittman committed Jan 24, 2025
1 parent 8ddde42 commit d567d9f
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 143 deletions.
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
13 changes: 13 additions & 0 deletions site_scons/components/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
114 changes: 29 additions & 85 deletions site_scons/prereq_tools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand All @@ -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
Expand Down
34 changes: 5 additions & 29 deletions src/client/dfuse/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -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 <fuse3/fuse_lowlevel.h>
src = """#include <fused/fuse_lowlevel.h>
extern void
my_ioctl (fuse_req_t req, fuse_ino_t ino, %s cmd,
Expand All @@ -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"""

Expand Down Expand Up @@ -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)

Expand All @@ -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)

Expand Down
5 changes: 3 additions & 2 deletions src/client/dfuse/dfuse.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* (C) Copyright 2016-2024 Intel Corporation.
* (C) Copyright 2025 Google LLC
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand All @@ -9,8 +10,8 @@

#include <semaphore.h>

#include <fuse3/fuse.h>
#include <fuse3/fuse_lowlevel.h>
#include <fused/fuse.h>
#include <fused/fuse_lowlevel.h>

#include <gurt/list.h>
#include <gurt/hash.h>
Expand Down
16 changes: 8 additions & 8 deletions src/client/dfuse/dfuse_fuseops.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/**
* (C) Copyright 2016-2024 Intel Corporation.
* (C) Copyright 2025 Google LLC
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/

#include <fuse3/fuse_lowlevel.h>
#include <fused/fuse_lowlevel.h>

#include "dfuse_common.h"
#include "dfuse.h"
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions src/client/dfuse/dfuse_main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* (C) Copyright 2016-2024 Intel Corporation.
* (C) Copyright 2025 Google LLC
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand All @@ -8,8 +9,8 @@
#include <getopt.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <fuse3/fuse.h>
#include <fuse3/fuse_lowlevel.h>
#include <fused/fuse.h>
#include <fused/fuse_lowlevel.h>
#include <string.h>

#include <sys/types.h>
Expand Down
5 changes: 3 additions & 2 deletions src/client/dfuse/dfuse_thread.c
Original file line number Diff line number Diff line change
@@ -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 <pthread.h>

#include <fuse3/fuse_lowlevel.h>
#include <fused/fuse_lowlevel.h>
#define D_LOGFAC DD_FAC(dfuse)
#include "dfuse.h"

Expand Down
5 changes: 2 additions & 3 deletions utils/build.config
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions utils/cq/words.dict
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ IOR
ISA
KVM
Launchable
LLC
Lustre
MPI
Makefile
Expand Down
Loading

0 comments on commit d567d9f

Please sign in to comment.