diff --git a/kmod/src/client.c b/kmod/src/client.c index 50adc22e..5c6a30de 100644 --- a/kmod/src/client.c +++ b/kmod/src/client.c @@ -49,7 +49,6 @@ struct client_info { struct delayed_work connect_dwork; u64 server_term; - u64 greeting_umb; bool sending_farewell; int farewell_error; diff --git a/kmod/src/lock_server.c b/kmod/src/lock_server.c index 036bfcc4..0e04ac66 100644 --- a/kmod/src/lock_server.c +++ b/kmod/src/lock_server.c @@ -586,7 +586,9 @@ static void init_lock_clients_key(struct scoutfs_key *key, u64 rid) * the client had already talked to the server then we must find an * existing record for it and should begin recovery. If it doesn't have * a record then its timed out and we can't allow it to reconnect. If - * its connecting for the first time then we insert a new record. If + * we're creating a new record for a client we can see EEXIST if the + * greeting is resent to a new server after the record was committed but + * before the response was received by the client. * * This is running in concurrent client greeting processing contexts. */ @@ -611,6 +613,8 @@ int scoutfs_lock_server_greeting(struct super_block *sb, u64 rid, ret = scoutfs_btree_insert(sb, inf->alloc, inf->wri, &super->lock_clients, &key, NULL, 0); + if (ret == -EEXIST) + ret = 0; } mutex_unlock(&inf->mutex); diff --git a/kmod/src/net.c b/kmod/src/net.c index c885d2bd..b323e20f 100644 --- a/kmod/src/net.c +++ b/kmod/src/net.c @@ -1546,9 +1546,8 @@ void scoutfs_net_client_greeting(struct super_block *sb, * response and they can disconnect cleanly. * * At this point our connection is idle except for send submissions and - * shutdown being queued. Once we shut down a We completely own a We - * have exclusive access to a previous conn once its shutdown and we set - * _freeing. + * shutdown being queued. We have exclusive access to the previous conn + * once it's shutdown and we set _freeing. */ void scoutfs_net_server_greeting(struct super_block *sb, struct scoutfs_net_connection *conn, diff --git a/kmod/src/server.c b/kmod/src/server.c index d7d16870..ce7840bd 100644 --- a/kmod/src/server.c +++ b/kmod/src/server.c @@ -1024,6 +1024,12 @@ static void init_mounted_client_key(struct scoutfs_key *key, u64 rid) }; } +/* + * Insert a new mounted client item for a client that is sending us a + * greeting that hasn't yet seen a response. The greeting can be + * retransmitted to a new server after the previous inserted the item so + * it's acceptable to see -EEXIST. + */ static int insert_mounted_client(struct super_block *sb, u64 rid, u64 gr_flags) { @@ -1042,6 +1048,8 @@ static int insert_mounted_client(struct super_block *sb, u64 rid, ret = scoutfs_btree_insert(sb, &server->alloc, &server->wri, &super->mounted_clients, &key, &mcv, sizeof(mcv)); + if (ret == -EEXIST) + ret = 0; mutex_unlock(&server->mounted_clients_mutex); return ret;