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,35 @@
#include "FLockAppendMsg.h"
const struct NetMessageOps FLockAppendMsg_Ops = {
.serializePayload = FLockAppendMsg_serializePayload,
.deserializePayload = _NetMessage_deserializeDummy,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
};
void FLockAppendMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
{
FLockAppendMsg* thisCast = (FLockAppendMsg*)this;
// clientNumID
NumNodeID_serialize(ctx, &thisCast->clientNumID);
// clientFD
Serialization_serializeInt64(ctx, thisCast->clientFD);
// ownerPID
Serialization_serializeInt(ctx, thisCast->ownerPID);
// lockTypeFlags
Serialization_serializeInt(ctx, thisCast->lockTypeFlags);
// entryInfo
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
// fileHandleID
Serialization_serializeStrAlign4(ctx, thisCast->fileHandleIDLen, thisCast->fileHandleID);
// lockAckID
Serialization_serializeStrAlign4(ctx, thisCast->lockAckIDLen, thisCast->lockAckID);
}

View File

@@ -0,0 +1,73 @@
#ifndef FLOCKAPPENDMSG_H_
#define FLOCKAPPENDMSG_H_
#include <common/net/message/NetMessage.h>
#include <common/storage/EntryInfo.h>
/**
* This message is for serialiazation (outgoing) only, deserialization is not implemented!!
*/
struct FLockAppendMsg;
typedef struct FLockAppendMsg FLockAppendMsg;
static inline void FLockAppendMsg_init(FLockAppendMsg* this);
static inline void FLockAppendMsg_initFromSession(FLockAppendMsg* this, NumNodeID clientNumID,
const char* fileHandleID, const EntryInfo* entryInfo, int64_t clientFD, int ownerPID,
int lockTypeFlags, const char* lockAckID);
// virtual functions
extern void FLockAppendMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
struct FLockAppendMsg
{
NetMessage netMessage;
NumNodeID clientNumID;
const char* fileHandleID;
unsigned fileHandleIDLen;
const EntryInfo* entryInfoPtr; // not owned by this object
int64_t clientFD; /* client-wide unique identifier (typically not really the fd number)
* corresponds to 'struct file_lock* fileLock->fl_file on the client side'
*/
int ownerPID; // pid on client (just informative, because shared on fork() )
int lockTypeFlags; // ENTRYLOCKTYPE_...
const char* lockAckID; // ID for ack message when log is granted
unsigned lockAckIDLen;
};
extern const struct NetMessageOps FLockAppendMsg_Ops;
void FLockAppendMsg_init(FLockAppendMsg* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_FLockAppend, &FLockAppendMsg_Ops);
}
/**
* @param fileHandleID just a reference, so do not free it as long as you use this object!
* @param entryInfo just a reference, so do not free it as long as you use this object!
*/
void FLockAppendMsg_initFromSession(FLockAppendMsg* this, NumNodeID clientNumID,
const char* fileHandleID, const EntryInfo* entryInfo, int64_t clientFD, int ownerPID,
int lockTypeFlags, const char* lockAckID)
{
FLockAppendMsg_init(this);
this->clientNumID = clientNumID;
this->fileHandleID = fileHandleID;
this->fileHandleIDLen = strlen(fileHandleID);
this->entryInfoPtr = entryInfo;
this->clientFD = clientFD;
this->ownerPID = ownerPID;
this->lockTypeFlags = lockTypeFlags;
this->lockAckID = lockAckID;
this->lockAckIDLen = strlen(lockAckID);
}
#endif /* FLOCKAPPENDMSG_H_ */

View File

@@ -0,0 +1,27 @@
#ifndef FLOCKAPPENDRESPMSG_H_
#define FLOCKAPPENDRESPMSG_H_
#include <common/net/message/SimpleIntMsg.h>
#include <common/storage/StorageErrors.h>
/**
* This message is for deserialiazation (incoming) only, serialization is not implemented!!
*/
struct FLockAppendRespMsg;
typedef struct FLockAppendRespMsg FLockAppendRespMsg;
static inline void FLockAppendRespMsg_init(FLockAppendRespMsg* this);
struct FLockAppendRespMsg
{
SimpleIntMsg simpleIntMsg;
};
void FLockAppendRespMsg_init(FLockAppendRespMsg* this)
{
SimpleIntMsg_init( (SimpleIntMsg*)this, NETMSGTYPE_FLockAppendResp);
}
#endif /* FLOCKAPPENDRESPMSG_H_ */

View File

@@ -0,0 +1,36 @@
#include "FLockEntryMsg.h"
const struct NetMessageOps FLockEntryMsg_Ops = {
.serializePayload = FLockEntryMsg_serializePayload,
.deserializePayload = _NetMessage_deserializeDummy,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
.supportsSequenceNumbers = true,
};
void FLockEntryMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
{
FLockEntryMsg* thisCast = (FLockEntryMsg*)this;
// clientNumID
NumNodeID_serialize(ctx, &thisCast->clientNumID);
// clientFD
Serialization_serializeInt64(ctx, thisCast->clientFD);
// ownerPID
Serialization_serializeInt(ctx, thisCast->ownerPID);
// lockTypeFlags
Serialization_serializeInt(ctx, thisCast->lockTypeFlags);
// entryInfo
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
// fileHandleID
Serialization_serializeStrAlign4(ctx, thisCast->fileHandleIDLen, thisCast->fileHandleID);
// lockAckID
Serialization_serializeStrAlign4(ctx, thisCast->lockAckIDLen, thisCast->lockAckID);
}

View File

@@ -0,0 +1,73 @@
#ifndef FLOCKENTRYMSG_H_
#define FLOCKENTRYMSG_H_
#include <common/net/message/NetMessage.h>
#include <common/storage/EntryInfo.h>
/**
* This message is for serialiazation (outgoing) only, deserialization is not implemented!!
*/
struct FLockEntryMsg;
typedef struct FLockEntryMsg FLockEntryMsg;
static inline void FLockEntryMsg_init(FLockEntryMsg* this);
static inline void FLockEntryMsg_initFromSession(FLockEntryMsg* this, NumNodeID clientNumID,
const char* fileHandleID, const EntryInfo* entryInfo, int64_t clientFD, int ownerPID,
int lockTypeFlags, const char* lockAckID);
// virtual functions
extern void FLockEntryMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
struct FLockEntryMsg
{
NetMessage netMessage;
NumNodeID clientNumID;
const char* fileHandleID;
unsigned fileHandleIDLen;
const EntryInfo* entryInfoPtr; // not owned by this object
int64_t clientFD; /* client-wide unique identifier (typically not really the fd number)
* corresponds to 'struct file_lock* fileLock->fl_file on the client side'
*/
int ownerPID; // pid on client (just informative, because shared on fork() )
int lockTypeFlags; // ENTRYLOCKTYPE_...
const char* lockAckID; // ID for ack message when log is granted
unsigned lockAckIDLen;
};
extern const struct NetMessageOps FLockEntryMsg_Ops;
void FLockEntryMsg_init(FLockEntryMsg* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_FLockEntry, &FLockEntryMsg_Ops);
}
/**
* @param fileHandleID just a reference, so do not free it as long as you use this object!
* @param entryInfo just a reference, so do not free it as long as you use this object!
*/
void FLockEntryMsg_initFromSession(FLockEntryMsg* this, NumNodeID clientNumID,
const char* fileHandleID, const EntryInfo* entryInfo, int64_t clientFD, int ownerPID,
int lockTypeFlags, const char* lockAckID)
{
FLockEntryMsg_init(this);
this->clientNumID = clientNumID;
this->fileHandleID = fileHandleID;
this->fileHandleIDLen = strlen(fileHandleID);
this->entryInfoPtr = entryInfo;
this->clientFD = clientFD;
this->ownerPID = ownerPID;
this->lockTypeFlags = lockTypeFlags;
this->lockAckID = lockAckID;
this->lockAckIDLen = strlen(lockAckID);
}
#endif /* FLOCKENTRYMSG_H_ */

View File

@@ -0,0 +1,27 @@
#ifndef FLOCKENTRYRESPMSG_H_
#define FLOCKENTRYRESPMSG_H_
#include <common/net/message/SimpleIntMsg.h>
#include <common/storage/StorageErrors.h>
/**
* This message is for deserialiazation (incoming) only, serialization is not implemented!!
*/
struct FLockEntryRespMsg;
typedef struct FLockEntryRespMsg FLockEntryRespMsg;
static inline void FLockEntryRespMsg_init(FLockEntryRespMsg* this);
struct FLockEntryRespMsg
{
SimpleIntMsg simpleIntMsg;
};
void FLockEntryRespMsg_init(FLockEntryRespMsg* this)
{
SimpleIntMsg_init( (SimpleIntMsg*)this, NETMSGTYPE_FLockEntryResp);
}
#endif /* FLOCKENTRYRESPMSG_H_ */

View File

@@ -0,0 +1,39 @@
#include "FLockRangeMsg.h"
const struct NetMessageOps FLockRangeMsg_Ops = {
.serializePayload = FLockRangeMsg_serializePayload,
.deserializePayload = _NetMessage_deserializeDummy,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
.supportsSequenceNumbers = true,
};
void FLockRangeMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
{
FLockRangeMsg* thisCast = (FLockRangeMsg*)this;
// clientNumID
NumNodeID_serialize(ctx, &thisCast->clientNumID);
// start
Serialization_serializeUInt64(ctx, thisCast->start);
// end
Serialization_serializeUInt64(ctx, thisCast->end);
// ownerPID
Serialization_serializeInt(ctx, thisCast->ownerPID);
// lockTypeFlags
Serialization_serializeInt(ctx, thisCast->lockTypeFlags);
// entryInfo
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
// fileHandleID
Serialization_serializeStrAlign4(ctx, thisCast->fileHandleIDLen, thisCast->fileHandleID);
// lockAckID
Serialization_serializeStrAlign4(ctx, thisCast->lockAckIDLen, thisCast->lockAckID);
}

View File

@@ -0,0 +1,73 @@
#ifndef FLOCKRANGEMSG_H_
#define FLOCKRANGEMSG_H_
#include <common/net/message/NetMessage.h>
#include <common/storage/EntryInfo.h>
/**
* This message is for serialiazation (outgoing) only, deserialization is not implemented!!
*/
struct FLockRangeMsg;
typedef struct FLockRangeMsg FLockRangeMsg;
static inline void FLockRangeMsg_init(FLockRangeMsg* this);
static inline void FLockRangeMsg_initFromSession(FLockRangeMsg* this, NumNodeID clientNumID,
const char* fileHandleID, const EntryInfo* entryInfo,
int ownerPID, int lockTypeFlags, uint64_t start, uint64_t end, const char* lockAckID);
// virtual functions
extern void FLockRangeMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
struct FLockRangeMsg
{
NetMessage netMessage;
NumNodeID clientNumID;
const char* fileHandleID;
unsigned fileHandleIDLen;
const EntryInfo* entryInfoPtr; // not owned by this object
int ownerPID; // pid on client (just informative, because shared on fork() )
int lockTypeFlags; // ENTRYLOCKTYPE_...
uint64_t start;
uint64_t end;
const char* lockAckID; // ID for ack message when log is granted
unsigned lockAckIDLen;
};
extern const struct NetMessageOps FLockRangeMsg_Ops;
void FLockRangeMsg_init(FLockRangeMsg* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_FLockRange, &FLockRangeMsg_Ops);
}
/**
* @param fileHandleID just a reference, so do not free it as long as you use this object!
* @param entryInfo just a reference, so do not free it as long as you use this object!
*/
void FLockRangeMsg_initFromSession(FLockRangeMsg* this, NumNodeID clientNumID,
const char* fileHandleID, const EntryInfo* entryInfo,
int ownerPID, int lockTypeFlags, uint64_t start, uint64_t end, const char* lockAckID)
{
FLockRangeMsg_init(this);
this->clientNumID = clientNumID;
this->fileHandleID = fileHandleID;
this->fileHandleIDLen = strlen(fileHandleID);
this->entryInfoPtr = entryInfo;
this->ownerPID = ownerPID;
this->lockTypeFlags = lockTypeFlags;
this->start = start;
this->end = end;
this->lockAckID = lockAckID;
this->lockAckIDLen = strlen(lockAckID);
}
#endif /* FLOCKRANGEMSG_H_ */

View File

@@ -0,0 +1,27 @@
#ifndef FLOCKRANGERESPMSG_H_
#define FLOCKRANGERESPMSG_H_
#include <common/net/message/SimpleIntMsg.h>
#include <common/storage/StorageErrors.h>
/**
* This message is for deserialiazation (incoming) only, serialization is not implemented!!
*/
struct FLockRangeRespMsg;
typedef struct FLockRangeRespMsg FLockRangeRespMsg;
static inline void FLockRangeRespMsg_init(FLockRangeRespMsg* this);
struct FLockRangeRespMsg
{
SimpleIntMsg simpleIntMsg;
};
void FLockRangeRespMsg_init(FLockRangeRespMsg* this)
{
SimpleIntMsg_init( (SimpleIntMsg*)this, NETMSGTYPE_FLockRangeResp);
}
#endif /* FLOCKRANGERESPMSG_H_ */

View File

@@ -0,0 +1,79 @@
#include <app/App.h>
#include <components/AckManager.h>
#include <common/toolkit/ackstore/AcknowledgmentStore.h>
#include <common/toolkit/SocketTk.h>
#include <common/net/msghelpers/MsgHelperAck.h>
#include "LockGrantedMsgEx.h"
const struct NetMessageOps LockGrantedMsgEx_Ops = {
.serializePayload = _NetMessage_serializeDummy,
.deserializePayload = LockGrantedMsgEx_deserializePayload,
.processIncoming = __LockGrantedMsgEx_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
};
bool LockGrantedMsgEx_deserializePayload(NetMessage* this, DeserializeCtx* ctx)
{
LockGrantedMsgEx* thisCast = (LockGrantedMsgEx*)this;
// lockAckID
if(!Serialization_deserializeStrAlign4(ctx,
&thisCast->lockAckIDLen, &thisCast->lockAckID) )
return false;
// ackID
if(!Serialization_deserializeStrAlign4(ctx, &thisCast->ackIDLen, &thisCast->ackID) )
return false;
// granterNodeID
if(!NumNodeID_deserialize(ctx, &thisCast->granterNodeID) )
return false;
return true;
}
bool __LockGrantedMsgEx_processIncoming(NetMessage* this, struct App* app,
fhgfs_sockaddr_in* fromAddr, struct Socket* sock, char* respBuf, size_t bufLen)
{
const char* logContext = "LockGranted incoming";
Logger* log = App_getLogger(app);
AcknowledgmentStore* ackStore = App_getAckStore(app);
AckManager* ackManager = App_getAckManager(app);
LockGrantedMsgEx* thisCast = (LockGrantedMsgEx*)this;
bool gotLockWaiter;
#ifdef LOG_DEBUG_MESSAGES
const char* peer;
peer = fromAddr ?
SocketTk_ipaddrToStr(fromAddr->addr) : StringTk_strDup(Socket_getPeername(sock) );
LOG_DEBUG_FORMATTED(log, Log_DEBUG, logContext, "Received a AckMsg from: %s", peer);
kfree(peer);
#endif // LOG_DEBUG_MESSAGES
IGNORE_UNUSED_VARIABLE(log);
IGNORE_UNUSED_VARIABLE(logContext);
gotLockWaiter = AcknowledgmentStore_receivedAck(
ackStore, LockGrantedMsgEx_getLockAckID(thisCast) );
/* note: other than for standard acks, we send a ack repsonse to lock-grants only if someone was
still registered to wait for the lock-grant. (we do this to make our handling of interrupts
during lock waits easier, because we don't need lock canceling now.) */
if(gotLockWaiter)
{ // lock waiter registered => send ack
const char* ackID = LockGrantedMsgEx_getAckID(thisCast);
NumNodeID granterNodeID = LockGrantedMsgEx_getGranterNodeID(thisCast);
MsgHelperAck_respondToAckRequest(app, LockGrantedMsgEx_getAckID(thisCast), fromAddr, sock,
respBuf, bufLen);
AckManager_addAckToQueue(ackManager, granterNodeID, ackID);
}
return true;
}

View File

@@ -0,0 +1,62 @@
#ifndef LOCKGRANTEDMSGEX_H_
#define LOCKGRANTEDMSGEX_H_
#include <common/net/message/NetMessage.h>
/**
* This message is for deserialization (incoming) only, serialization is not implemented!
*/
struct LockGrantedMsgEx;
typedef struct LockGrantedMsgEx LockGrantedMsgEx;
static inline void LockGrantedMsgEx_init(LockGrantedMsgEx* this);
// virtual functions
extern bool LockGrantedMsgEx_deserializePayload(NetMessage* this, DeserializeCtx* ctx);
extern bool __LockGrantedMsgEx_processIncoming(NetMessage* this, struct App* app,
fhgfs_sockaddr_in* fromAddr, struct Socket* sock, char* respBuf, size_t bufLen);
// getters & setters
static inline const char* LockGrantedMsgEx_getLockAckID(LockGrantedMsgEx* this);
static inline const char* LockGrantedMsgEx_getAckID(LockGrantedMsgEx* this);
static inline NumNodeID LockGrantedMsgEx_getGranterNodeID(LockGrantedMsgEx* this);
struct LockGrantedMsgEx
{
NetMessage netMessage;
unsigned lockAckIDLen;
const char* lockAckID;
unsigned ackIDLen;
const char* ackID;
NumNodeID granterNodeID;
};
extern const struct NetMessageOps LockGrantedMsgEx_Ops;
void LockGrantedMsgEx_init(LockGrantedMsgEx* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_LockGranted, &LockGrantedMsgEx_Ops);
}
const char* LockGrantedMsgEx_getLockAckID(LockGrantedMsgEx* this)
{
return this->lockAckID;
}
const char* LockGrantedMsgEx_getAckID(LockGrantedMsgEx* this)
{
return this->ackID;
}
NumNodeID LockGrantedMsgEx_getGranterNodeID(LockGrantedMsgEx* this)
{
return this->granterNodeID;
}
#endif /* LOCKGRANTEDMSGEX_H_ */