diff options
author | J. Bruce Fields <bfields@redhat.com> | 2011-08-30 22:15:47 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2011-09-01 11:12:47 -0400 |
commit | 7c13f344cf8bec22301c5ed7ef1d90eecb57ba43 (patch) | |
tree | 41ed822e8992c9cc37775902349779f4d5273568 /fs/nfsd/nfs4state.c | |
parent | fff6ca9cc46857e5814cf687e5fb1b8a876766a4 (diff) |
nfsd4: drop most stateowner refcounting
Maybe we'll bring it back some day, but we don't have much real use for
it now.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 26b0c75aa93b..834a5f844f42 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -453,7 +453,7 @@ static void unhash_lockowner(struct nfs4_stateowner *sop) | |||
453 | static void release_lockowner(struct nfs4_stateowner *sop) | 453 | static void release_lockowner(struct nfs4_stateowner *sop) |
454 | { | 454 | { |
455 | unhash_lockowner(sop); | 455 | unhash_lockowner(sop); |
456 | nfs4_put_stateowner(sop); | 456 | nfs4_free_stateowner(sop); |
457 | } | 457 | } |
458 | 458 | ||
459 | static void | 459 | static void |
@@ -496,7 +496,7 @@ static void release_openowner(struct nfs4_stateowner *sop) | |||
496 | { | 496 | { |
497 | unhash_openowner(sop); | 497 | unhash_openowner(sop); |
498 | list_del(&sop->so_close_lru); | 498 | list_del(&sop->so_close_lru); |
499 | nfs4_put_stateowner(sop); | 499 | nfs4_free_stateowner(sop); |
500 | } | 500 | } |
501 | 501 | ||
502 | #define SESSION_HASH_SIZE 512 | 502 | #define SESSION_HASH_SIZE 512 |
@@ -2206,10 +2206,8 @@ out_nomem: | |||
2206 | } | 2206 | } |
2207 | 2207 | ||
2208 | void | 2208 | void |
2209 | nfs4_free_stateowner(struct kref *kref) | 2209 | nfs4_free_stateowner(struct nfs4_stateowner *sop) |
2210 | { | 2210 | { |
2211 | struct nfs4_stateowner *sop = | ||
2212 | container_of(kref, struct nfs4_stateowner, so_ref); | ||
2213 | kfree(sop->so_owner.data); | 2211 | kfree(sop->so_owner.data); |
2214 | kmem_cache_free(stateowner_slab, sop); | 2212 | kmem_cache_free(stateowner_slab, sop); |
2215 | } | 2213 | } |
@@ -2236,7 +2234,6 @@ static inline struct nfs4_stateowner *alloc_stateowner(struct xdr_netobj *owner, | |||
2236 | } | 2234 | } |
2237 | sop->so_owner.len = owner->len; | 2235 | sop->so_owner.len = owner->len; |
2238 | 2236 | ||
2239 | kref_init(&sop->so_ref); | ||
2240 | INIT_LIST_HEAD(&sop->so_perclient); | 2237 | INIT_LIST_HEAD(&sop->so_perclient); |
2241 | INIT_LIST_HEAD(&sop->so_stateids); | 2238 | INIT_LIST_HEAD(&sop->so_stateids); |
2242 | INIT_LIST_HEAD(&sop->so_perstateid); | 2239 | INIT_LIST_HEAD(&sop->so_perstateid); |
@@ -3413,14 +3410,12 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, | |||
3413 | /* It's not stale; let's assume it's expired: */ | 3410 | /* It's not stale; let's assume it's expired: */ |
3414 | if (sop == NULL) | 3411 | if (sop == NULL) |
3415 | return nfserr_expired; | 3412 | return nfserr_expired; |
3416 | nfs4_get_stateowner(sop); | ||
3417 | cstate->replay_owner = sop; | 3413 | cstate->replay_owner = sop; |
3418 | goto check_replay; | 3414 | goto check_replay; |
3419 | } | 3415 | } |
3420 | 3416 | ||
3421 | *stpp = stp; | 3417 | *stpp = stp; |
3422 | sop = stp->st_stateowner; | 3418 | sop = stp->st_stateowner; |
3423 | nfs4_get_stateowner(sop); | ||
3424 | cstate->replay_owner = sop; | 3419 | cstate->replay_owner = sop; |
3425 | 3420 | ||
3426 | if (nfs4_check_fh(current_fh, stp)) { | 3421 | if (nfs4_check_fh(current_fh, stp)) { |
@@ -3783,11 +3778,17 @@ nfs4_set_lock_denied(struct file_lock *fl, struct nfsd4_lock_denied *deny) | |||
3783 | 3778 | ||
3784 | if (fl->fl_lmops == &nfsd_posix_mng_ops) { | 3779 | if (fl->fl_lmops == &nfsd_posix_mng_ops) { |
3785 | sop = (struct nfs4_stateowner *) fl->fl_owner; | 3780 | sop = (struct nfs4_stateowner *) fl->fl_owner; |
3786 | kref_get(&sop->so_ref); | 3781 | deny->ld_owner.data = kmemdup(sop->so_owner.data, |
3787 | deny->ld_sop = sop; | 3782 | sop->so_owner.len, GFP_KERNEL); |
3783 | if (!deny->ld_owner.data) | ||
3784 | /* We just don't care that much */ | ||
3785 | goto nevermind; | ||
3786 | deny->ld_owner.len = sop->so_owner.len; | ||
3788 | deny->ld_clientid = sop->so_client->cl_clientid; | 3787 | deny->ld_clientid = sop->so_client->cl_clientid; |
3789 | } else { | 3788 | } else { |
3790 | deny->ld_sop = NULL; | 3789 | nevermind: |
3790 | deny->ld_owner.len = 0; | ||
3791 | deny->ld_owner.data = NULL; | ||
3791 | deny->ld_clientid.cl_boot = 0; | 3792 | deny->ld_clientid.cl_boot = 0; |
3792 | deny->ld_clientid.cl_id = 0; | 3793 | deny->ld_clientid.cl_id = 0; |
3793 | } | 3794 | } |