mirror of
https://github.com/versity/scoutfs.git
synced 2026-02-08 19:50:08 +00:00
Now that a mount's client is responsible for electing and starting a server we need to be careful about coordinating unmount. We can't let unmounting clients leave the remaining mounted clients without quorum. The server carefully tracks who is mounted and who is unmounting while it is processing farewell requests. It only sends responses to voting mounts while quorum remains or once all the voting clients are all trying to unmount. We use a field in the quorum blocks to communicate to the final set of unmounting voters that their farewells have been processed and that they can finish unmounting without trying to restablish quorum. The commit introduces and maintains the unmount_barrier field in the quorum blocks. It is passed to the server from the election, the server sends it to the client and writes new versions, and the client compares what it received with what it sees in quorum blocks. The commit then has the clients send their unique name to the server who stores it in persistent mounted client records and compares the names to the quorum config when deciding which farewell reqeusts can be responded to. Now that farewell response processing can block for a very long time it is moved off into async work so that it doesn't prevent net connections from being shutdown and re-established. This also makes it easier to make global decisions based on the count of pending farewell requests. Signed-off-by: Zach Brown <zab@versity.com>
86 lines
2.8 KiB
C
86 lines
2.8 KiB
C
#ifndef _SCOUTFS_SERVER_H_
|
|
#define _SCOUTFS_SERVER_H_
|
|
|
|
#define SI4_FMT "%u.%u.%u.%u:%u"
|
|
|
|
#define si4_trace_define(name) \
|
|
__field(__u32, name##_addr) \
|
|
__field(__u16, name##_port)
|
|
|
|
#define si4_trace_assign(name, sin) \
|
|
do { \
|
|
__typeof__(sin) _sin = (sin); \
|
|
\
|
|
__entry->name##_addr = be32_to_cpu(_sin->sin_addr.s_addr); \
|
|
__entry->name##_port = be16_to_cpu(_sin->sin_port); \
|
|
} while(0)
|
|
|
|
#define si4_trace_args(name) \
|
|
(__entry->name##_addr >> 24), \
|
|
(__entry->name##_addr >> 16) & 255, \
|
|
(__entry->name##_addr >> 8) & 255, \
|
|
__entry->name##_addr & 255, \
|
|
__entry->name##_port
|
|
|
|
#define SNH_FMT \
|
|
"seq %llu recv_seq %llu id %llu data_len %u cmd %u flags 0x%x error %u"
|
|
#define SNH_ARG(nh) \
|
|
le64_to_cpu((nh)->seq), le64_to_cpu((nh)->recv_seq), \
|
|
le64_to_cpu((nh)->id), le16_to_cpu((nh)->data_len), (nh)->cmd, \
|
|
(nh)->flags, (nh)->error
|
|
|
|
#define snh_trace_define(name) \
|
|
__field(__u64, name##_seq) \
|
|
__field(__u64, name##_recv_seq) \
|
|
__field(__u64, name##_id) \
|
|
__field(__u16, name##_data_len) \
|
|
__field(__u8, name##_cmd) \
|
|
__field(__u8, name##_flags) \
|
|
__field(__u8, name##_error)
|
|
|
|
#define snh_trace_assign(name, nh) \
|
|
do { \
|
|
__typeof__(nh) _nh = (nh); \
|
|
\
|
|
__entry->name##_seq = le64_to_cpu(_nh->seq); \
|
|
__entry->name##_recv_seq = le64_to_cpu(_nh->recv_seq); \
|
|
__entry->name##_id = le64_to_cpu(_nh->id); \
|
|
__entry->name##_data_len = le16_to_cpu(_nh->data_len); \
|
|
__entry->name##_cmd = _nh->cmd; \
|
|
__entry->name##_flags = _nh->flags; \
|
|
__entry->name##_error = _nh->error; \
|
|
} while (0)
|
|
|
|
#define snh_trace_args(name) \
|
|
__entry->name##_seq, __entry->name##_recv_seq, __entry->name##_id, \
|
|
__entry->name##_data_len, __entry->name##_cmd, __entry->name##_flags, \
|
|
__entry->name##_error
|
|
|
|
struct scoutfs_net_manifest_entry;
|
|
struct scoutfs_manifest_entry;
|
|
|
|
void scoutfs_init_ment_to_net(struct scoutfs_net_manifest_entry *net_ment,
|
|
struct scoutfs_manifest_entry *ment);
|
|
void scoutfs_init_ment_from_net(struct scoutfs_manifest_entry *ment,
|
|
struct scoutfs_net_manifest_entry *net_ment);
|
|
|
|
int scoutfs_server_lock_request(struct super_block *sb, u64 node_id,
|
|
struct scoutfs_net_lock *nl);
|
|
int scoutfs_server_lock_response(struct super_block *sb, u64 node_id,
|
|
u64 id, struct scoutfs_net_lock *nl);
|
|
int scoutfs_server_lock_recover_request(struct super_block *sb, u64 node_id,
|
|
struct scoutfs_key *key);
|
|
|
|
struct sockaddr_in;
|
|
struct scoutfs_quorum_elected_info;
|
|
int scoutfs_server_start(struct super_block *sb, struct sockaddr_in *sin,
|
|
u64 term, struct scoutfs_quorum_elected_info *qei);
|
|
void scoutfs_server_abort(struct super_block *sb);
|
|
void scoutfs_server_stop(struct super_block *sb,
|
|
struct scoutfs_quorum_elected_info *qei);
|
|
|
|
int scoutfs_server_setup(struct super_block *sb);
|
|
void scoutfs_server_destroy(struct super_block *sb);
|
|
|
|
#endif
|