ref counting for nfs41_root
very similar to the issue with nfs41_open_state, an abandoned upcall could outlive its mount. to prevent their nfs41_root from being freed, upcalls need to hold a reference until they're finished. this also keeps all of its clients/sessions/rpc connections alive Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
parent
006bdfa47a
commit
bcc707d3b8
13 changed files with 57 additions and 4 deletions
|
|
@ -57,6 +57,7 @@ int nfs41_root_create(
|
|||
root->wsize = wsize;
|
||||
root->rsize = rsize;
|
||||
InitializeCriticalSection(&root->lock);
|
||||
root->ref_count = 1;
|
||||
|
||||
/* generate a unique client_owner */
|
||||
status = nfs41_client_owner(name, &root->client_owner);
|
||||
|
|
@ -71,7 +72,7 @@ out:
|
|||
return status;
|
||||
}
|
||||
|
||||
void nfs41_root_free(
|
||||
static void root_free(
|
||||
IN nfs41_root *root)
|
||||
{
|
||||
struct list_entry *entry, *tmp;
|
||||
|
|
@ -86,6 +87,25 @@ void nfs41_root_free(
|
|||
dprintf(NSLVL, "<-- nfs41_root_free()\n");
|
||||
}
|
||||
|
||||
void nfs41_root_ref(
|
||||
IN nfs41_root *root)
|
||||
{
|
||||
const LONG count = InterlockedIncrement(&root->ref_count);
|
||||
|
||||
dprintf(2, "nfs41_root_ref() count %d\n", count);
|
||||
}
|
||||
|
||||
void nfs41_root_deref(
|
||||
IN nfs41_root *root)
|
||||
{
|
||||
const LONG count = InterlockedDecrement(&root->ref_count);
|
||||
|
||||
dprintf(2, "nfs41_root_deref() count %d\n", count);
|
||||
if (count == 0)
|
||||
root_free(root);
|
||||
}
|
||||
|
||||
|
||||
/* root_client_find_addrs() */
|
||||
struct cl_addr_info {
|
||||
const multi_addr4 *addrs;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue