Commit 404dbd26 authored by Chris Lew's avatar Chris Lew Committed by Paolo Abeni

net: qrtr: ns: Ignore ENODEV failures in ns

Ignore the ENODEV failures returned by kernel_sendmsg(). These errors
indicate that either the local port has been closed or the remote has
gone down. Neither of these scenarios are fatal and will eventually be
handled through packets that are later queued on the control port.
Signed-off-by: default avatarChris Lew <quic_clew@quicinc.com>
Signed-off-by: default avatarSarannya Sasikumar <quic_sarannya@quicinc.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240612063156.1377210-1-quic_sarannya@quicinc.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 3873d0d1
...@@ -132,8 +132,8 @@ static int service_announce_new(struct sockaddr_qrtr *dest, ...@@ -132,8 +132,8 @@ static int service_announce_new(struct sockaddr_qrtr *dest,
return kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt)); return kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));
} }
static int service_announce_del(struct sockaddr_qrtr *dest, static void service_announce_del(struct sockaddr_qrtr *dest,
struct qrtr_server *srv) struct qrtr_server *srv)
{ {
struct qrtr_ctrl_pkt pkt; struct qrtr_ctrl_pkt pkt;
struct msghdr msg = { }; struct msghdr msg = { };
...@@ -157,10 +157,10 @@ static int service_announce_del(struct sockaddr_qrtr *dest, ...@@ -157,10 +157,10 @@ static int service_announce_del(struct sockaddr_qrtr *dest,
msg.msg_namelen = sizeof(*dest); msg.msg_namelen = sizeof(*dest);
ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt)); ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));
if (ret < 0) if (ret < 0 && ret != -ENODEV)
pr_err("failed to announce del service\n"); pr_err("failed to announce del service\n");
return ret; return;
} }
static void lookup_notify(struct sockaddr_qrtr *to, struct qrtr_server *srv, static void lookup_notify(struct sockaddr_qrtr *to, struct qrtr_server *srv,
...@@ -188,7 +188,7 @@ static void lookup_notify(struct sockaddr_qrtr *to, struct qrtr_server *srv, ...@@ -188,7 +188,7 @@ static void lookup_notify(struct sockaddr_qrtr *to, struct qrtr_server *srv,
msg.msg_namelen = sizeof(*to); msg.msg_namelen = sizeof(*to);
ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt)); ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));
if (ret < 0) if (ret < 0 && ret != -ENODEV)
pr_err("failed to send lookup notification\n"); pr_err("failed to send lookup notification\n");
} }
...@@ -207,6 +207,9 @@ static int announce_servers(struct sockaddr_qrtr *sq) ...@@ -207,6 +207,9 @@ static int announce_servers(struct sockaddr_qrtr *sq)
xa_for_each(&node->servers, index, srv) { xa_for_each(&node->servers, index, srv) {
ret = service_announce_new(sq, srv); ret = service_announce_new(sq, srv);
if (ret < 0) { if (ret < 0) {
if (ret == -ENODEV)
continue;
pr_err("failed to announce new service\n"); pr_err("failed to announce new service\n");
return ret; return ret;
} }
...@@ -369,7 +372,7 @@ static int ctrl_cmd_bye(struct sockaddr_qrtr *from) ...@@ -369,7 +372,7 @@ static int ctrl_cmd_bye(struct sockaddr_qrtr *from)
msg.msg_namelen = sizeof(sq); msg.msg_namelen = sizeof(sq);
ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt)); ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));
if (ret < 0) { if (ret < 0 && ret != -ENODEV) {
pr_err("failed to send bye cmd\n"); pr_err("failed to send bye cmd\n");
return ret; return ret;
} }
...@@ -443,7 +446,7 @@ static int ctrl_cmd_del_client(struct sockaddr_qrtr *from, ...@@ -443,7 +446,7 @@ static int ctrl_cmd_del_client(struct sockaddr_qrtr *from,
msg.msg_namelen = sizeof(sq); msg.msg_namelen = sizeof(sq);
ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt)); ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));
if (ret < 0) { if (ret < 0 && ret != -ENODEV) {
pr_err("failed to send del client cmd\n"); pr_err("failed to send del client cmd\n");
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment