scoutfs: add server bind warning

Emit an error message if the server fails to bind.  It can mean that
there is a bad configured address.  But we might want to be able to bind
if the address becomes available, so we don't hard error.  We only emit
the message once for a series of failures.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2018-04-13 11:38:37 -07:00
committed by Zach Brown
parent 81b3159508
commit 8061a5cd28

View File

@@ -47,6 +47,7 @@ struct server_info {
struct mutex mutex;
bool shutting_down;
bool bind_warned;
struct task_struct *listen_task;
struct socket *listen_sock;
@@ -906,8 +907,20 @@ static void scoutfs_server_func(struct work_struct *work)
goto out;
addrlen = sizeof(sin);
ret = kernel_bind(sock, (struct sockaddr *)&sin, addrlen) ?:
kernel_getsockname(sock, (struct sockaddr *)&sin, &addrlen);
ret = kernel_bind(sock, (struct sockaddr *)&sin, addrlen);
if (ret) {
if (!server->bind_warned) {
scoutfs_err(sb, "server failed to bind to "SIN_FMT", errno %d%s. Retrying indefinitely..",
SIN_ARG(&sin), ret,
ret == -EADDRNOTAVAIL ? " (Bad address?)"
: "");
server->bind_warned = true;
}
goto out;
}
server->bind_warned = false;
kernel_getsockname(sock, (struct sockaddr *)&sin, &addrlen);
if (ret)
goto out;