Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 63828
b: refs/heads/master
c: 905f8d1
h: refs/heads/master
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Aug 7, 2007
1 parent 031039f commit 3829bc2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 45328c354e8ae16b67cb3adb72ab57459f9e5fd6
refs/heads/master: 905f8d16e32fd48499e3f8b9a2d9f746af3e0949
21 changes: 15 additions & 6 deletions trunk/fs/nfs/delegation.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,27 @@
#include "delegation.h"
#include "internal.h"

static void nfs_free_delegation(struct nfs_delegation *delegation)
static void nfs_do_free_delegation(struct nfs_delegation *delegation)
{
if (delegation->cred)
put_rpccred(delegation->cred);
kfree(delegation);
}

static void nfs_free_delegation_callback(struct rcu_head *head)
{
struct nfs_delegation *delegation = container_of(head, struct nfs_delegation, rcu);

nfs_free_delegation(delegation);
nfs_do_free_delegation(delegation);
}

static void nfs_free_delegation(struct nfs_delegation *delegation)
{
struct rpc_cred *cred;

cred = rcu_dereference(delegation->cred);
rcu_assign_pointer(delegation->cred, NULL);
call_rcu(&delegation->rcu, nfs_free_delegation_callback);
if (cred)
put_rpccred(cred);
}

static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_state *state)
Expand Down Expand Up @@ -166,7 +175,7 @@ static int nfs_do_return_delegation(struct inode *inode, struct nfs_delegation *
int res = 0;

res = nfs4_proc_delegreturn(inode, delegation->cred, &delegation->stateid);
call_rcu(&delegation->rcu, nfs_free_delegation_callback);
nfs_free_delegation(delegation);
return res;
}

Expand Down Expand Up @@ -448,7 +457,7 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp)
spin_unlock(&clp->cl_lock);
rcu_read_unlock();
if (delegation != NULL)
call_rcu(&delegation->rcu, nfs_free_delegation_callback);
nfs_free_delegation(delegation);
goto restart;
}
rcu_read_unlock();
Expand Down

0 comments on commit 3829bc2

Please sign in to comment.