mirror of
https://github.com/versity/scoutfs.git
synced 2026-04-27 08:35:05 +00:00
scoutfs: use SO_REUSEADDR for server socket
The server's listening address is fixed by the raft config in the super block. If it shuts down and rapidly starts back up it needs to bind to the currently lingering address. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -1360,6 +1360,7 @@ int scoutfs_net_bind(struct super_block *sb,
|
||||
{
|
||||
struct socket *sock = NULL;
|
||||
int addrlen;
|
||||
int optval;
|
||||
int ret;
|
||||
|
||||
/* caller state machine shouldn't let this happen */
|
||||
@@ -1370,6 +1371,12 @@ int scoutfs_net_bind(struct super_block *sb,
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
optval = 1;
|
||||
ret = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(char *)&optval, sizeof(optval));
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
addrlen = sizeof(struct sockaddr_in);
|
||||
ret = kernel_bind(sock, (struct sockaddr *)sin, addrlen);
|
||||
if (ret)
|
||||
|
||||
Reference in New Issue
Block a user