New upstream version 8.1.0

This commit is contained in:
geos_one
2025-08-10 01:34:16 +02:00
commit c891bb7105
4398 changed files with 838833 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
# Automatic rebuild of BeeGFS client modules on kernel change.
AUTO_REBUILD_KVER_FILE := auto_rebuild_kernel.ver
AUTO_REBUILD_KVER_CURRENT = $(shell uname -srvmpi)
AUTO_REBUILD_LOG_PREFIX := "BeeGFS Client Auto-Rebuild:"
# config file (keys)
AUTO_REBUILD_CONF_FILE := /etc/beegfs/beegfs-client-autobuild.conf
AUTO_REBUILD_CONF_ENABLED_KEY := buildEnabled
AUTO_REBUILD_CONF_BUILDARGS_KEY := buildArgs
# config file (values)
AUTO_REBUILD_CONF_ENABLED = $(shell \
grep -s "^\s*$(AUTO_REBUILD_CONF_ENABLED_KEY)\s*=" "$(AUTO_REBUILD_CONF_FILE)" | \
cut --delimiter="=" --fields="2-" )
AUTO_REBUILD_CONF_BUILDARGS = $(shell \
grep "^\s*$(AUTO_REBUILD_CONF_BUILDARGS_KEY)\s*=" "$(AUTO_REBUILD_CONF_FILE)" | \
cut --delimiter="=" --fields="2-" )
# add build dependency if rebuild has been enabled in config file
ifeq ($(AUTO_REBUILD_CONF_ENABLED), true)
AUTO_REBUILD_CONFIGURED_DEPS := auto_rebuild_install
endif
# environment variables (intentionally commented out here; just to mention
# them somewhere)
# - AUTO_REBUILD_KVER_STORED: internally for target auto_rebuild
auto_rebuild:
$(MAKE) auto_rebuild_clean $(AUTO_REBUILD_CONF_BUILDARGS)
$(MAKE) $(AUTO_REBUILD_CONF_BUILDARGS)
# checked rebuild and install
auto_rebuild_install: auto_rebuild
$(MAKE) install $(AUTO_REBUILD_CONF_BUILDARGS)
# run checked rebuild and install if enabled in config file
auto_rebuild_configured: $(AUTO_REBUILD_CONFIGURED_DEPS)
@ /bin/true
auto_rebuild_clean: clean
@ /bin/true
auto_rebuild_help:
@echo 'No Auto-Rebuild Arguments defined.'

View File

@@ -0,0 +1,334 @@
# All detected features are included in "KERNEL_FEATURE_DETECTION"
# parameters:
# $1: name to define when grep finds something
# $2: grep flags and expression
# $3: input files in linux source tree
define define_if_matches
$(eval \
KERNEL_FEATURE_DETECTION += $$(shell \
grep -q -s $2 $(addprefix ${KSRCDIR_PRUNED_HEAD}/include/linux/,$3) \
&& echo "-D$(strip $1)"))
endef
ifneq ($(OFED_INCLUDE_PATH),)
OFED_DETECTION_PATH := $(OFED_INCLUDE_PATH)
else
OFED_DETECTION_PATH := ${KSRCDIR_PRUNED_HEAD}/include
endif
# Find out whether rdma_create_id function has qp_type argument.
# This is tricky because the function declaration spans multiple lines.
# Note: Was introduced in vanilla 3.0
KERNEL_FEATURE_DETECTION += $(shell \
grep -sA2 "struct rdma_cm_id \*rdma_create_id(" ${OFED_DETECTION_PATH}/rdma/rdma_cm.h 2>&1 \
| grep -qs "ib_qp_type qp_type);" \
&& echo "-DOFED_HAS_RDMA_CREATE_QPTYPE")
# Find out whether rdma_set_service_type function has been declared.
# Note: Was introduced in vanilla 2.6.24
KERNEL_FEATURE_DETECTION += $(shell \
grep -qs "rdma_set_service_type(struct rdma_cm_id \*id, int tos)" \
${OFED_DETECTION_PATH}/rdma/rdma_cm.h \
&& echo "-DOFED_HAS_SET_SERVICE_TYPE")
# Find out whether ib_create_cq function has cq_attr argument
# This is tricky because the function declaration spans multiple lines.
# Note: Was introduced in vanilla 4.2
KERNEL_FEATURE_DETECTION += $(shell \
grep -sA4 "struct ib_cq \*ib_create_cq(struct ib_device \*device," ${OFED_DETECTION_PATH}/rdma/ib_verbs.h 2>&1 \
| grep -qs "const struct ib_cq_init_attr \*cq_attr);" \
&& echo "-DOFED_HAS_IB_CREATE_CQATTR")
# Find out whether rdma_reject function has reason argument
# This is tricky because the function declaration spans multiple lines.
# Note: Was introduced in MLNX OFED 5.1
KERNEL_FEATURE_DETECTION += $(shell \
grep -sA1 "int rdma_reject(" ${OFED_DETECTION_PATH}/rdma/rdma_cm.h 2>&1 \
| grep -qs "u8 reason);" \
&& echo "-DOFED_RDMA_REJECT_NEEDS_REASON")
# kernels >=v4.4 expect a netns argument for rdma_create_id
KERNEL_FEATURE_DETECTION += $(shell \
grep -qs "struct rdma_cm_id \*rdma_create_id.struct net \*net," \
${OFED_DETECTION_PATH}/rdma/rdma_cm.h \
&& echo "-DOFED_HAS_NETNS")
# kernels >=v4.4 split up ib_send_wr into a lot of other structs
KERNEL_FEATURE_DETECTION += $(shell \
grep -qs -F "struct ib_atomic_wr {" \
${OFED_DETECTION_PATH}/rdma/ib_verbs.h \
&& echo "-DOFED_SPLIT_WR")
KERNEL_FEATURE_DETECTION += $(shell \
grep -qs -F "IB_PD_UNSAFE_GLOBAL_RKEY" \
${OFED_DETECTION_PATH}/rdma/ib_verbs.h \
&& echo "-DOFED_UNSAFE_GLOBAL_RKEY")
KERNEL_FEATURE_DETECTION += $(shell \
grep -qs -F "ib_get_dma_mr" \
${OFED_DETECTION_PATH}/rdma/ib_verbs.h \
&& echo "-DOFED_IB_GET_DMA_MR")
KERNEL_FEATURE_DETECTION += $(shell \
grep -qs -F "static inline void ib_destroy_cq" \
${OFED_DETECTION_PATH}/rdma/ib_verbs.h \
&& echo "-DOFED_IB_DESTROY_CQ_IS_VOID")
# Find out whether the kernel has a scsi/fc_compat.h file, which defines
# vlan_dev_vlan_id.
# Note: We need this, because some kernels (e.g. RHEL 5.9's 2.6.18) forgot this
# include in their rdma headers, leading to implicit function declarations.
$(call define_if_matches, KERNEL_HAS_SCSI_FC_COMPAT, "vlan_dev_vlan_id", scsi/fc_compat.h)
# Find out whether the kernel has a ihold function.
# Note: Was added in vanilla 2.6.37, but RedHat adds it to their 2.6.32.
$(call define_if_matches, KERNEL_HAS_IHOLD, ' ihold(struct inode.*)', fs.h)
# Find out whether the kernel has fsync start and end range arguments.
# Note: fsync start and end were added in vanilla 3.1, but SLES11SP3 adds it to its 3.0 kernel.
$(call define_if_matches, KERNEL_HAS_FSYNC_RANGE, \
-F "int (*fsync) (struct file *, loff_t, loff_t, int datasync);", fs.h)
# Find out whether the kernel has define struct dentry_operations *s_d_op
# in struct super_block. If it has it used that to check if the file system
# needs to revalidate dentries.
$(call define_if_matches, KERNEL_HAS_S_D_OP, -F "struct dentry_operations *s_d_op;", fs.h)
# Find out whether the kernel has d_materialise_unique() to
# add dir dentries.
#
# Note: d_materialise_unique was added in vanilla 2.6.19 (backported to rhel5
# 2.6.18) and got merged into d_splice_alias in vanilla 3.19.
$(call define_if_matches, KERNEL_HAS_D_MATERIALISE_UNIQUE, \
-F "d_materialise_unique(struct dentry *, struct inode *)", dcache.h)
# Find out whether the kernel has a PDE_DATA method.
#
# Note: This method was added in vanilla linux-3.10
$(call define_if_matches, KERNEL_HAS_PDE_DATA, -F "PDE_DATA(const struct inode *)", proc_fs.h)
# Find out whether the kernel has i_uid_read
#
# Note: added to 3.5
$(call define_if_matches, KERNEL_HAS_I_UID_READ, "i_uid_read", fs.h)
# Find out whether the kernel has atomic_open
#
# Note: added to 3.5
$(call define_if_matches, KERNEL_HAS_ATOMIC_OPEN, "atomic_open", fs.h)
# Find out whether the kernel used umode_t
#
# Note: added to 3.3
$(call define_if_matches, KERNEL_HAS_UMODE_T, -E "(\*mkdir).*umode_t", fs.h)
# Find out if the kernel has a file_inode() method.
$(call define_if_matches, KERNEL_HAS_FILE_INODE, " file_inode(.*)", fs.h)
# Find out whether the kernel has a strnicmp function.
#
# Note: strnicmp was switched to strncasecmp in linux-4.0. strncasecmp existed
# before, but was wrong, so we only use strncasecmp if strnicmp doesn't exist.
$(call define_if_matches, KERNEL_HAS_STRNICMP, "strnicmp", string.h)
# Find out whether the kernel has BDI_CAP_MAP_COPY defined.
$(call define_if_matches, KERNEL_HAS_BDI_CAP_MAP_COPY, "define BDI_CAP_MAP_COPY", backing-dev.h)
# Find out whether xattr_handler** s_xattr in super_block is const.
$(call define_if_matches, KERNEL_HAS_CONST_XATTR_CONST_PTR_HANDLER, \
-F "const struct xattr_handler * const *s_xattr;", fs.h)
$(call define_if_matches, KERNEL_HAS_CONST_XATTR_HANDLER, \
-F "const struct xattr_handler **s_xattr;", fs.h)
# Find out whether xattr_handler functions need a dentry* (otherwise they need an inode*).
# Note: grepping for "(*set).struct..." instead of "(*set)(struct..." because make complains about
# the missing ")" otherwise.
$(call define_if_matches, KERNEL_HAS_DENTRY_XATTR_HANDLER, \
"int (\*set).struct dentry \*dentry", xattr.h)
# address_space.assoc_mapping went away in vanilla 3.8, but SLES11 backports that change
$(call define_if_matches, KERNEL_HAS_ADDRSPACE_ASSOC_MAPPING, -F "assoc_mapping", fs.h)
# current_umask() was added in 2.6.30
$(call define_if_matches, KERNEL_HAS_CURRENT_UMASK, -F "current_umask", fs.h)
# super_operations.show_options was changed to struct dentry* in 3.3
$(call define_if_matches, KERNEL_HAS_SHOW_OPTIONS_DENTRY, -F "int (*show_options)(struct seq_file *, struct dentry *);", fs.h)
# xattr handlers >=v4.4 also receive pointer to struct xattr_handler
KERNEL_FEATURE_DETECTION += $(shell \
grep -s -F "int (*get)" ${KSRCDIR_PRUNED_HEAD}/include/linux/xattr.h \
| grep -q -s -F "const struct xattr_handler *" \
&& echo "-DKERNEL_HAS_XATTR_HANDLER_PTR_ARG -DKERNEL_HAS_DENTRY_XATTR_HANDLER")
# 4.5 introduces name in xattr_handler, which can be used instead of prefix
KERNEL_FEATURE_DETECTION += $(shell \
grep -sFA1 "struct xattr_handler {" ${KSRCDIR_PRUNED_HEAD}/include/linux/xattr.h \
| grep -qsF "const char *name;" \
&& echo "-DKERNEL_HAS_XATTR_HANDLER_NAME")
# locks_lock_inode_wait is used for flock since 4.4 (before flock_lock_file_wait was used)
# since 6.3 locks_lock_inode_wait moved from file fs.h to filelock.h
$(call define_if_matches, KERNEL_HAS_LOCKS_FILELOCK_INODE_WAIT, -F "static inline int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl)", filelock.h)
$(call define_if_matches, KERNEL_HAS_LOCKS_LOCK_INODE_WAIT, -F "static inline int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl)", fs.h)
# get_link() replaces follow_link() in 4.5
$(call define_if_matches, KERNEL_HAS_GET_LINK, -F "const char * (*get_link) (struct dentry *, struct inode *, struct delayed_call *);", fs.h)
$(call define_if_matches, KERNEL_HAS_I_MMAP_LOCK, -F "i_mmap_lock_read", fs.h)
$(call define_if_matches, KERNEL_HAS_I_MMAP_RWSEM, -F "i_mmap_rwsem", fs.h)
$(call define_if_matches, KERNEL_HAS_I_MMAP_MUTEX, -F "i_mmap_mutex", fs.h)
$(call define_if_matches, KERNEL_HAS_I_MMAP_RBTREE, -P "struct rb_root\s+i_mmap", fs.h)
$(call define_if_matches, KERNEL_HAS_I_MMAP_CACHED_RBTREE, -P "struct rb_root_cached\s+i_mmap", fs.h)
$(call define_if_matches, KERNEL_HAS_I_MMAP_NONLINEAR, -F "i_mmap_nonlinear", fs.h)
$(call define_if_matches, KERNEL_HAS_INODE_LOCK, "static inline void inode_lock", fs.h)
#<linuy-4.8
$(call define_if_matches, KERNEL_HAS_PAGE_ENDIO, \
-F "void page_endio(struct page *page, int rw, int err);", pagemap.h)
#>=linux-4.8
$(call define_if_matches, KERNEL_HAS_PAGE_ENDIO, \
-F "void page_endio(struct page *page, bool is_write, int err);", pagemap.h)
# kernels <= 2.7.27 use remove_suid, others use file_remove_suid.
# except linux-3.10.0-514.el7, which uses file_remove_privs.
$(call define_if_matches, KERNEL_HAS_FILE_REMOVE_SUID, \
-F "int file_remove_suid(struct file *);", fs.h)
$(call define_if_matches, KERNEL_HAS_FILE_REMOVE_PRIVS, \
-F "int file_remove_privs(struct file *);", fs.h)
KERNEL_FEATURE_DETECTION += $(shell \
grep -sFA1 "sock_recvmsg" ${KSRCDIR_PRUNED_HEAD}/include/linux/net.h \
| grep -qsF "size_t size" \
&& echo "-DKERNEL_HAS_RECVMSG_SIZE")
$(call define_if_matches, KERNEL_HAS_MEMDUP_USER, "memdup_user", string.h)
$(call define_if_matches, KERNEL_HAS_FAULTATTR_DNAME, -F "struct dentry *dname", fault-inject.h)
$(call define_if_matches, KERNEL_HAS_SYSTEM_UTSNAME, "system_utsname", utsname.h)
$(call define_if_matches, KERNEL_HAS_SOCK_CREATE_KERN_NS, "sock_create_kern.struct net", net.h)
$(call define_if_matches, KERNEL_HAS_SOCK_SENDMSG_NOLEN, "sock_sendmsg.*msg.;", net.h)
$(call define_if_matches, KERNEL_HAS_IOV_ITER_INIT_DIR, "iov_iter_init.*direction", uio.h)
$(call define_if_matches, KERNEL_HAS_ITER_KVEC, "ITER_KVEC", uio.h)
$(call define_if_matches, KERNEL_HAS_IOV_ITER_TYPE, "iov_iter_type", uio.h)
$(call define_if_matches, KERNEL_HAS_ITER_BVEC, "ITER_BVEC", uio.h)
$(call define_if_matches, KERNEL_HAS_ITER_PIPE, "ITER_PIPE", uio.h)
$(call define_if_matches, KERNEL_HAS_IOV_ITER_IS_PIPE, "iov_iter_is_pipe", uio.h)
$(call define_if_matches, KERNEL_HAS_ITER_IS_IOVEC, "iter_is_iovec", uio.h)
$(call define_if_matches, KERNEL_HAS_IOV_ITER_IOVEC, "iov_iter_iovec", uio.h)
# iov_iter_iovec removed from 6.4 kernel and used iter_iov_addr & iter_iov_len macro's
$(call define_if_matches, KERNEL_HAS_ITER_IOV_ADDR, "iter_iov_addr", uio.h)
$(call define_if_matches, KERNEL_HAS_GET_SB_NODEV, "get_sb_nodev", fs.h)
$(call define_if_matches, KERNEL_HAS_GENERIC_FILE_LLSEEK_UNLOCKED, "generic_file_llseek_unlocked", \
fs.h)
$(call define_if_matches, KERNEL_HAS_SET_NLINK, "set_nlink", fs.h)
$(call define_if_matches, KERNEL_HAS_DENTRY_PATH_RAW, "dentry_path_raw", dcache.h)
$(call define_if_matches, KERNEL_HAS_FSYNC_DENTRY, -P "(\*fsync).*dentry", fs.h)
$(call define_if_matches, KERNEL_HAS_ITER_FILE_SPLICE_WRITE, "iter_file_splice_write", fs.h)
$(call define_if_matches, KERNEL_HAS_ITER_GENERIC_FILE_SENDFILE, "generic_file_sendfile", fs.h)
$(call define_if_matches, KERNEL_HAS_ITERATE_DIR, "iterate_dir", fs.h)
$(call define_if_matches, KERNEL_HAS_ENCODE_FH_INODE, -P "\(\*encode_fh\).struct inode", exportfs.h)
$(call define_if_matches, KERNEL_HAS_D_DELETE_CONST_ARG, \
-F "int (*d_delete)(const struct dentry *);", dcache.h)
$(call define_if_matches, KERNEL_HAS_FILE_F_VFSMNT, -P "struct vfsmount\s*\*f_vfsmnt", fs.h)
$(call define_if_matches, KERNEL_HAS_POSIX_ACL_XATTR_USERNS_ARG, \
-P "posix_acl_from_xattr.struct user_namespace", posix_acl_xattr.h)
$(call define_if_matches, KERNEL_HAS_D_MAKE_ROOT, d_make_root, dcache.h)
$(call define_if_matches, KERNEL_HAS_GENERIC_WRITE_CHECKS_ITER, \
-P "generic_write_checks.*iov_iter", fs.h)
$(call define_if_matches, KERNEL_HAS_INVALIDATEPAGE_RANGE, \
-P "void \(\*invalidatepage\) \(struct page \*. unsigned int. unsigned int\);", fs.h)
$(call define_if_matches, KERNEL_HAS_PERMISSION_2, \
-P "int \(\*permission\) \(struct inode \*. int\);", fs.h)
$(call define_if_matches, KERNEL_HAS_PERMISSION_FLAGS, \
-P "int \(\*permission\) \(struct inode \*. int. unsigned int\);", fs.h)
KERNEL_FEATURE_DETECTION += $(shell \
grep -sFA5 "kmem_cache_create" ${KSRCDIR_PRUNED_HEAD}/include/linux/slab.h \
| grep -qsF "void (*)(void *, struct kmem_cache *, unsigned long)" \
&& echo "-DKERNEL_HAS_KMEMCACHE_CACHE_FLAGS_CTOR")
KERNEL_FEATURE_DETECTION += $(shell \
grep -sFA5 "kmem_cache_create" ${KSRCDIR_PRUNED_HEAD}/include/linux/slab.h \
| grep -qsF "void (*)(struct kmem_cache *, void *)" \
&& echo "-DKERNEL_HAS_KMEMCACHE_CACHE_CTOR")
KERNEL_FEATURE_DETECTION += $(shell \
grep -sFA5 "kmem_cache_create" ${KSRCDIR_PRUNED_HEAD}/include/linux/slab.h \
| grep -qsxP "\s+void \(\*\)\(.*?\)," \
&& echo "-DKERNEL_HAS_KMEMCACHE_DTOR")
$(call define_if_matches, KERNEL_HAS_SB_BDI, -F "struct backing_dev_info *s_bdi", fs.h)
$(call define_if_matches, KERNEL_HAS_BDI_SETUP_AND_REGISTER, "bdi_setup_and_register", \
backing-dev.h)
$(call define_if_matches, KERNEL_HAS_FOLLOW_LINK_COOKIE, \
-P "const char \* \(\*follow_link\) \(struct dentry \*. void \*\*\);", fs.h)
$(call define_if_matches, KERNEL_HAS_FSYNC_2, \
-F "int (*fsync) (struct file *, int datasync);", fs.h)
KERNEL_FEATURE_DETECTION += $(shell \
grep -sFA20 "struct address_space {" ${KSRCDIR_PRUNED_HEAD}/include/linux/fs.h \
| grep -qsP "struct backing_dev_info *backing_dev_info;" \
&& echo "-DKERNEL_HAS_ADDRESS_SPACE_BDI")
$(call define_if_matches, KERNEL_HAS_COPY_FROM_ITER, "copy_from_iter", uio.h)
$(call define_if_matches, KERNEL_HAS_ALLOC_WORKQUEUE, "alloc_workqueue", workqueue.h)
$(call define_if_matches, KERNEL_HAS_WQ_RESCUER, "WQ_RESCUER", workqueue.h)
$(call define_if_matches, KERNEL_HAS_WAIT_QUEUE_ENTRY_T, "wait_queue_entry_t", wait.h)
$(call define_if_matches, KERNEL_HAS_CURRENT_FS_TIME, "current_fs_time", fs.h)
$(call define_if_matches, KERNEL_HAS_64BIT_TIMESTAMPS, "struct timespec64 ia_atime;", fs.h)
$(call define_if_matches, KERNEL_HAS_SB_NODIRATIME, "SB_NODIRATIME", fs.h)
$(call define_if_matches, KERNEL_HAS_GENERIC_GETXATTR, "generic_getxattr", xattr.h)
KERNEL_FEATURE_DETECTION += $(shell \
grep -sA1 "(*rename) " $(KSRCDIR_PRUNED_HEAD)/include/linux/fs.h \
| grep -qsF "unsigned int" \
&& echo "-DKERNEL_HAS_RENAME_FLAGS")
KERNEL_FEATURE_DETECTION += $(shell \
grep -qsF "static inline ino_t parent_ino" $(KSRCDIR_PRUNED_HEAD)/include/linux/fs.h \
&& echo "-DKERNEL_HAS_PARENT_INO")
KERNEL_FEATURE_DETECTION += $(shell \
grep -qsF "define SLAB_MEM_SPREAD" $(KSRCDIR_PRUNED_HEAD)/include/linux/slab.h \
&& echo "-DKERNEL_HAS_SLAB_MEM_SPREAD")
$(call define_if_matches, KERNEL_ACCESS_OK_WANTS_TYPE, "define access_ok(type, addr, size)" \
$(KSRCDIR_PRUNED_HEAD)/include/asm-generic/uaccess.h)
$(call define_if_matches, KERNEL_SPIN_RELEASE_HAS_3_ARGUMENTS, "\#define spin_release(l, n, i)", lockdep.h)
$(call define_if_matches, KERNEL_HAS_NEW_PDE_DATA, "pde_data", proc_fs.h)
# From linux-5.18, .readpages, .invalidatepage, .set_page_dirty, .launder_page
# are replaced by.readahead, .invalidate_folio, .dirty_folio, launder_folio
#$(call define_if_matches, KERNEL_HAS_READAHEAD, -F "void (*readahead)", fs.h)
$(call define_if_matches, KERNEL_HAS_FOLIO, -F "bool (*dirty_folio)", fs.h)
$(call define_if_matches, KERNEL_HAS_READ_FOLIO, -F "int (*read_folio)", fs.h)
KERNEL_FEATURE_DETECTION += $(shell \
grep -sFA1 "int (*writepage_t)" ${KSRCDIR_PRUNED_HEAD}/include/linux/writeback.h \
| grep -qsF "struct folio *" \
&& echo "-DKERNEL_WRITEPAGE_HAS_FOLIO")
KERNEL_FEATURE_DETECTION += $(shell \
grep -sFA1 "int (*write_begin)" ${KSRCDIR_PRUNED_HEAD}/include/linux/fs.h \
| grep -qsF "unsigned flags" \
&& echo "-DKERNEL_WRITE_BEGIN_HAS_FLAGS")
# Matching: int posix_acl_chmod(struct user_namespace *, struct dentry *, umode_t)
KERNEL_FEATURE_DETECTION += $(shell \
grep -sF "int posix_acl_chmod" ${KSRCDIR_PRUNED_HEAD}/include/linux/posix_acl.h \
| grep -qs "struct user_namespace\s*.*struct dentry" \
&& echo "-DKERNEL_HAS_POSIX_ACL_CHMOD_NS_DENTRY")
# linux-6.0 has iov_iter_get_pages2
$(call define_if_matches, KERNEL_HAS_IOV_ITER_GET_PAGES2, "iov_iter_get_pages2", uio.h)
$(call define_if_matches, KERNEL_HAS_GET_RANDOM_INT, "get_random_int", random.h)
# Detect if write_begin() uses struct folio**
KERNEL_FEATURE_DETECTION += $(shell \
grep -sFA2 "int (*write_begin)" ${KSRCDIR_PRUNED_HEAD}/include/linux/fs.h \
| grep -qs "struct folio **" \
&& echo "-DKERNEL_WRITE_BEGIN_USES_FOLIO")

View File

@@ -0,0 +1,309 @@
# This is the BeeGFS client makefile.
# It creates the client kernel module (beegfs.ko).
#
# Use "make help" to find out about configuration options.
#
# Note: This is the Makefile for internal use, there is a separate Release.mk
# file for release packages (to handle the closed source tree properly).
TARGET ?= beegfs
export TARGET
export OFED_INCLUDE_PATH
export BEEGFS_NO_RDMA
BEEGFS_DKMS_BUILD=0
ifdef KERNELRELEASE
BEEGFS_DKMS_BUILD=1
endif
ifeq ($(BEEGFS_DKMS_BUILD),1)
-include /etc/beegfs/beegfs-client-build.mk
endif
-include Version.mk
ifeq ($(obj),)
BEEGFS_BUILDDIR := $(shell pwd)
else
BEEGFS_BUILDDIR := $(obj)
endif
ifeq ($(KRELEASE),)
KRELEASE := $(shell uname -r)
endif
ifneq ($(BEEGFS_NO_RDMA),)
BEEGFS_CFLAGS += -DBEEGFS_NO_RDMA
else
$(info $$OFED_INCLUDE_PATH = [${OFED_INCLUDE_PATH}])
ifneq ($(OFED_INCLUDE_PATH),)
BEEGFS_CFLAGS += -I$(OFED_INCLUDE_PATH)
export KBUILD_EXTRA_SYMBOLS += $(OFED_INCLUDE_PATH)/../Module.symvers
endif
endif
# The following section deals with the auto-detection of the kernel
# build directory (KDIR)
# Guess KDIR based on running kernel.
# - "/usr/src/linux-headers-*" for Ubuntu
# - "/usr/src/kernels/*" for RHEL
# - "/lib/modules/*/build" for Debian, SLES
ifeq ($(KDIR),)
override KDIR = \
/lib/modules/$(KRELEASE)/build \
/lib/modules/default/build \
/usr/src/linux-headers-$(KRELEASE) \
/usr/src/linux-headers-default \
/usr/src/kernels/$(KRELEASE) \
/usr/src/kernels/default
endif
# Prune the KDIR list down to paths that exist and have an
# /include/linux/version.h file
# Note: linux-3.7 moved version.h to generated/uapi/linux/version.h
test_dir = $(shell [ -e $(dir)/include/linux/version.h -o \
-e $(dir)/include/generated/uapi/linux/version.h ] && echo $(dir) )
KDIR_PRUNED := $(foreach dir, $(KDIR), $(test_dir) )
# We use the first valid entry of the pruned KDIR list
KDIR_PRUNED_HEAD := $(firstword $(KDIR_PRUNED) )
# The following section deals with the auto-detection of the kernel
# source path (KSRCDIR) which is required e.g. for KERNEL_FEATURE_DETECTION.
# Guess KSRCDIR based on KDIR
# (This is usually KDIR or KDIR/../source, so you can specify multiple
# directories here as a space-separated list)
ifeq ($(KSRCDIR),)
# Note: "KSRCDIR += $(KDIR)/../source" is not working here
# because of the symlink ".../build"), so we do it with substring
# replacement
KSRCDIR := $(subst /build,/source, $(KDIR_PRUNED_HEAD) )
KSRCDIR += $(KDIR)
endif
# Prune the KSRCDIR list down to paths that exist and contain an
# include/linux/fs.h file
test_dir = $(shell [ -e $(dir)/include/linux/fs.h ] && echo $(dir) )
KSRCDIR_PRUNED := $(foreach dir, $(KSRCDIR), $(test_dir) )
# We use the first valid entry of the pruned KSRCDIR list
KSRCDIR_PRUNED_HEAD := $(firstword $(KSRCDIR_PRUNED) )
ifeq ($(BEEGFS_NO_RDMA),)
# OFED
ifneq ($(OFED_INCLUDE_PATH),)
BEEGFS_CFLAGS += -I$(OFED_INCLUDE_PATH)
module: $(OFED_INCLUDE_PATH)/rdma/rdma_cm.h
$(OFED_INCLUDE_PATH)/rdma/rdma_cm.h:
$(error OFED_INCLUDE_PATH not valid: $(OFED_INCLUDE_PATH))
endif
endif
# Include kernel feature auto-detectors
include KernelFeatureDetection.mk
KMOD_INST_DIR ?= $(DESTDIR)/lib/modules/$(KRELEASE)/updates/fs/beegfs
# Prepare CFLAGS:
# (Note: "-Wsign-compare" included in "-Wextra", but must be explicit here,
# because kernel Makefile adds "-Wno-sign-compare" by default. But we can't
# make it permanent here, because it generates a lot of warnings from kernel
# includes.)
BEEGFS_CFLAGS := $(BUILD_ARCH) $(KERNEL_FEATURE_DETECTION) \
-I$(BEEGFS_BUILDDIR)/../source \
-I$(BEEGFS_BUILDDIR)/../include \
-Wextra -Wno-sign-compare -Wno-empty-body -Wno-unused-parameter -Wno-missing-field-initializers \
-DBEEGFS_MODULE_NAME_STR='\"$(TARGET)\"'
# Update 2022-12: BeeGFS module source code had already switched to -std=gnu99,
# but now the kernel has caught up with us - kernel moved from gnu89 to
# gnu11.
# So we're switching from gnu99 to gnu11, to not break the build with the newer
# kernels. We still need to specify this flag because that would break the
# client module build with older kernels, where gnu89 is the default.
BEEGFS_CFLAGS += -std=gnu11
ifeq ($(shell echo | gcc -Wtype-limits -E - >/dev/null 2>&1 && echo 1),1)
BEEGFS_CFLAGS += -Wno-type-limits
endif
# -O0 would be better, but is not allowed by kernel includes (will not work)
BEEGFS_CFLAGS_DEBUG := -O1 -ggdb3 -rdynamic -fno-inline -DBEEGFS_DEBUG \
-DLOG_DEBUG_MESSAGES -DDEBUG_REFCOUNT -DBEEGFS_LOG_CONN_ERRORS
BEEGFS_CFLAGS_RELEASE := -Wuninitialized
ifeq ($(BEEGFS_DEBUG),)
BEEGFS_CFLAGS += $(BEEGFS_CFLAGS_RELEASE)
else
BEEGFS_CFLAGS += $(BEEGFS_CFLAGS_DEBUG)
endif
ifeq ($(BEEGFS_NO_RDMA),)
# NVFS
ifneq ($(NVFS_INCLUDE_PATH),)
$(NVFS_INCLUDE_PATH)/nvfs-dma.h:
$(error NVFS_INCLUDE_PATH missing nvfs-dma.h: $(NVFS_INCLUDE_PATH))
$(NVFS_INCLUDE_PATH)/config-host.h:
$(error NVFS_INCLUDE_PATH missing config-host.h: $(NVFS_INCLUDE_PATH))
$(NVIDIA_INCLUDE_PATH)/nv-p2p.h:
$(error NVIDIA_INCLUDE_PATH missing nv-p2p.h: $(NVIDIA_INCLUDE_PATH))
module: $(NVFS_INCLUDE_PATH)/nvfs-dma.h $(NVFS_INCLUDE_PATH)/config-host.h \
$(NVIDIA_INCLUDE_PATH)/nv-p2p.h
BEEGFS_CFLAGS += -DBEEGFS_NVFS
BEEGFS_CFLAGS += -I$(NVFS_INCLUDE_PATH) -I$(NVIDIA_INCLUDE_PATH)
endif
endif
# if path to strip command was not given, use default
# (alternative strip is important when cross-compiling)
ifeq ($(STRIP),)
STRIP=strip
endif
BEEGFS_CFLAGS += '-DBEEGFS_VERSION=\"$(BEEGFS_VERSION)\"'
# Prepare RELEASE_PATH extension
ifneq ($(RELEASE_PATH),)
RELEASE_PATH_CLIENT := $(RELEASE_PATH)/client_module_$(shell echo '$(BEEGFS_VERSION)' | cut -d. -f1)
endif
all: module
@ /bin/true
module: $(TARGET_ALL_DEPS)
ifeq ($(KDIR_PRUNED_HEAD),)
$(error Linux kernel build directory not found. Please check if\
the kernel module development packages are installed for the current kernel\
version. (RHEL: kernel-devel; SLES: kernel-default-devel; Debian: linux-headers))
endif
ifeq ($(KSRCDIR_PRUNED_HEAD),)
$(error Linux kernel source directory not found. Please check if\
the kernel module development packages are installed for the current kernel\
version. (RHEL: kernel-devel; SLES: kernel-default-devel; Debian: linux-headers))
endif
@echo "Building beegfs client module"
$(MAKE) -C $(KDIR_PRUNED_HEAD) "M=$(BEEGFS_BUILDDIR)/../source" \
"EXTRA_CFLAGS=$(BEEGFS_CFLAGS) $(EXTRA_CFLAGS)" modules
@cp ../source/$(TARGET).ko .
@ cp ${TARGET}.ko ${TARGET}-unstripped.ko
@ ${STRIP} --strip-debug ${TARGET}.ko;
coccicheck:
$(MAKE) -C $(KDIR_PRUNED_HEAD) "M=$(BEEGFS_BUILDDIR)" coccicheck MODE=report \
M=$(BEEGFS_BUILDDIR)/../source KBUILD_EXTMOD="$(BEEGFS_BUILDDIR)/../source"
include AutoRebuild.mk # adds auto_rebuild targets
prepare_release:
ifeq ($(RELEASE_PATH),)
$(error RELEASE_PATH not defined)
endif
@ echo "Creating release directory:" $(RELEASE_PATH_CLIENT)
mkdir --parents $(RELEASE_PATH_CLIENT)/build \
$(RELEASE_PATH_CLIENT)/source \
$(RELEASE_PATH_CLIENT)/include
@ echo "Storing beegfs version:" $(BEEGFS_VERSION)
echo "BEEGFS_VERSION =" $(BEEGFS_VERSION) > $(RELEASE_PATH_CLIENT)/build/Version.mk
@ echo "Copying beegfs client release files to" $(RELEASE_PATH_CLIENT) "..."
cp Makefile $(RELEASE_PATH_CLIENT)/build/Makefile
cp KernelFeatureDetection.mk $(RELEASE_PATH_CLIENT)/build/
cp AutoRebuild.mk $(RELEASE_PATH_CLIENT)/build/
cp feature-detect.sh $(RELEASE_PATH_CLIENT)/build/
cp ../source/Makefile $(RELEASE_PATH_CLIENT)/source/
find ../source -mount -name '*.h' -type f | \
xargs -I {} cp --parents {} $(RELEASE_PATH_CLIENT)/build
find ../source -mount -name '*.c' -type f | \
xargs -I {} cp --parents {} $(RELEASE_PATH_CLIENT)/build
find ../include -mount -name '*.h' -type f | \
xargs -I {} cp --parents {} $(RELEASE_PATH_CLIENT)/build
# When used for development where the full BeeGFS source is available, this install target handles
# ensuring the mount.beegfs script is installed. If the mount.script is not present in the source,
# for example if the install target was invoked via the BeeGFS client service and AutoRebuild.mk, it
# just checks the script already exists at /sbin/mount.beegfs since the script should have been
# installed by the package manager. If it does not exist an error is returned as this is likely a
# bug elsewhere related to installing the script, or somebody is trying to use this Makefile in an
# unsupported/unexpected manner and further investigation is required.
install:
install -D -m 644 $(TARGET).ko $(KMOD_INST_DIR)/$(TARGET).ko
@if [ -f dist/sbin/mount.beegfs ]; then \
install -D -m 755 dist/sbin/mount.beegfs /sbin/mount.beegfs; \
echo "Info: Installed mount script at /sbin/mount.beegfs."; \
elif [ ! -f /sbin/mount.beegfs ]; then \
echo "Error: mount.beegfs does not already exist at /sbin/mount.beegfs (this is likely a bug elsewhere)."; \
exit 1; \
fi
depmod -a $(KRELEASE)
clean:
rm -f *~ .${TARGET}??*
rm -f .*.cmd *.mod.c *.mod.o *.o *.ko *.ko.unsigned
rm -f ../source/Module*.symvers ../source/modules.order ../source/Module.markers
rm -f Module*.symvers modules.order Module.markers
rm -f $(AUTO_REBUILD_KVER_FILE)
rm -rf .tmp_versions/
find ../source/ -mount -name '*.o' -type f -delete
find ../source/ -mount -name '.*.o.cmd' -type f -delete
find ../source/ -mount -name '.*.o.d' -type f -delete
find ../source/ -mount -name '*.gcno' -type f -delete
help:
@echo "This makefile creates the kernel module: $(TARGET) (beegfs-client)"
@echo ' '
@echo 'client Arguments (required):'
@echo ' RELEASE_PATH=<path> (Target: prepare_release)'
@echo ' The path to the client release directory.'
@echo ' '
@echo 'client Arguments (optional):'
@echo ' KRELEASE=<release>: Kernel release'
@echo ' (The output of "uname -r" will be used if undefined.'
@echo ' This option is useful when building for a kernel different'
@echo ' from the one currently running (e.g. in a chroot).)'
@echo ' KDIR=<path>: Kernel build directory.'
@echo ' (Will be guessed based on running kernel or KRELEASE if undefined.)'
@echo ' KSRCDIR=<path>: Kernel source directory containing the kernel include '
@echo ' directory. (Will be guessed based on KDIR if undefined.)'
@echo ' BEEGFS_DEBUG=1:'
@echo ' Enables file sytem debug log messages etc.'
@echo ' TARGET=<MODULE_NAME>'
@echo ' Set a different module and file system name.'
@echo ' '
@echo 'Infiniband (RDMA) arguments (optional):'
@echo ' OFED_INCLUDE_PATH=<path>:'
@echo ' Path to OpenFabrics Enterpise Distribution kernel include directory, e.g.'
@echo ' "/usr/src/openib/include". (If not defined, the standard kernel headers'
@echo ' will be used.)'
@echo ''
@echo 'NVIDIA GPUDirect Storage (GDS) arguments (optional):'
@echo ' NVFS_INCLUDE_PATH=<path>:'
@echo ' Path to directory that contains nvfs-dma.h. If not defined, GDS support is'
@echo ' disabled.'
@echo ' NVIDIA_INCLUDE_PATH=<path>:'
@echo ' Path to NVIDIA driver source. Required when NVFS_INCLUDE_PATH is specifed.'
@echo ''
@echo 'Targets:'
@echo ' all (default) - build only'
@echo ' install - install the kernel modules'
@echo ' clean - delete previously compiled files'
@echo ' prepare_release - build and copy files into the RELEASE_PATH directory'

View File

@@ -0,0 +1,92 @@
# This is a config file for the automatic build process of BeeGFS client kernel
# modules.
# http://www.beegfs.com
#
# --- Section: [Notes] ---
#
# General Notes
# =============
# To force a rebuild of the client modules:
# $ /etc/init.d/beegfs-client rebuild
#
# To see a list of available build arguments:
# $ make help -C /opt/beegfs/src/client/client_module_${BEEGFS_MAJOR_VERSION}/build
#
# Help example for BeeGFS 2015.03 release:
# $ make help -C /opt/beegfs/src/client/client_module_2015.03/build
# RDMA Support Notes
# ==================
# If you installed InfiniBand kernel modules from OpenFabrics OFED, then also
# define the correspsonding header include path by adding
# "OFED_INCLUDE_PATH=<path>" to the "buildArgs", where <path> usually is
# "/usr/src/openib/include" or "/usr/src/ofa_kernel/default/include" for
# Mellanox OFED.
#
# OFED headers are automatically detected even if OFED_INCLUDE_PATH is not
# defined. To build the client without RDMA support, define BEEGFS_NO_RDMA=1.
#
# NVIDIA GPUDirect Storage Support Notes
# ==================
# If you want to build BeeGFS with NVIDIA GPUDirect Storage support, add
# "NVFS_INCLUDE_PATH=<path>" to the "buildArgs" below, where path is the directory
# that contains nvfs-dma.h. This is usually the nvidia-fs source directory:
# /usr/src/nvidia-fs-VERSION.
#
# If config-host.h is not present in NVFS_INCLUDE_PATH, execute the configure
# script. Example:
# $ cd /usr/src/nvidia-fs-2.13.5
# $ ./configure
#
# NVIDIA_INCLUDE_PATH must be defined and point to the NVIDIA driver source:
# /usr/src/nvidia-VERSION/nvidia
#
# OFED_INCLUDE_PATH must be defined and point to Mellanox OFED.
#
#
# --- Section: [Build Settings] ---
#
# Build Settings
# ==============
# These are the arguments for the client module "make" command.
#
# Note: Quotation marks and equal signs can be used without escape characters
# here.
#
# Example1:
# buildArgs=-j8
#
# Example2 (see "RDMA Support Notes" above):
# buildArgs=-j8 OFED_INCLUDE_PATH=/usr/src/openib/include
#
# Example3 (see "NVIDIA GPUDirect Storage Support Notes" above):
# buildArgs=-j8 OFED_INCLUDE_PATH=/usr/src/ofa_kernel/default/include \
# NVFS_INCLUDE_PATH=/usr/src/nvidia-fs-2.13.5 \
# NVIDIA_INCLUDE_PATH=/usr/src/nvidia-520.61.05/nvidia
#
# Default:
# buildArgs=-j8
buildArgs=-j8
# Turn Autobuild on/off
# =====================
# Controls whether modules will be built on "/etc/init.d/beegfs-client start".
#
# Note that even if autobuild is enabled here, the modules will only be built
# if no beegfs kernel module for the current kernel version exists in
# "/lib/modules/<kernel_version>/updates/".
#
# Default:
# buildEnabled=true
buildEnabled=true

View File

@@ -0,0 +1,19 @@
# BeeGFS client module DKMS build configuration
# This file is only used when building via DKMS.
# The module needs to be rebuilt after this file has been changed.
# If using thirdparty OFED specify the path to the installation here.
# Examples:
#OFED_INCLUDE_PATH=/usr/src/ofa_kernel/default/include
#OFED_INCLUDE_PATH=/usr/src/openib/include
# To disable RDMA support, define BEEGFS_NO_RDMA
#BEEGFS_NO_RDMA=1
# If building nvidia-fs support, specify path to nvfs-dma.h.
# This directory must also have config-host.h, which is created
# by the nvidia-fs configure script.
# Example:
#NVFS_INCLUDE_PATH=/usr/src/nvidia-fs-2.13.5
# If building nvidia-fs support, specify path to NVIDIA driver
# source.
# Example:
#NVIDIA_INCLUDE_PATH=/usr/src/nvidia-520.61.05/nvidia

View File

@@ -0,0 +1,37 @@
#!/bin/bash -e
# BeeGFS client mount hook script
action="${1}"
mountpoint="${2}"
# THIS IS AN EXAMPLE SCRIPT.
# Copy and modify it, and remove the following line:
exit 1
if [ ! -d "${mountpoint}" ]
then
echo "${0}: Mount point does not exist: ${mountpoint}"
exit 1
fi
case "${action}" in
pre-mount)
;;
post-mount)
mount -o bind "${mountpoint}/foo" "${mountpoint}/bar"
;;
pre-unmount)
umount "${mountpoint}/bar"
;;
post-unmount)
;;
*)
echo "${0}: Unrecognized option supplied to client mount hook: ${action}"
exit 1
;;
esac

View File

@@ -0,0 +1,755 @@
# This is a config file for BeeGFS clients.
# http://www.beegfs.com
# --- [Table of Contents] ---
#
# 1) Settings
# 2) Mount Options
# 3) Basic Settings Documentation
# 4) Advanced Settings Documentation
#
# --- Section 1.1: [Basic Settings] ---
#
sysMgmtdHost =
#
# --- Section 1.2: [Advanced Settings] ---
#
connAuthFile = /etc/beegfs/conn.auth
connDisableAuthentication = false
connClientPort = 8004
connMgmtdPort = 8008
connPortShift = 0
connCommRetrySecs = 600
connFallbackExpirationSecs = 900
connInterfacesFile =
connRDMAInterfacesFile =
connMaxInternodeNum = 12
connMaxConcurrentAttempts = 0
connNetFilterFile =
connUseRDMA = true
connTCPFallbackEnabled = true
connTCPRcvBufSize = 0
connUDPRcvBufSize = 0
connRDMABufNum = 70
connRDMABufSize = 8192
connRDMAFragmentSize = page
connRDMATypeOfService = 0
connTcpOnlyFilterFile =
logClientID = false
logLevel = 3
quotaEnabled = false
sysCacheInvalidationVersion = true
sysCreateHardlinksAsSymlinks = false
sysMountSanityCheckMS = 11000
sysSessionCheckOnClose = false
sysSyncOnClose = false
sysTargetOfflineTimeoutSecs = 900
sysUpdateTargetStatesSecs = 30
sysXAttrsEnabled = false
tuneFileCacheType = buffered
tunePreferredMetaFile =
tunePreferredStorageFile =
tuneRemoteFSync = true
tuneUseGlobalAppendLocks = false
tuneUseGlobalFileLocks = false
#
# --- Section 1.3: [Enterprise Features] ---
#
# See end-user license agreement for definition and usage limitations of
# enterprise features.
#
sysACLsEnabled = false
#
# --- Section 2: [Mount Options] ---
#
# Valid mount options are:
# cfgFile, logLevel, connPortShift, connMgmtdPort,
# sysMgmtdHost, sysMountSanityCheckMS, connInterfacesList.
#
# Use the mount option "cfgFile" to specify a different config file
# for the beegfs client.
# Example:
# $ /bin/mount -t beegfs beegfs_nodev /beegfs -ocfgFile=/etc/anotherconfig.conf
#
# Use the mount option "connInterfacesList" to pass the list of interfaces names.
# These interfaces names should be space-separated.
# Example:
# $ /bin/mount -t beegfs beegfs_nodev /beegfs \
# -ocfgFile=/etc/anotherconfig.conf,connInterfacesList='ib0 eth0'
#
# Mount options override the corresponding config file values.
# Example:
# $ /bin/mount -ocfgFile=/etc/anotherconfig.conf,logLevel=3 ...
#
# --- Section 3: [Basic Settings Documentation] ---
#
# [sysMgmtdHost]
# Hostname (or IP) of the host running the management service.
# (See also "connMgmtdPort".)
# Default: <none>
#
# --- Section 4: [Advanced Settings Documentation] ---
#
#
# --- Section 4.1: [Connections & Communication] ---
#
# [connAuthFile]
# The path to a file that contains a shared secret for connection based
# authentication. Only peers that use the same shared secret will be able to
# connect.
# Default: <none>
# [connDisableAuthentication]
# If set to true, explicitly disables connection authentication and allow the
# service to run without a connAuthFile. Running BeeGFS without connection
# authentication is considered insecure and is not recommended.
# Default: false
# [connClientPort]
# The UDP port of the client.
# Default: 8004
# [connMgmtdPort]
# The UDP and TCP port of the management node.
# Default: 8008
# [connPortShift]
# Shifts all following UDP and TCP ports according to the specified value.
# Intended to make port configuration easier in case you do not want to
# configure each port individually.
# Default: 0
# [connCommRetrySecs]
# The time (in seconds) for retries in case a network communication fails
# (e.g. if a server is down). After this time, the I/O operation will fail
# and the calling process will receive an error.
# Note: Set this value to 0 for infinite retries. In this case, a process
# accessing the file system will block until the corresponding server
# becomes available (or until it is interrupted by a signal).
# Default: 600
# [connFallbackExpirationSecs]
# The time in seconds after which a connection to a fallback interface expires.
# When a fallback connection expires, the system will try to establish a new
# connection to the other hosts primary interface (falling back to another
# interface again if necessary).
# Note: The priority of node interfaces can be configured using the
# "connInterfacesFile" parameter.
# Default: 900
# [connInterfacesFile]
# The path to a text file that specifies the names of the interfaces, which
# may be used for communication by other nodes. One interface per line. The
# line number also defines the priority of an interface.
# Example: "ib0" in the first line, "eth0" in the second line.
# Values: This setting is optional. If unspecified, all available interfaces
# will be published and priorities will be assigned automatically.
# Note: This has no influence on outgoing connections. The information is sent
# to other hosts to inform them about possible communication paths.
# Default: <none>
# [connInterfacesList]
# Comma-separated list of interface names. Performs the same function as
# connInterfacesFile.
# If use as the mount option "connInterfacesList" to pass the list of interfaces
# names then it override the corresponding config file/list values..
# The interfaces names should be space-separated.
# Example:
# $ /bin/mount -t beegfs beegfs_nodev /beegfs \
# -ocfgFile=/etc/anotherconfig.conf,connInterfacesList='ib0 eth0'
#
# Default: <none>
# [connRDMAInterfacesFile]
# The path to a text file that specifies the names of IPoIB interfaces, which
# may be used for outbound RDMA communication with other nodes. One interface
# per line. These interfaces must be RDMA-capable NICs.
#
# All storage and metadata servers must be IP-reachable from each specified
# interface.
#
# Specifying interfaces in this file limits which RDMA NICs are used for outbound
# RDMA. Specifying multiple interfaces allows the client to use multiple RDMA
# interfaces for outbound communication.
#
# Example: "ib0" in the first line, "ib1" in the second line.
# Values: This setting is optional. When none are specified, the client will use
# the first client host interface that can reach the remote node via IPoIB,
# as decided by rdma_cm. When multiple interfaces are specified, the client
# round-robins creation of outbound RDMA connections across the specified
# interfaces.
# Default: <none>
# [connMaxInternodeNum]
# The maximum number of simultaneous connections to the same node.
# Default: 12
# [connMaxConcurrentAttempts]
# The maximum number of simultaneous connection attempts. This may help in case
# establishing new connections keeps failing and produces fallbacks.
# It may happen particularly when using RDMA in an Omni-Path setup. If you
# don't have failing connection attempts, tuning this option might still lead
# to a faster connection process. This option is experimental, so there is no
# experience with different values. Setting it to 0 disables it, which means
# concurrent connection attempts are not limited.
# Default: 0
# [connNetFilterFile]
# The path to a text file that specifies allowed IP subnets, which may be used
# for outgoing communication. One subnet per line in classless notation (IP
# address and number of significant bits).
# Example: "192.168.10.0/24" in the first line, "192.168.20.0/24" in the second
# line.
# This value is optional. If unspecified, all addresses are allowed for
# outgoing communication.
# Default: <none>
# [connUseRDMA]
# Enables the use of Remote Direct Memory Access (RDMA) for InfiniBand or RoCE.
# For this setting to be effective, OFED ibverbs support also has to be enabled
# at compile time of the beegfs client modules (typically via
# beegfs-client-autobuild.conf).
# Default: true
# [connTCPFallbackEnabled]
# Enables fallback from RDMA to TCP sockets when there is a problem connecting
# via RDMA to a storage or meta node.
# Default: true
# [connTCPRcvBufSize], [connUDPRcvBufSize]
# Sets the size for TCP and UDP socket receive buffers (SO_RCVBUF). The maximum
# allowed value is determined by sysctl net.core.rmem_max. This value is ignored
# if it is less than the default value determined by net.core.rmem_default.
# For legacy reasons, the default value 0 indicates that the buffer size is set
# to connRDMABufNum * connRDMABufSize.
# -1 indicates that the buffer size should be left at the system default.
# Default: 0
# [connRDMABufNum], [connRDMABufSize], [connRDMAFragmentSize]
# InfiniBand RDMA buffer settings.
# connRDMABufSize is the maximum size of a buffer (in bytes) that will be sent
# over the network; connRDMABufNum is the number of available buffers that can
# be in flight for a single connection. These client settings are also applied
# on the server side for each connection. Ideally, the largest, commonly used
# filesytem chunksize should be < connRDMABufNum * connRDMABufSize to achieve
# the best performance.
#
# The minimum usable value for connRDMABufNum is 3, which is required by the
# BeeGFS RDMA protocol. Lower values will immediately result in communication
# failures.
#
# connRDMAFragmentSize determines how contiguous memory is allocated per
# buffer. If connRDMAFragmentSize=4096 and connRDMABufSize=8192, each buffer
# is allocated in 2 regions of 4096 contiguous bytes. Less fragmentation
# improves performance. The value "none" indicates that buffers will not be
# fragmented, resulting in allocation of contiguous regions of
# connRDMABufSize. The value "page" uses the Linux PAGE_SIZE as the
# fragmentation value.
# The reason for using fragmentation is that large allocations
# are more likely to fail if there is a shortage of heap memory. The minimum
# fragmentation value is PAGE_SIZE. Using larger values (or 0) should improve
# performance and allows for larger values of connRDMABufSize.
#
# Note: RAM usage per connection is connRDMABufSize x connRDMABufNum x 2. Keep
# resulting RAM usage (x connMaxInternodeNum x number_of_clients) on the
# server in mind when increasing these values.
# Default: 70, 8192, page
# [connRDMAMetaBufNum], [connRDMAMetaBufSize], [connRDMAMetaFragmentSize]
# InfiniBand RDMA buffer settings for connections to beegfs-meta.
# These settings behave in the same way as connRDMABufNum, connRDMABufSize
# and connRDMAFragmentize except that they are used for connections to
# beegfs-meta.
# Metadata messages are usuallly small and do not require the large amount
# of buffer space that is typically configured for connections to
# beegfs-storage. One exception to this would be if large extended attributes
# are added to files.
# connRDMAMetaBufNum = "default" indicates that connRDMABufNum should be used.
# connRDMAMetaBufSize = "default" indicates that connRDMABufSize should be used.
# connRDMAMetaFragmentSize = "default" indicates that connRDMAFragmentSize
# should be used.
# The minimum value for connRDMAMetaBufNum is 3.
# Default: default, default, default
# [connRDMATypeOfService]
# InfiniBand provides the option to set a type of service for an application.
# This type of service can be used by your subnet manager to provide Quality of
# Service functionality (e.g. setting different service levels).
# In openSM the service type will be mapped to the parameter qos-class, which
# can be handled in your QoS configuration.
# See
# www.openfabrics.org/downloads/OFED/ofed-1.4/OFED-1.4-docs/
# QoS_management_in_OpenSM.txt
# for more information on how to configure openSM for QoS.
# This parameter sets the type of service for all outgoing connections of this
# daemon.
# Default: 0 (Max: 255)
# [connRDMAKeyType]
# In RDMA, an "rkey" is used to provide an access token for a peer to access
# local memory regions that are registered for RDMA. Historically,
# BeeGFS used either a "DMA key" or an "unsafe global rkey" depending upon
# whether or not "unsafe global rkey" is supported by the operating system.
# This is now selectable. "DMA key" is not supported on kernel >= 4.9
# unless MOFED is installed. If an unsupported option is specified, there
# will be warnings in syslog and RDMA connections will not be established.
# Use of "unsafe global rkey" is preferred, but generates a syslog message
# every time an RDMA connection is established: "enabling unsafe global rkey".
# Neither option is considered "safe" because they both provide access
# to all DMA mapped memory for a given connection. This technique is
# used to provide better performance for small I/O requests.
# "register" uses a memory registration per connection to provide an rkey.
# "register" is not compatible with NVIDIA GPUDirect Storage.
# Specify "dma" or "register" to squelch the syslog warning.
# Values: "global" (unsafe global rkey), "dma" (DMA key), "register"
# (memory registration)
# Default: "global"
# [connTcpOnlyFilterFile]
# The path to a text file that specifies IP address ranges to which no RDMA
# connection should be established. This is useful e.g. for environments where
# all hosts support RDMA, but some hosts cannot connect via RDMA to some other
# hosts.
# Example: "192.168.10.0/24" in the first line, "192.168.20.0/24" in the second
# line.
# Values: This setting is optional.
# Default: <none>
# [connMessagingTimeouts]
# These constants are used to set some of the connection timeouts for sending
# and receiving data between services in the cluster. They used to be hard-coded
# (CONN_LONG_TIMEOUT, CONN_MEDIUM_TIMEOUT and CONN_SHORT_TIMEOUT) but are now
# made configurable for experimentation purposes.
# This option takes three integer values of milliseconds, separated by a comma
# in the order long, medium, short.
# WARNING: This is an EXPERIMENTAL configuration option that should not be
# changed in production environments unless properly tested and validated.
# Some configurations can lead to service lockups and other subtle issues.
# Please make sure that you know exactly what you are doing and properly
# test any changes you make.
# Default: 600000,90000,30000
# [connRDMATimeouts]
# These constants are used to set some of the timeouts for sending and receiving
# data between services in the cluster via RDMA. They used to be
# hard-coded IBVSOCKET_CONN_TIMEOUT_MS, IBVSOCKET_COMPLETION_TIMEOUT_MS,
# IBVSOCKET_FLOWCONTROL_ONSEND_TIMEOUT_MS,
# IBVSOCKET_FLOWCONTROL_ONRECV_TIMEOUT_MS and a 10000 literal for poll timeout
# but are now made configurable for experimentation purposes.
# This option takes five integer values of milliseconds, separated by a comma
# in the order connectMS, completionMS, flowSendMS, flowRecvMS and pollMS.
# WARNING: This is an EXPERIMENTAL configuration option that should not be
# changed in production environments unless properly tested and validated.
# Some configurations can lead to service lockups and other subtle issues.
# Please make sure that you know exactly what you are doing and properly
# test any changes you make.
# Default: 5000,300000,180000,180000,10000
# --- Section 4.2: [Logging] ---
#
# [logClientID]
# Defines whether the ClientID should appear in each log line.
# This is mainly helpful if BeeGFS is mounted multiple times on this machine.
# Default: false
# [logLevel]
# Defines the amount of log messages. The higher this level, the more detailed
# the log messages will be.
# Level 3 will print connection messages, level 4 will print syscall messages,
# level 5 will print debug messages.
# Note: Levels above 3 might decrease performance.
# Default: 3 (Max: 5)
#
# --- Section 4.3: [Quota Settings] ---
#
# [quotaEnabled]
# Enables user and group quota support by transferring extra user data to the
# servers. This uses quota information of the underlying file systems on the
# storage servers, which needs to be enabled by the server administrator.
# Note: In the first implementation, only quota monitoring is available.
# Note: Get quota information with "beegfs-ctl --getquota".
# Note: If this option is true, performance might be slightly decreased due to
# extra information tracking.
# Default: false
#
# --- Section 4.4: [System Settings] ---
#
# [sysCacheInvalidationVersion]
#
# Enable the client to invalidate its cache and reload the inode of a file when
# the version parameter of the file on metadata changes due to internal metadata
# operations such as stripe pattern change. This is done by comparing the
# version parameters on client and metadata on the first lookup after internal
# metadata changes. If the versions differ, the client invalidates the cache and
# reloads the inode.
# Note: If this option is set to true, performance may be decreased.
# Default: true
# [sysCreateHardlinksAsSymlinks]
# Create a symlink when an application tries to create a hardlink for files in
# different directories.
# Default: false
# [sysMountSanityCheckMS]
# Perform some basic checks during mount (e.g. whether the client helper daemon
# and storage servers are reachable). Mounting will fail if a problem is
# detected.
# Values: Set the time (in ms) you want to spend waiting for the servers
# (especially the management daemon) to respond. Use 0 to disable all checks
# and allow mounting even if no servers are reachable.
# Default: 11000
# [sysSessionCheckOnClose]
# Checks for a valid session on the storage servers when a file is closed. If
# this option is set to true, a potential cache loss from a crash of a storage
# server can be detected. This will be reported to the user application as a
# close() error code.
# Note: There is also a session check included in all read/write/fsync messages,
# which is independent of this setting.
# Note: If this option is set to true, more network messages are required on
# close(), so performance will decreased.
# Default: false
# [sysSessionChecksEnabled]
# Enable session checks in read/write/fsync operations to be able to detect
# server crashes that could have caused a loss of server side caches. Disabling
# these checks is useful in certain system configurations to be able to cleanly
# resume I/O after a server crash/unclean failover.
# WARNING: Disabling session checks can lead to undetected cache loss and
# therefore silent data corruption on the storage servers. Only disable the
# checks if absolutely necessary and if there are measures in place to prevent
# cache loss (synchronous mounts, battery backed caches) on the storage servers.
# Default: true
# [sysSyncOnClose]
# Sync file contents on close. If this option is set to true, the storage
# servers will flush the write cache of a file to disk immediately when it is
# closed by the application. If this option is set to false, the write cache
# will be flushed to disk asynchronously after a few seconds.
# Note: If this option is true, performance will be decreased.
# Default: false
# [sysTargetOfflineTimeoutSecs]
# Timeout until all storage targets and metadata nodes are considered offline
# when no target state updates can be fetched from the management server.
# If this value is 0, targets will never be set to offline due to an
# unreachable management node and will stay in state probably-offline.
# Note: This must be at least twice as large as the value of
# sysTargetOfflineTimoutSecs in the server config files.
# Values: time in seconds
# Default: 900
# [sysUpdateTargetStatesSecs]
# Interval in which the states of the storage targets are checked.
# Note: This must be significantly shorter than the sysTargetOfflineTimeoutSecs
# value set in the server (recommendation: maximum 1/3 of it).
# Values: time in seconds
# Default: 30
# [sysXAttrsEnabled]
# Enable extended attributes (also know as EAs/xattrs).
# Default: false
# [sysXAttrsCheckCapabilities]
# Check inodes for existing "security.capability" extended attribute and
# optionally cache to reduce metadata requests and increase write performance.
# The Linux kernel uses a security mechanism that automatically removes
# setuid/setgid bits and capabilities from files when they are changed. This is
# done to prevent users from executing binaries with elevated privileges that
# were changed after the privileges were originally set. That mechanism requires
# that, by default, the kernel has to check each file for existing capabilities
# on every write which leads to a large overhead in metadata RPCs to fetch the
# "security.capability" extended attribute. To optimize this, Linux allows file
# systems to set a flag (S_NOSEC) on the file, which short-circuits these
# checks.
# This configuration option configures the file system mount to allow the
# client to either always check, check once and cache that flag after a first
# lookup of the extended attribute returns an empty result, or set the flag on
# inode creation and never check. The flag will automatically be cleared when
# capabilities are modified on this client. It will, however, currently not
# be cleared when a different client modifies capabilities or sets setuid/setgid
# bits, which can lead to capabilities not being cleared, even after the file is
# written to. If this is a concern, this option should be set to "always".
# As long as BeeGFS is mounted using the "nosuid" mount option (which is
# recommended and the default setting), elevating privileges via setuid/setgid
# bits and capabilities is disabled and it is safe to set this option to "never".
# Possible values:
# always (always check for security xattr, never cache the result)
# cache (check for security xattr once, then cache)
# never (mark new inodes immediately, never check security xattr)
# Default: never
# [sysBypassFileAccessCheckOnMeta]
# Allow this client to bypass file access restrictions enforced by metadata
# servers. When enabled, the client is permitted to open files even if access
# restrictions are currently in place (e.g., file marked read-only,
# write-locked, or fully restricted). This setting is primarily intended for
# specialized clients in controlled environments, such as HSM (Hierarchical
# Storage Management) systems that need to restore file data, or backup/recovery
# tools that require access to otherwise locked files.
# Note: This setting only affects metadata-level access checks and has no effect
# on other security or permission mechanisms.
# Default: false
# [sysACLsEnabled]
# Allow the creation and enforcement of Access Control Lists (ACLs).
# Note: Only works if sysXAttrsEnabled=true.
# Note: Requires at least Linux kernel version 3.2.
# Note: Enabling this setting can affect metadata performance.
# Default: false
# [sysFileEventLogMask]
# Specifies which file system events shall be logged by the metadata servers. If
# unset, this client doesn't send log events at all. This can either be "none"
# or a comma separated list of event types to log. The following event types
# (and any comma-separated combination) are possible:
# "flush" (explicit data flushes on files), "close" (close writable file),
# "trunc" (file truncation), "setattr" (set attributes),
# "link-op" (create,mkdir,mknod,create symlink,create hardlink,rmdir,unlink, rename),
# "read" (deprecated, see notes) or "open-read" (file opened in read-only mode),
# "open-write" (file opened in write only mode),
# "open-readwrite" (file opened for both read and write),
# Note: If a client opens a file multiple times, "close" will only generate an
# event if the last fd is closed. If events for each fd shall be generated,
# "flush" needs to be used. However, "flush" might have a small performance
# impact. Also note that "read" is deprecated for file opening in read-only mode,
# but it is still allowed for backward compatibility. It is recommended to use
# "open-read" instead of "read" for clarity and consistency.
# Example: sysFileEventLogMask = close,trunc,setattr,link-op,open-read
# Default: none
# [sysRenameEbusyAsXdev]
# Changes the semantics of rename() to return an EXDEV error if a file could not
# be moved because it is in use (instead of the default EBUSY). Applications and
# tools like mv can handle EXDEV and fall back to copy/unlink for the files.
# This is mostly useful for NFS exports, where files may not be closed by the
# server until after the last open file handle has been closed by clients. This
# can cause spurious EBUSY errors in clients that close a file and rename it
# immediately afterwards.
# Default: false
#
# --- Section 4.5: [Tuning] ---
#
# [tuneFileCacheType]
# Sets the file read/write cache type.
# Values: "none" (disable client caching), "buffered" (use a pool of small
# static buffers for write-back and read-ahead), "native" (use the kernel
# pagecache), "paged" (experimental, deprecated).
# Note: The cache protocols are currently non-coherent (but caches are
# automatically flushed when a file is closed).
# Note: When client and servers are running on the same machine, "paged" mode
# contains the typical potential for memory allocation deadlocks (also known
# from local NFS server mounts). So do not use "paged" mode for clients that
# run on a metadata or storage server machine.
# Default: buffered
# [tunePreferredMetaFile], [tunePreferredStorageFile]
# Path to a text file that contains the numeric IDs of preferred storage targets
# and metadata servers. These will be preferred when the client creates new file
# system entries. This is useful e.g. to take advantage of data locality in the
# case of multiple data centers. If unspecified, all available targets and
# servers will be used equally.
# Usage: One targetID per line for storage servers, one nodeID per line for
# metadata servers.
# Note: TargetIDs and nodeIDs can be queried with the beegfs-ctl tool.
# Default: <none>
# [tuneRemoteFSync]
# Controls whether fsync() syscalls from a user application should only be
# executed on the client to transfer data from the client cache to server
# cache (=false); or also on the servers to flush the server's cached file
# data to the disks (=true).
# Default: true
# [tuneUseGlobalAppendLocks]
# Controls whether files opened in append mode should be protected by locks on
# the local machine only (=false) or globally on the servers (=true).
# Default: false
# [tuneUseGlobalFileLocks]
# Controls whether application advisory file locks via flock() and fcntl()
# should be checked for conflicts on the local machine only (=false) or
# globally on the servers (=true).
# Default: false
# [tuneCoherentBuffers]
# Enables or disables coherence between the buffers used by
# tuneFileCacheType=buffered and the page cache.
# If a file is concurrently accessed via mmap() regions and read()/write()
# system calls, the buffers used by tuneFileCacheType=buffered and the page
# cache used by mmap() may go out of sync - changes made in an mmap()ed region
# may not be visible to read() calls immediately, or changes made by write()
# calls may not be immediately reflected in mmap()ed regions.
# Many programs that use both methods of accessing a file assume that
# read()/write() and mmap() present the same view of the file, if this is not
# the case, those programs may not work correctly. Programs that have been
# observed to misbehave with non-coherent buffers are, for example, git and
# some in-memory database applications.
# When this option is enabled, files that are currently mmap()ed will behave as
# though they had been opened with tuneFileCacheType=none
# Default: true
#
# --- Section 5: [Expert options]
#
# [connUnmountRetries]
# Retry communications during unmount.
# If this option is set to `true` and a communication error occurs during
# unmont, for example due to a transient network fault, the unsuccessful
# communications will be retried normally. When set to `false` they will not be
# retried; this leads to a quicker unmount, but resources allocated to current
# client will not be freed for a few hours.
# Default: true
# [tuneFileCacheBufSize]
# When using buffered mode: maximum size of the (contiguous) data cache for an
# open file.
# When using native mode: threshold for direct operations. If a read() or
# write() passes a buffer size larger than tuneFileCacheBufSize the client will
# bypass the page cache and send/receive the data directly to/from the storage
# servers.
# Default: 524288 (512KiB)
# [tuneFileCacheBufNum]
# When using buffered mode: maximum number of file caches to preallocate
# for the mount. When a file is opened a cache is allocated, up to this number.
# If the maximum number of caches is reached no cache is allocated and all
# read/write operations for the file go to the storage servers directly.
# Default: 4*(number of CPUs)
# [tunePageCacheValidityMS]
# Maximum lifetime of cached data in the page cache.
# In buffered mode the page cache is used for mmap(), in native mode the page
# cache is used for all data. Data in the page cache that was not yet written
# to the storage server is written after at most this time, data that was read
# but not modified is discarded.
# Default: 2000000000 (approx. 23 days)
# [tuneDirSubentryCacheValidityMS]
# Validity time of directory attribute data, in milliseconds.
# Attributes of directories (eg stat() data) that have been loaded from the
# metadata servers are assumed to be valid for this amount of time without
# requiring a refresh. Once the time has passed the next access will cause a
# refresh.
# Default: 1000
# [tuneFileSubentryCacheValidityMS]
# Validity time of file attribute data, in milliseconds.
# Attributes of files (eg stat() data) that have been loaded from the metadata
# servers are assumed to be valid for this amount of time without requiring a
# refresh. Once the time has passed the next access will cause a refresh.
# Default: 0
# [tuneENOENTCacheValidityMS]
# Validity time of the non-existing file in milliseconds.
# A negative result of a stat call indicating "No such file or directory"
# (ENOENT) is assumed to be valid for this amount of time without requiring a
# new request to the meta server. Once the time has passed the next access will
# cause a refresh.
# Default: 0
# [tunePathBufSize]
# Size of buffers used for constructing paths.
# Whenever a full path must be constructed (eg for log messages) a preallocated
# buffer of this size will be used.
# Default: 4096
# [tunePathBufNum]
# Number of path buffers for path construction.
# Determines how many path buffers are preallocated during mount. If no buffers
# are available for an operation the operation must wait for another thread to
# free enough buffers.
# Default: 8
# [tuneMsgBufSize]
# Size of buffers used for messaging.
# Messages sent and received by the client (except logging messages) use
# buffers preallocated at mount time. Buffers are allocated with the size
# given here.
# Default: 65536
# [tuneMsgBufNum]
# Number of message buffers.
# During mount this many message buffers are preallocated. If an operation
# requires communication with a server but all buffers are used, the operation
# must wait until a buffer is released.
# Default: 4*(number of CPUs) + 1
# [tuneRefreshOnGetAttr]
# If set to `true`, file attributes will be loaded from the server on each call
# to fstat(). When set to `false` a call to fstat() may return stale
# information for files that are not currently open; this can happen mainly
# when NFS exports are used.
# Default: false
# [tuneInodeBlockBits]
# Sets the block size of file on the mountpoint to 2**tuneInodeBlockBits.
# Default: 19 (512KiB)
# [tuneEarlyCloseResponse]
# Request close responses from the metadata server before the file is fully closed.
# This may improve close() performance, but closed files may be accounted as
# open for a short time after close() has returned. Files accounted as open
# cannot be moved.
# Default: false
# [tuneUseBufferedAppend]
# Used only buffered mode. If set, writes to files opened with O_APPEND will be
# cached. Ignored unless tuneUseGlobalAppendLocks is also set.
# Default: true
# [tuneStatFsCacheSecs]
# Validity time of statfs() results, in seconds.
# Results of statfs(), once queried from the storage servers, will be cached
# for this amount of time.
# Default: 10
# [sysInodeIDStyle]
# Sets the hash function used to compute inode numbers from metadata IDs.
# The *32 options produce 32 bit inodes numbers, the *64 variants produce 64
# bit inode numbers.
# Possible values:
# hash32
# hash64
# md4hash32
# md4hash64
# Default: md4hash64

View File

@@ -0,0 +1 @@
/mnt/beegfs /etc/beegfs/beegfs-client.conf

View File

@@ -0,0 +1,26 @@
# BeeGFS client service configuration.
# Set to "NO" to disable start of the BeeGFS client via the init script.
START_SERVICE="YES"
# Set to "YES" if you want to start multiple clients with different
# configuration files on this machine.
#
# Create a subdirectory with the ending ".d" in "/etc/beegfs/" for every config
# file. The subdirectory name will be used to identify a particular client
# instance for init script start/stop.
#
# Note: The original config file in /etc/beegfs will not be used when multi-mode
# is enabled.
#
# Example: /etc/beegfs/scratch.d/beegfs-client.conf
# $ /etc/init.d/beegfs-client start scratch
MULTI_MODE="NO"
# Mount hook will be executed before any mount or unmount operation,
# and additionally after the operation succeeded.
# The first argument passed is either 'pre-mount', 'post-mount', 'pre-unmount',
# or 'post-unmount'.
# The second argument is the mount point. This can be useful to set up bind
# mounts on top of a BeeGFS, for example.
#MOUNT_HOOK=/etc/beegfs/beegfs-client-mount-hook.example

View File

@@ -0,0 +1,439 @@
#!/bin/bash
# NOTE: We expclicitly use "bash" here, as rc.status is not shell compliant
# and will complain with the message below, if "/bin/sh" is given
#
# /etc/rc.status: line 43: test: -eq: unary operator expected
# /etc/rc.status: line 44: test: -eq: unary operator expected
#
set -e
#
### BEGIN INIT INFO
# Provides: beegfs-client
# Required-Start:
# Required-Stop:
# Should-Start: $network $local_fs $syslog $time beegfs-helperd beegfs-mgmtd beegfs-meta beegfs-storage openib openibd rdma opensmd opensm $named slapd autofs ypbind nscd nslcd sshd
# Should-Stop: $network $local_fs $syslog $time beegfs-helperd beegfs-mgmtd beegfs-meta beegfs-storage openib openibd rdma opensmd opensm $named slapd autofs ypbind nscd nslcd sshd
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# chkconfig: 35 99 5
# Short-Description: BeeGFS Client
# Description: Start BeeGFS Client
### END INIT INFO
SERVICE_NAME="BeeGFS Client"
# Check for missing binaries (stale symlinks should not happen)
# Note: Special treatment of stop for LSB conformance
CLIENT_MOD=beegfs
SYSCONFIG_FILE=/etc/default/beegfs-client
BEEGFS_MOUNT_CONF="/etc/beegfs/beegfs-mounts.conf"
FORCE_AUTO_BUILD="/var/lib/beegfs/client/force-auto-build"
SUBSYS=/var/lock/subsys/beegfs-client
AUTOBUILD_CONF="/etc/beegfs/beegfs-client-autobuild.conf"
AUTOBUILD_CONF_SAVED="/var/lib/beegfs/client/beegfs-client-autobuild.conf.old"
CLIENT_SRC_PATH="/opt/beegfs/src/client"
SELINUX_OPT=""
DEFAULT_FS_TYPE="beegfs"
BUILD_FSTYPE_FILE="beegfs.fstype"
# we add "/usr/sbin" & co because "su" doesn't automatically add them
# on some systems.
EXTRA_PATH="/sbin:/usr/sbin/:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin"
PATH="$EXTRA_PATH:$PATH"
# source function library
. /etc/beegfs/lib/init-multi-mode.beegfs-client
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - user had insufficient privileges
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signaling is not supported) are
# considered a success.
handle_selinux()
{
selinuxenabled 2>/dev/null || return
# we do not support SELINUX right now and it only causes trouble, so
# we try to deactivate it
SELINUX_OPT="fscontext=system_u:object_r:tmp_t:s0"
echo
echo "WARNING: SELINUX IS ENABLED. BeeGFS might not work!"
echo " Before you consider to contact BeeGFS support, please try to"
echo " disable selinux (Usually in /etc/selinux/config)!"
echo
}
rmmod_beegfs()
{
for module in `lsmod |egrep "^beegfs" | sed -e 's/\s.*$//g'`; do rmmod $module; done
}
# Build beegfs. The autobuild will install modules to
# /lib/modules/`uname -r`/updates/fs/beegfs_autobuild
# if the build was successful and it will also run depmod.
build_beegfs()
{
echo "- BeeGFS module autobuild"
mkdir -p `dirname $SUBSYS`
# locked section (to avoid build problems when this script is called from
# multiple processes concurrently)
(
# (note: fd 16 is a more or less arbitrary number)
flock 16 || echo "WARNING: flock for build failed (continuing without lock...)" >&2
for dir in ${CLIENT_SRC_PATH}/*; do
set +e
echo $dir | grep opentk >/dev/null 2>&1
[ $? -ne 0 ] || continue # we ignore opentk
# ingore paths with missing Makfile
[ -f ${dir}/build/Makefile ] || continue
if [ -f ${dir}/build/${BUILD_FSTYPE_FILE} ]; then
fstype=`cat ${dir}/build/${BUILD_FSTYPE_FILE}`
TARGET_PARAM="TARGET=${fstype}"
else
TARGET_PARAM=""
fi
set -e
MAKE_ARGS="KMOD_INST_DIR=/lib/modules/$(uname -r)/updates/fs/beegfs_autobuild"
make -C ${dir}/build auto_rebuild_configured ${MAKE_ARGS} ${TARGET_PARAM} --silent
make -C ${dir}/build clean ${MAKE_ARGS} --silent # always clean up
done
set -e # ensure -e here (continue conditions above didn't restore it)
install -D $AUTOBUILD_CONF $AUTOBUILD_CONF_SAVED
) 16>$SUBSYS.init-autobuild
# we do not want to delete the $FORCE_AUTO_BUILD file here yet,
# as we do not test here, if the modules we just built will load at all
}
# Test if the user updated the build config. If so, we touch
# the $FORCE_AUTO_BUILD, which will trigger a rebuild
test_updated_autobuild_conf()
{
set +e
RC=0
# diskless installations might not have those files
if [ -e $AUTOBUILD_CONF -a -e $AUTOBUILD_CONF_SAVED ]; then
diff $AUTOBUILD_CONF $AUTOBUILD_CONF_SAVED >/dev/null 2>&1
RC=$?
fi
[ $RC -eq 0 ] || touch $FORCE_AUTO_BUILD
set -e
}
# Test and warn if user specified OFED_INCLUDE_PATH but appears to use in-tree
# drivers or other way around.
warn_on_ofed_mismatch()
{
set +e
modinfo ib_core > /dev/null 2>&1
if [ $? -ne 0 ]; then
# "modinfo ib_core" not working => cancel (because the user
# might have special mechanisms to load ib modules).
set -e
return
fi
# ibverbs enabled => check if include path set or not
grep '^buildArgs.*OFED_INCLUDE_PATH' $AUTOBUILD_CONF > /dev/null 2>&1
if [ $? -eq 0 ]; then
# ofed include path specified => warn if in-tree modules used
modinfo ib_core | grep 'filename:.*updates/' > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "WARNING: You probably should not specify OFED_INCLUDE_PATH in $AUTOBUILD_CONF"
fi
else
# no ofed include path specified => warn if out-of-tree modules
modinfo ib_core | grep 'filename:.*updates/' > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "WARNING: You probably need to specify" \
"OFED_INCLUDE_PATH in $AUTOBUILD_CONF"
fi
fi
set -e
}
source ${SYSCONFIG_FILE}
if [ "${MULTI_MODE}" = "YES" -o "${MULTI_MODE}" = "yes" ]; then
set +e
init_multi_mode $1 $2
exit $?
fi
RETVAL=0
case "$1" in
start)
if [ -f "${SYSCONFIG_FILE}" ]; then
if [ "${START_SERVICE}" = "NO" -o "${START_SERVICE}" = "no" ]; then
echo "${SERVICE_NAME} not set to be started"
exit 0
fi
fi
set +e
handle_selinux
set -e
echo "Starting ${SERVICE_NAME}: "
test_updated_autobuild_conf
set +e
echo "- Loading BeeGFS modules"
if [ -f "$FORCE_AUTO_BUILD" ]; then
# a new version was installed or the user updated the
# auto-build config, so we force a rebuild
rmmod_beegfs
rc=1
else
modprobe $CLIENT_MOD
rc=$?
fi
if [ $rc -ne 0 ]; then
set -e
build_beegfs
modprobe $CLIENT_MOD || (warn_on_ofed_mismatch && false)
rm -f $FORCE_AUTO_BUILD
fi
set -e
echo "- Mounting directories from $BEEGFS_MOUNT_CONF"
mkdir -p `dirname $SUBSYS`
touch $SUBSYS
OLDIFS="$IFS"
IFS=$'\n'
file=`tr -d '\r' < $BEEGFS_MOUNT_CONF` # read all lines at once and remove CR from dos files
for line in $file; do
if [ -z "$line" ]; then
continue # ignore empty line
elif echo "$line" | grep -qs "^\s*#" ; then
continue # ignore shell style comments
fi
mnt=`echo $line | awk '{print $1}'`
cfg=`echo $line | awk '{print $2}'`
fstype=`echo $line | awk '{print $3}'`
extra_mount_opts=`echo $line | awk '{print $4}'`
if [ -z "$mnt" -o -z "$cfg" ]; then
echo "Invalid config line: \"$line\""
continue
fi
if [ -z "$fstype" ]; then
fstype=${DEFAULT_FS_TYPE}
fi
set +e
mount -t ${fstype} | grep "${mnt} " >/dev/null 2>&1
if [ $? -eq 0 ]; then
# already mounted
set -e
continue
fi
set -e
# mkdir required for admon-based installation
if [ ! -e ${mnt} ]; then
mkdir -p ${mnt}
fi
exec_mount_hook pre-mount "${mnt}"
mount -t ${fstype} beegfs_nodev ${mnt} \
-ocfgFile=${cfg},_netdev,nosuid,${SELINUX_OPT},${extra_mount_opts}
exec_mount_hook post-mount "${mnt}"
done
RETVAL=$?
IFS="$OLDIFS"
;;
stop)
echo "Shutting down ${SERVICE_NAME}: "
RETVAL=$?
echo "- Unmounting directories from $BEEGFS_MOUNT_CONF"
OLDIFS="$IFS"
IFS=$'\n'
file=`cat $BEEGFS_MOUNT_CONF` # we have to read all lines at once
for line in $file; do
if [ -z "$line" ]; then
continue # ignore empty line
elif echo "$line" | grep -qs "^\s*#" ; then
continue # ignore shell style comments
fi
mnt=`echo $line | awk '{print $1}'`
cfg=`echo $line | awk '{print $2}'`
if [ -z "$mnt" -o -z "$cfg" ]; then
echo "Invalid config line: \"$line\""
continue
fi
exec_mount_hook pre-unmount "${mnt}"
set +e
res=`umount ${mnt} 2>&1`
if [ $? -ne 0 ]; then
# umount failed, ignore the failure if not mounted at all
echo $res | grep "not mounted" >/dev/null 2>&1
if [ $? -ne 0 ]; then
# Is mounted, abort.
echo "umount failed: $res"
exit 1
fi
fi
set -e
exec_mount_hook post-unmount "${mnt}"
done
IFS="$OLDIFS"
echo "- Unloading modules"
set +e
res=`rmmod_beegfs`
if [ $? -ne 0 ]; then
# rmmod failed, ignore it if the module is not loaded at all
echo $res | grep "does not exist in" >/dev/null 2>&1
if [ $? -ne 0 ]; then
# Is loaded, check if a BeeGFS is still mounted (all from the list are unmounted, so
# it must be a BeeGFS, which was manually mounted)
STILL_MOUNTED=$(mount -t beegfs | wc -l)
if [ ${STILL_MOUNTED} -eq 0 ]; then
# no more BeeGFS instances, no reason why rmmod should be failing, abort
echo "rmmod failed: $res"
exit 1
else
# BeeGFS instances mounted, so failure to rmmod is normal
echo "WARNING: Unloading BeeGFS modules failed. There are still mounted BeeGFS" \
"instances, which do not seem to be managed by the init-script mechanism" \
"(beegfs-mounts.conf)."
fi
fi
fi
RETVAL=$?
set -e
if [ $RETVAL -eq 0 ]; then rm -f $SUBSYS; fi
# Remember status and be verbose
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
RETVAL=$?
# Remember status and be quiet
;;
rebuild)
# Just rebuild modules. The user needs to call "restart" to make use
# of those new modules.
build_beegfs
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
rm -f $FORCE_AUTO_BUILD
fi
;;
try-restart|condrestart)
## Do a restart only if the service was active before.
## Note: try-restart is now part of LSB (as of 1.9).
## RH has a similar command named condrestart.
set +e
$0 status
if test $? = 0
then
set -e
$0 restart
RETVAL=$?
else
set -e
RETVAL=7
fi
;;
status)
# Return value is slightly different for the status command:
# 0 - service up and running
# 1 - service dead, but /var/run/ pid file exists
# 2 - service dead, but /var/lock/ lock file exists
# 3 - service not running (unused)
# 4 - service status unknown :-(
# 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
set +e
echo -n "Checking for service $SERVICE_NAME: "
lsmod | grep $CLIENT_MOD >/dev/null 2>&1
if [ $? -eq 0 ]
then
echo "is running..."
mount -t beegfs | grep beegfs >/dev/null 2>&1
if [ $? -eq 0 ]; then
mount -t beegfs | cut "-d " -f1-3
echo
RETVAL=0
else
echo ">> No active beegfs mounts detected."
echo
RETVAL=4
fi
else
echo "is stopped."
echo
RETVAL=3
fi
set -e
;;
*)
echo "Usage: $0 {start|stop|status|restart|rebuild|condrestart|try-restart}"
exit 3
;;
esac
exit $RETVAL

View File

@@ -0,0 +1,128 @@
#!/bin/bash
# License: BeeGFS EULA
# constant definitions
# (for configurables see below)
DEFAULT_CFG_PATH="/etc/beegfs/beegfs-client.conf"
MGMTD_CFG_KEY="sysMgmtdHost"
QUOTA_ENABLED_CFG_KEY="quotaEnabled"
print_usage()
{
echo
echo "DESCRIPTION: Initialize or update the beegfs-client config file."
echo
echo "USAGE: `basename $0` [options]"
echo
echo " Recommended Options:"
echo
echo " -m <host> - Hostname (or IP address) of management server."
echo " (Will be stored in client config file.)"
echo
echo " Other Options:"
echo
echo " -C - Do not update client config file."
echo
echo " -c <path> - Path to client config file."
echo " (Default: ${DEFAULT_CFG_PATH})"
echo
echo " -f - Force actions, ignore warnings."
echo
echo " -h - Print this help."
echo
echo " -q - Enable quota support in config file."
echo " (Default: Quota support disabled)"
echo
echo "EXAMPLES:"
echo " * Example 1) Set \"storage01\" as management daemon host in config file:"
echo " $ `basename $0` -m storage01"
echo
}
# update config file (if enabled)
update_config_file()
{
# check if config file is defined
if [ -z "${CFG_PATH}" ]; then
return 0
fi
echo "Updating config file: ${CFG_PATH}"
if [ ! -f "${CFG_PATH}" ]; then
echo " * ERROR: Config file not found: ${CFG_PATH}"
exit 1
fi
if [ -n "${MGMTD_HOST}" ]; then
echo " * Setting management host: ${MGMTD_HOST}"
sed -i "s/\(^${MGMTD_CFG_KEY}.*=\).*/\1 ${MGMTD_HOST}/" ${CFG_PATH}
fi
if [ -n "${QUOTA_ENABLED}" ]; then
echo " * Setting quota enabled: ${QUOTA_ENABLED}"
sed -i "s/\(^${QUOTA_ENABLED_CFG_KEY}.*=\).*/\1 ${QUOTA_ENABLED}/" ${CFG_PATH}
fi
}
################## end of function definitions ##############
# configurable values and their defaults
# (for constants see above)
CFG_PATH="$DEFAULT_CFG_PATH" # empty path means "don't update cfg file"
FORCE_ACTIONS=""
MGMTD_HOST=""
QUOTA_ENABLED=""
# parse command line arguments
# (see print_usage() for description of parameters)
while getopts "Cc:fhm:q" opt; do
case $opt in
C)
CFG_PATH=""
;;
c)
CFG_PATH="$OPTARG"
;;
f)
FORCE_ACTIONS="1"
;;
h)
print_usage
exit 0
;;
m)
MGMTD_HOST="$OPTARG"
;;
q)
QUOTA_ENABLED="true"
;;
*)
echo "ERROR: Invalid argument" >&2
print_usage
exit 1
;;
esac
done
set -e
# don't do anything if no arguments are provided
if [ $# -eq 0 ]; then
print_usage
exit 1
fi
# update config file
update_config_file
echo "All done."

94
client_module/build/dist/sbin/mount.beegfs vendored Executable file
View File

@@ -0,0 +1,94 @@
#!/usr/bin/env bash
# BeeGFS Client Mount Utility / External Mount Helper
# If placed in /sbin, this script is called automatically by `mount` whenever a filesystem with type
# `beegfs` is being mounted. It's main purpose is to do name resolution of the management hostname
# as the kernel module can't do that by itself. The hostname is taken from either the mount option
# string itself ('sysMgmtdHost=') or from the config file given by the mount options ('cfgFile=').
function usage() {
echo "Usage: $(basename "$0") <fs_name> <directory> [-sfnv] [-o options]"
exit 1
}
SPEC="$1"
shift
DIR="$1"
shift
[[ -n "$SPEC" && -n "$DIR" ]] || usage
FLAGS=
OPTIONS=
# Read in all possible flags (see `man mount 8`)
while getopts 'hsfnvo:t:' FLAG; do
case "$FLAG" in
s|f|n|v)
FLAGS+=("-$FLAG")
;;
o)
OPTIONS="$OPTARG"
;;
h|*)
usage
;;
esac
done
shift "$((OPTIND -1))"
# If there is a config file available and sysMgmtdHost is set, load the management hostname from the
# config file
CFG_FILE=$(echo "$OPTIONS" | grep -oP 'cfgFile=[^,]+' | cut -d= -f2)
if [[ -n "$CFG_FILE" ]]; then
[[ -f "$CFG_FILE" ]] || {
echo "Can not open config file '$CFG_FILE'"
exit 1
}
H=$(grep -oP '^\s*sysMgmtdHost\s*=\s*\S+\s*$' "$CFG_FILE" | tr -d ' ' | cut -d= -f2)
if [[ $H == *$'\n'* ]]; then
echo "Multiple definitions of 'sysMgmtdHost' found in '$CFG_FILE'."
exit 1
elif [[ -n "$H" ]]; then
HOST_NAME="$H"
fi
fi
# If it has explicitly been set as a mount option, use that (overrides config file).
HOST_NAME_OPTION=$(echo "$OPTIONS" | grep -oP 'sysMgmtdHost=[^,]+' | cut -d= -f2)
if [[ -n "$HOST_NAME_OPTION" ]]; then
HOST_NAME="$HOST_NAME_OPTION"
fi
# A management host must be provided
[[ -n "$HOST_NAME" ]] || {
echo "Can not determine management host - neither through a mount option ('sysMgmtdHost') nor through \
a client config file ('cfgFile')."
exit 1
}
# Resolve management address
MGMTD_ADDR=$(getent ahostsv4 "$HOST_NAME" | cut -f1 -d' ' | head -n1)
# If resolve fails, error out
[[ -n "$MGMTD_ADDR" ]] || {
echo "Can not resolve management host address using hostname '$HOST_NAME'"
exit 1
}
# If the host argument was given, replace it with the resolved address, otherwise append
if [[ -n "$HOST_NAME_OPTION" ]]; then
# shellcheck disable=SC2001
OPTIONS=$(echo "$OPTIONS" | sed "s/sysMgmtdHost=[^,]\\+/sysMgmtdHost=$MGMTD_ADDR/g")
else
OPTIONS="$OPTIONS,sysMgmtdHost=$MGMTD_ADDR"
fi
# Take the part behind the "." as fstype (typically "beegfs"). This allows multiple mount utilities
# and client modules being installed at the same time.
FS_TYPE=$(basename "$0" | sed 's/^.*\.//')
set -ex
mount --internal -t "$FS_TYPE" --source "$SPEC" --target "$DIR" ${FLAGS[*]} -o"$OPTIONS"

View File

@@ -0,0 +1,21 @@
[Unit]
Description=Start BeeGFS Client
Requires=network-online.target
# We disable the wants service, because it spams the log files
#Wants=local-fs.target time-sync.target beegfs-mgmtd.service \
#beegfs-meta.service beegfs-storage.service openib.service openibd.service rdma.service \
#opensmd.service opensm.service nss-lookup.target nss-user-lookup.target slapd.service \
#autofs.service ypbind.service nscd.service nslcd.service sshd.service
After=network-online.target local-fs.target time-sync.target \
beegfs-mgmtd.service beegfs-meta.service beegfs-storage.service openib.service openibd.service \
rdma.service opensmd.service opensm.service nss-lookup.target nss-user-lookup.target \
slapd.service autofs.service ypbind.service nscd.service nslcd.service sshd.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/opt/beegfs/sbin/beegfs-client start
ExecStop=/opt/beegfs/sbin/beegfs-client stop
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,21 @@
[Unit]
Description=Start BeeGFS Client
Requires=network-online.target
# We disable the wants service, because it spams the log files
#Wants=local-fs.target time-sync.target beegfs-mgmtd.service \
#beegfs-meta.service beegfs-storage.service openib.service openibd.service rdma.service \
#opensmd.service opensm.service nss-lookup.target nss-user-lookup.target slapd.service \
#autofs.service ypbind.service nscd.service nslcd.service sshd.service
After=network-online.target local-fs.target time-sync.target \
beegfs-mgmtd.service beegfs-meta.service beegfs-storage.service openib.service openibd.service \
rdma.service opensmd.service opensm.service nss-lookup.target nss-user-lookup.target \
slapd.service autofs.service ypbind.service nscd.service nslcd.service sshd.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/opt/beegfs/sbin/beegfs-client start %I
ExecStop=/opt/beegfs/sbin/beegfs-client stop %I
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,478 @@
#!/bin/bash
set -e
# NOTE, we're using the argument array as part of this string here. As is
# often the case in shell scripts (especially when used with Makefiles) the
# quoting here is not correct in the sense that it can be broken for example
# with arguments that contain spaces. But it is expected to work with our input
# data.
CFLAGS="-D__KERNEL__ $LINUXINCLUDE $* -DKBUILD_BASENAME=\"beegfs\" -DKBUILD_MODNAME=\"beegfs\""
_generate_includes() {
for i in "$@"; do
echo "#include <$i>"
done
}
_marker_if_compiles() {
local marker=$1
shift
if $CC $CFLAGS -x c -o /dev/null -c - 2>/dev/null
then
echo -D$marker
fi
}
_check_type_input() {
local tp=$1
shift 1
_generate_includes "$@"
cat <<EOF
void want_tp(void) {
$tp name;
}
EOF
}
check_type() {
local tp=$1
local marker=$2
shift 2
_check_type_input "$tp" "$@" | _marker_if_compiles "$marker"
}
_check_struct_field_input() {
local field=$1
shift 1
_generate_includes "$@"
cat <<EOF
void want_symbol(void) {
struct ${field%%::*} s;
(void) (s.${field##*::});
}
EOF
}
check_struct_field() {
local field=$1
local marker=$2
shift 2
_check_struct_field_input "$field" "$@" | _marker_if_compiles "$marker"
}
_check_struct_field_type_input() {
local field=$1
local ftype=$2
shift 2
_generate_includes "$@"
cat <<EOF
void want_symbol(void) {
struct ${field%%::*} s;
char predicate[
2 * __builtin_types_compatible_p(__typeof(s.${field##*::}), $ftype) - 1
];
}
EOF
}
check_struct_field_type() {
local field=$1
local ftype=$2
local marker=$3
shift 3
_check_struct_field_type_input "$field" "$ftype" "$@" | _marker_if_compiles "$marker"
}
_check_expr_type_input() {
local name=$1
local signature=$2
shift 2
_generate_includes "$@"
cat <<EOF
void want_fn(void) {
char predicate[
2 * __builtin_types_compatible_p(__typeof($name), $signature) - 1
];
}
EOF
}
check_expr_type() {
local name=$1
local signature=$2
local marker=$3
shift 3
_check_expr_type_input "$name" "$signature" "$@" | _marker_if_compiles "$marker"
}
check_function() {
check_expr_type "$@"
}
_check_symbol_input() {
local name=$1
shift
_generate_includes "$@"
cat <<EOF
__typeof__($name) predicate = $name;
EOF
}
check_header() {
local header=$1
local marker=$2
shift 2
_generate_includes "$header" | _marker_if_compiles "$marker"
}
check_symbol() {
local name=$1
local marker=$2
shift 2
_check_symbol_input "$name" "$@" | _marker_if_compiles "$marker"
}
check_struct_field \
inode::i_ctime \
KERNEL_HAS_INODE_CTIME \
linux/fs.h
check_struct_field \
inode::i_mtime \
KERNEL_HAS_INODE_MTIME \
linux/fs.h
check_struct_field \
dentry::d_subdirs \
KERNEL_HAS_DENTRY_SUBDIRS \
linux/dcache.h
check_function \
generic_readlink "int (struct dentry *, char __user *, int)" \
KERNEL_HAS_GENERIC_READLINK \
linux/fs.h
check_header \
linux/sched/signal.h \
KERNEL_HAS_SCHED_SIG_H
check_header \
linux/stdarg.h \
KERNEL_HAS_LINUX_STDARG_H
check_header \
linux/filelock.h \
KERNEL_HAS_LINUX_FILELOCK_H
# cryptohash does not include linux/types.h, so the type comparison fails
check_function \
half_md4_transform "__u32 (__u32[4], __u32 const in[8])" \
KERNEL_HAS_HALF_MD4_TRANSFORM \
linux/types.h linux/cryptohash.h
check_function \
vfs_getattr "int (const struct path *, struct kstat *, u32, unsigned int)" \
KERNEL_HAS_STATX \
linux/fs.h
check_function \
kref_read "unsigned int (const struct kref*)" \
KERNEL_HAS_KREF_READ \
linux/kref.h
check_function \
file_dentry "struct dentry* (const struct file *file)" \
KERNEL_HAS_FILE_DENTRY \
linux/fs.h
check_function \
super_setup_bdi_name "int (struct super_block *sb, char *fmt, ...)" \
KERNEL_HAS_SUPER_SETUP_BDI_NAME \
linux/fs.h
check_function \
have_submounts "int (struct dentry *parent)" \
KERNEL_HAS_HAVE_SUBMOUNTS \
linux/dcache.h
check_function \
kernel_read "ssize_t (struct file *, void *, size_t, loff_t *)" \
KERNEL_HAS_KERNEL_READ \
linux/fs.h
check_function \
skwq_has_sleeper "bool (struct socket_wq*)" \
KERNEL_HAS_SKWQ_HAS_SLEEPER \
net/sock.h
check_struct_field_type \
sock::sk_data_ready "void (*)(struct sock*, int)" \
KERNEL_HAS_SK_DATA_READY_2 \
net/sock.h
check_struct_field \
sock::sk_sleep \
KERNEL_HAS_SK_SLEEP \
net/sock.h
check_function \
current_time "struct timespec64 (struct inode *)" \
KERNEL_HAS_CURRENT_TIME_SPEC64 \
linux/fs.h
check_function \
sk_has_sleeper "int (struct sock*)" \
KERNEL_HAS_SK_HAS_SLEEPER \
net/sock.h
check_function \
__wake_up_sync_key "void (struct wait_queue_head* , unsigned int, void*)" \
KERNEL_WAKE_UP_SYNC_KEY_HAS_3_ARGUMENTS \
linux/wait.h
check_expr_type \
'get_fs()' "mm_segment_t" \
KERNEL_HAS_GET_FS \
linux/uaccess.h
check_function \
iov_iter_kvec 'void (struct iov_iter *i, int direction, const struct kvec *iov, unsigned long nr_segs, size_t count)' \
KERNEL_HAS_IOV_ITER_KVEC \
linux/uio.h
# The iov_iter_kvec() function has the same API but differing behaviour
# across Linux versions:
#
# Linux < 4.20 requires ITER_KVEC to be set in "direction"
# Linux >= 4.20 issues a warning (including stacktrace) if it _is_ set.
#
# We can't detect this from the headers, only by looking at the source.
# BUT: The source is not guaranteed to be available when building.
#
# We have tried to check for this "feature" by looking at the Linux version
# as reported by the LINUX_VERSION_CODE macro.
#
# BUT: Some non-vanilla < 4.20 kernels have backported the >= 4.20
# functionality to < 4.20 kernels. So relying on the version code doesn't
# work either.
#
# What we're doing here now is our current best attempt to detect how the API
# must be used. We're checking something that is not really related to the
# actual function, but which seems to give the right results.
check_function \
iov_iter_is_kvec 'bool(const struct iov_iter *)' \
KERNEL_HAS_IOV_ITER_KVEC_NO_TYPE_FLAG_IN_DIRECTION \
linux/uio.h
# print_stack_trace() found on older Linux kernels < 5.2
check_function \
print_stack_trace 'void (struct stack_trace *trace, int spaces)' \
KERNEL_HAS_PRINT_STACK_TRACE \
linux/stacktrace.h
# Starting from kernel 5.2, print_stack_trace() is demoted to tools/ directory
# so not available to us.
# Starting from kernel 5.16 print_stack_trace() is removed completely, but
# stack_trace_print() can be used instead.
# Notably, the identifier stack_trace_print() existed even in older Linux
# versions, but with a different signature and different functionality.
check_function \
stack_trace_print 'void (unsigned long *trace, unsigned int nr_entries, int spaces)' \
KERNEL_HAS_STACK_TRACE_PRINT \
linux/stacktrace.h \
check_type 'struct file_lock_core' KERNEL_HAS_FILE_LOCK_CORE linux/filelock.h
check_type 'struct proc_ops' KERNEL_HAS_PROC_OPS linux/proc_fs.h
check_type sockptr_t KERNEL_HAS_SOCKPTR_T linux/sockptr.h
check_function \
sock_setsockopt 'int (struct socket *, int, int, sockptr_t, unsigned int)' \
KERNEL_HAS_SOCK_SETSOCKOPT_SOCKPTR_T_PARAM \
net/sock.h
check_type time64_t KERNEL_HAS_TIME64 linux/ktime.h
check_function ktime_get_ts64 'void (struct timespec64 *)' KERNEL_HAS_KTIME_GET_TS64 linux/ktime.h
check_function ktime_get_real_ts64 'void (struct timespec64 *)' KERNEL_HAS_KTIME_GET_REAL_TS64 linux/ktime.h
check_function ktime_get_coarse_real_ts64 'void (struct timespec64 *)' KERNEL_HAS_KTIME_GET_COARSE_REAL_TS64 linux/ktime.h
# latest kernel from 6.3 changes moved to timekeeping.h
check_function \
ktime_get_ts64 "void (struct timespec64 *ts)" \
KERNEL_HAS_KTIME_GET_TS64 \
linux/timekeeping.h
check_function \
ktime_get_real_ts64 "void (struct timespec64 *tv)" \
KERNEL_HAS_KTIME_GET_REAL_TS64 \
linux/timekeeping.h
check_function \
ktime_get_coarse_real_ts64 "void (struct timespec64 *ts)" \
KERNEL_HAS_KTIME_GET_COARSE_REAL_TS64 \
linux/timekeeping.h
check_function \
generic_file_splice_read "ssize_t (struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int)" \
KERNEL_HAS_GENERIC_FILE_SPLICE_READ \
linux/fs.h
check_function \
generic_permission "int (struct inode *, int)" \
KERNEL_HAS_GENERIC_PERMISSION_2 \
linux/fs.h
check_function \
generic_permission "int (struct inode *, int, int (*check_acl)(struct inode *, int)" \
KERNEL_HAS_GENERIC_PERMISSION_4 \
linux/fs.h
check_function \
setattr_prepare "int (struct mnt_idmap *, struct dentry *, struct iattr *)" \
KERNEL_HAS_SETATTR_PREPARE \
linux/fs.h
check_function \
setattr_prepare "int (struct dentry *dentry, struct iattr *attr)" \
KERNEL_HAS_SETATTR_PREPARE \
linux/fs.h
check_function \
setattr_prepare "int (struct user_namespace *, struct dentry *, struct iattr *)" \
KERNEL_HAS_SETATTR_PREPARE \
linux/fs.h
check_struct_field \
inode_operations::get_acl \
KERNEL_HAS_GET_ACL \
linux/fs.h
check_struct_field_type \
inode_operations::get_acl "struct posix_acl* (*)(struct mnt_idmap *, struct dentry *, int)" \
KERNEL_HAS_POSIX_GET_ACL_IDMAP \
linux/fs.h
check_struct_field_type \
inode_operations::get_acl "struct posix_acl* (*)(struct user_namespace *, struct dentry *, int)" \
KERNEL_HAS_POSIX_GET_ACL_NS \
linux/fs.h
check_symbol \
"extern const struct xattr_handler posix_acl_default_xattr_handler;" \
KERNEL_HAS_POSIX_ACL_DEFAULT_XATTR_HANDLER \
linux/posix_acl_xattr.h
check_struct_field_type \
inode_operations::get_acl "struct posix_acl* (*)(struct inode *, int, bool)" \
KERNEL_POSIX_GET_ACL_HAS_RCU \
linux/fs.h
check_struct_field_type \
inode_operations::get_inode_acl "struct posix_acl* (*)(struct inode *, int, bool)" \
KERNEL_HAS_GET_INODE_ACL \
linux/fs.h
check_struct_field \
inode_operations::set_acl \
KERNEL_HAS_SET_ACL \
linux/fs.h
check_struct_field_type \
inode_operations::set_acl "int (*)(struct user_namespace *, struct inode *, struct posix_acl *, int)" \
KERNEL_HAS_SET_ACL_NS_INODE \
linux/fs.h
check_struct_field_type \
inode_operations::set_acl "int (*)(struct mnt_idmap *, struct dentry *, struct posix_acl *, int)" \
KERNEL_HAS_SET_ACL_DENTRY \
linux/fs.h
check_struct_field_type \
inode_operations::set_acl "int (*)(struct user_namespace *, struct dentry *, struct posix_acl *, int)" \
KERNEL_HAS_SET_ACL_DENTRY \
linux/fs.h
check_function \
vfs_create "int (struct user_namespace *, struct inode *, struct dentry *, umode_t, bool)" \
KERNEL_HAS_USER_NS_MOUNTS \
linux/fs.h
check_function \
vfs_create "int (struct mnt_idmap *, struct inode *, struct dentry *, umode_t, bool)" \
KERNEL_HAS_IDMAPPED_MOUNTS \
linux/fs.h
check_struct_field_type \
file_operations::iterate "int (*)(struct file *, struct dir_context *)" \
KERNEL_HAS_FOPS_ITERATE \
linux/fs.h
check_struct_field_type \
xattr_handler::set "int (*)(const struct xattr_handler *, struct dentry *, struct inode *, const char *, const void *, size_t, int)" \
KERNEL_HAS_XATTR_HANDLERS_INODE_ARG \
linux/xattr.h
check_struct_field_type \
xattr_handler::set "int (*)(const struct xattr_handler *, struct user_namespace *, struct dentry *, struct inode *, const char *, const void *, size_t, int)" \
KERNEL_HAS_XATTR_HANDLERS_INODE_ARG \
linux/xattr.h
check_struct_field_type \
xattr_handler::set "int (*)(const struct xattr_handler *, struct mnt_idmap *, struct dentry *, struct inode *, const char *, const void *, size_t, int)" \
KERNEL_HAS_XATTR_HANDLERS_INODE_ARG \
linux/xattr.h
check_struct_field \
thread_info::cpu \
KERNEL_HAS_CPU_IN_THREAD_INFO \
linux/thread_info.h
check_function \
generic_fillattr "void (struct mnt_idmap *, u32, struct inode *, struct kstat *)" \
KERNEL_HAS_GENERIC_FILLATTR_REQUEST_MASK \
linux/fs.h
# Kernel 6.5 introduced getters and setters for struct inode's ctime field
check_function \
inode_get_ctime "struct timespec64 (const struct inode *inode)" \
KERNEL_HAS_INODE_GET_SET_CTIME \
linux/fs.h
# Kernel 6.6 introduced more getters and setters, also for atime and mtime
check_function \
inode_get_mtime "struct timespec64 (const struct inode *inode)" \
KERNEL_HAS_INODE_GET_SET_CTIME_MTIME_ATIME \
linux/fs.h
# From Linux kernel 6.12 onward, unaligned.h has been moved from <asm/> to <linux/> include path
check_header \
linux/unaligned.h \
KERNEL_HAS_LINUX_UNALIGNED_H
# we have to communicate with the calling makefile somehow. since we can't really use the return
# code of this script, we'll echo a special string at the end of our output for the caller to
# detect and remove again.
# this string has to be something that will, on its own, never be a valid compiler option. so let's
# choose something really, really unlikely like
echo "--~~success~~--"