Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why not removing the client record after the client umounted #1106

Open
hit1943 opened this issue Mar 27, 2024 · 3 comments
Open

why not removing the client record after the client umounted #1106

hit1943 opened this issue Mar 27, 2024 · 3 comments
Labels

Comments

@hit1943
Copy link

hit1943 commented Mar 27, 2024

now if a new client mounts to ganesha,a new client record will insert to client_by_ip tree,but when the client umounts from the server,the client record still lives in the client_by_ip tree,should we fix it like this?

void put_gsh_client(struct gsh_client *client)
{
    int64_t new_refcnt;

    new_refcnt = atomic_dec_int64_t(&client->refcnt);
    assert(new_refcnt >= 0);

+++ if (atomic_fetch_int64_t(&cl->refcnt) == 0) {
+++        remove_gsh_client(&client->cl_addrbuf)
+++ }
}
@ffilz ffilz added the question label Mar 27, 2024
@ffilz
Copy link
Member

ffilz commented Mar 27, 2024

That simple fix would mean that any NFSv3 client that has no in progress RPC calls would be freed. An NFSv3 client maintains no reference to the gsh_client even for NLM locks. We don't track mounted clients, that is a lost cause because clients often do not unmount. For NFSv4, we do maintain a reference to the gsh_client for each clientid record. When the gsh_client is freed, so go the stats counters.

If we really were concerned about this, the best bet would be an LRU and expire any unreferenced clients older than some age. But even then, a sysadmin might not want to lose the stats counters just because the client was logged off overnight or some other longer period.

@hit1943
Copy link
Author

hit1943 commented Mar 28, 2024

@ffilz
thanks for your reply

"expire any unreferenced clients older than some age" will be a good choice,the age may be a value larger than the lease period

because if a client has logged off for a long time for some reason,the lease for the client must have been expired. once the client resumes,it will reconnect the ganesha server and setclientid,then the server will has the client's stats counters again.

@ffilz
Copy link
Member

ffilz commented Mar 28, 2024

I think it needs to be longer than just the lease period. In fact, we probably should count the number of times a client's lease is expired and show that.

That also still doesn't address NFSv3 clients where there is no way to know if the client is still active or not.

Also not sure that an NFSv4 client that had no open files or other state wouldn't decide to idle the mount and drop it's clientid. So even that isn't necessarily a case for dropping the gsh_client and thus the stats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants