From 2901b43906e3367fbad89f6a1ff4e2ac3f1cf4da Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 12 Jul 2021 14:32:12 -0700 Subject: [PATCH] Also allow omap requests to disconnected clients We recently fixed problems sending omap responses to originating clients which can race with the clients disconnecting. We need to handle the requests sent to clients on behalf of an origination request in exactly the same way. The send can race with the client being evicted. It'll be cleaned after the race is safely ignored by the client's rid being removed from the server's request tracking. Signed-off-by: Zach Brown --- kmod/src/server.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/kmod/src/server.c b/kmod/src/server.c index e7a78b80..59e71ec8 100644 --- a/kmod/src/server.c +++ b/kmod/src/server.c @@ -2355,15 +2355,25 @@ static int open_ino_map_response(struct super_block *sb, struct scoutfs_net_conn return scoutfs_omap_server_handle_response(sb, rid, resp); } -/* The server is sending an omap request to the client */ +/* + * The server is sending an omap requests to all the clients it thought + * were connected when it received a request from another client. + * This send can race with the client's connection being removed. We + * can drop those sends on the floor and mask ENOTCONN. The client's rid + * will soon be removed from the request which will be correctly handled. + */ int scoutfs_server_send_omap_request(struct super_block *sb, u64 rid, struct scoutfs_open_ino_map_args *args) { struct server_info *server = SCOUTFS_SB(sb)->server_info; + int ret; - return scoutfs_net_submit_request_node(sb, server->conn, rid, SCOUTFS_NET_CMD_OPEN_INO_MAP, + ret = scoutfs_net_submit_request_node(sb, server->conn, rid, SCOUTFS_NET_CMD_OPEN_INO_MAP, args, sizeof(*args), open_ino_map_response, NULL, NULL); + if (ret == -ENOTCONN) + ret = 0; + return ret; } /*