Skip to content

Commit

Permalink
update to release 7.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfalk committed Sep 30, 2024
1 parent 8b06b38 commit 7a9d067
Show file tree
Hide file tree
Showing 43 changed files with 910 additions and 284 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBEEGFS_VERSION=\\\"${BEEGFS_VERSION}\\\"")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBEEGFS_VERSION=\\\"${BEEGFS_VERSION}\\\"")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wunused-variable -Woverloaded-virtual -Wno-unused-parameter -Wuninitialized -Wno-missing-field-initializers")

set(BEEGFS_DEBUG OFF CACHE BOOL "Build with debug information.")
if(BEEGFS_DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBEEGFS_DEBUG=1 -Wall -Wextra -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBEEGFS_DEBUG=1 -Werror")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBEEGFS_DEBUG=1")
endif()

Expand Down Expand Up @@ -74,8 +76,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

include_directories(common/source)
include_directories(thirdparty/source/boost)
include_directories(thirdparty/source/nu/include)
include_directories(SYSTEM thirdparty/source/boost)
include_directories(SYSTEM thirdparty/source/nu/include)
include_directories(thirdparty/source/gtest/googletest/include)

if(NOT BEEGFS_SKIP_TESTS)
Expand Down
19 changes: 18 additions & 1 deletion client_module/build/KernelFeatureDetection.mk
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ $(call define_if_matches, KERNEL_HAS_STRNICMP, "strnicmp", string.h)
$(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)

Expand Down Expand Up @@ -168,6 +171,9 @@ KERNEL_FEATURE_DETECTION += $(shell \
&& 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
Expand Down Expand Up @@ -268,7 +274,7 @@ $(call define_if_matches, KERNEL_HAS_ALLOC_WORKQUEUE, "alloc_workqueue", workque
$(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[[:space:]]\+i_atime;", 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)
Expand All @@ -292,11 +298,22 @@ $(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)

Expand Down
113 changes: 104 additions & 9 deletions client_module/build/feature-detect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ check_symbol() {
_check_symbol_input "$name" "$@" | _marker_if_compiles "$marker"
}

check_struct_field \
inode::i_atime \
KERNEL_HAS_INODE_ATIME \
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 \
Expand All @@ -162,6 +172,10 @@ 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])" \
Expand Down Expand Up @@ -213,6 +227,11 @@ check_struct_field \
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 \
Expand Down Expand Up @@ -283,11 +302,30 @@ check_function \
KERNEL_HAS_SOCK_SETSOCKOPT_SOCKPTR_T_PARAM \
net/sock.h

check_type time64_t KERNEL_HAS_TIME64 linux/ktime.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 \
Expand All @@ -298,6 +336,11 @@ check_function \
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 \
Expand All @@ -308,16 +351,26 @@ check_function \
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 inode *, int)" \
KERNEL_HAS_POSIX_GET_ACL \
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 inode *, int, bool)" \
KERNEL_HAS_POSIX_GET_ACL \
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 \
Expand All @@ -328,26 +381,41 @@ check_struct_field_type \
KERNEL_HAS_GET_INODE_ACL \
linux/fs.h

check_struct_field_type \
inode_operations::set_acl "int (*)(struct inode *, struct posix_acl *, int)" \
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 \
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_DENTRY_ACL \
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 \
Expand All @@ -358,11 +426,38 @@ check_struct_field_type \
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


# 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.
Expand Down
25 changes: 11 additions & 14 deletions client_module/source/app/App.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,29 +510,26 @@ bool __App_initInodeOperations(App* this)

if (Config_getSysACLsEnabled(cfg) )
{
#if defined(KERNEL_HAS_SET_ACL) || defined(KERNEL_HAS_SET_DENTRY_ACL)
#if defined(KERNEL_HAS_SET_ACL) || defined(KERNEL_HAS_SET_ACL_DENTRY)
this->fileInodeOps->set_acl = FhgfsOps_set_acl;
this->dirInodeOps->set_acl = FhgfsOps_set_acl;
#if defined(KERNEL_HAS_POSIX_GET_ACL)
/* Note: symlinks don't have ACLs
* The get_acl() operation was introduced as get_inode_acl() in the struct inode_operations in Linux 6.2
*/
#if defined(KERNEL_HAS_GET_ACL)
this->fileInodeOps->get_acl = FhgfsOps_get_acl;
this->dirInodeOps->get_acl = FhgfsOps_get_acl;
// Note: symlinks don't have ACLs
#elif defined(KERNEL_HAS_GET_INODE_ACL)
this->fileInodeOps->get_inode_acl = FhgfsOps_get_acl;
this->dirInodeOps->get_inode_acl = FhgfsOps_get_acl;
#else
Logger_logErr(this->logger, "Init inode operations",
"ACLs activated in config, but the signature inode->i_op->get_acl()"
"or inode->i_op->get_inode_acl() are not supported on this"
"kernel version.");
return false;
#endif // KERNEL_HAS_POSIX_GET_ACL
#endif
#if defined(KERNEL_HAS_GET_INODE_ACL)
this->fileInodeOps->get_inode_acl = FhgfsOps_get_inode_acl;
this->dirInodeOps->get_inode_acl = FhgfsOps_get_inode_acl;
#endif
#else
Logger_logErr(this->logger, "Init inode operations",
"ACLs activated in config, but the signature inode->i_op->set_acl()"
"not supported on this kernel version.");
return false;
#endif // KERNEL_HAS_SET_ACL or KERNEL_HAS_SET_DENTRY_ACL
#endif // KERNEL_HAS_SET_ACL or KERNEL_HAS_SET_ACL_DENTRY
}
}

Expand Down
5 changes: 4 additions & 1 deletion client_module/source/app/config/Config.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ void _Config_loadDefaults(Config* this)
_Config_configMapRedefine(this, "sysRenameEbusyAsXdev", "false");

_Config_configMapRedefine(this, "remapConnectionFailureStatus", "0");

_Config_configMapRedefine(this, "sysNoEnterpriseFeatureMsg", "false");
}

bool _Config_applyConfigMap(Config* this, bool enableException)
Expand Down Expand Up @@ -765,8 +767,9 @@ bool _Config_applyConfigMap(Config* this, bool enableException)
}
else if(!strcmp(keyStr, "remapConnectionFailureStatus"))
this->remapConnectionFailureStatus = StringTk_strToUInt(valueStr);
else if(!strcmp(keyStr, "sysNoEnterpriseFeatureMsg"))
this->sysNoEnterpriseFeatureMsg = StringTk_strToBool(valueStr);
else
IGNORE_CONFIG_VALUE("sysNoEnterpriseFeatureMsg") // Only relevant for ctl
{ // unknown element occurred
bad_config_elem:
unknownElement = true;
Expand Down
9 changes: 9 additions & 0 deletions client_module/source/app/config/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ static inline int Config_getConnRDMATimeoutCompletion(Config* this);
static inline int Config_getConnRDMATimeoutFlowSend(Config* this);
static inline int Config_getConnRDMATimeoutFlowRecv(Config* this);
static inline int Config_getConnRDMATimeoutPoll(Config* this);
static inline bool Config_getSysNoEnterpriseFeatureMsg(Config* this);


enum FileCacheType
Expand Down Expand Up @@ -328,6 +329,9 @@ struct Config

// testing
unsigned remapConnectionFailureStatus;

// Only used by CTL but must be included in the procfs config for the --mount option to work:
bool sysNoEnterpriseFeatureMsg;
};

char* Config_getCfgFile(Config* this)
Expand Down Expand Up @@ -774,4 +778,9 @@ int Config_getConnRDMATimeoutPoll(Config* this)
return this->connRDMATimeoutPoll;
}

bool Config_getSysNoEnterpriseFeatureMsg(Config* this)
{
return this->sysNoEnterpriseFeatureMsg;
}

#endif /*CONFIG_H_*/
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ static void PeerInfoMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
NumNodeID_serialize(ctx, &thisCast->id);
}

bool PeerInfoMsg_deserializePayload(NetMessage* this, DeserializeCtx* ctx)
static bool PeerInfoMsg_deserializePayload(NetMessage* this, DeserializeCtx* ctx)
{
PeerInfoMsg* thisCast = (PeerInfoMsg*)this;

Expand Down
Loading

0 comments on commit 7a9d067

Please sign in to comment.