diff options
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 4b4beaaa4eaa..a0dee8ae9f97 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -633,8 +633,8 @@ out: | |||
633 | return co; | 633 | return co; |
634 | } | 634 | } |
635 | 635 | ||
636 | struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, | 636 | struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct kmem_cache *slab, |
637 | struct kmem_cache *slab) | 637 | void (*sc_free)(struct nfs4_stid *)) |
638 | { | 638 | { |
639 | struct nfs4_stid *stid; | 639 | struct nfs4_stid *stid; |
640 | int new_id; | 640 | int new_id; |
@@ -650,6 +650,8 @@ struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, | |||
650 | idr_preload_end(); | 650 | idr_preload_end(); |
651 | if (new_id < 0) | 651 | if (new_id < 0) |
652 | goto out_free; | 652 | goto out_free; |
653 | |||
654 | stid->sc_free = sc_free; | ||
653 | stid->sc_client = cl; | 655 | stid->sc_client = cl; |
654 | stid->sc_stateid.si_opaque.so_id = new_id; | 656 | stid->sc_stateid.si_opaque.so_id = new_id; |
655 | stid->sc_stateid.si_opaque.so_clid = cl->cl_clientid; | 657 | stid->sc_stateid.si_opaque.so_clid = cl->cl_clientid; |
@@ -675,15 +677,12 @@ out_free: | |||
675 | static struct nfs4_ol_stateid * nfs4_alloc_open_stateid(struct nfs4_client *clp) | 677 | static struct nfs4_ol_stateid * nfs4_alloc_open_stateid(struct nfs4_client *clp) |
676 | { | 678 | { |
677 | struct nfs4_stid *stid; | 679 | struct nfs4_stid *stid; |
678 | struct nfs4_ol_stateid *stp; | ||
679 | 680 | ||
680 | stid = nfs4_alloc_stid(clp, stateid_slab); | 681 | stid = nfs4_alloc_stid(clp, stateid_slab, nfs4_free_ol_stateid); |
681 | if (!stid) | 682 | if (!stid) |
682 | return NULL; | 683 | return NULL; |
683 | 684 | ||
684 | stp = openlockstateid(stid); | 685 | return openlockstateid(stid); |
685 | stp->st_stid.sc_free = nfs4_free_ol_stateid; | ||
686 | return stp; | ||
687 | } | 686 | } |
688 | 687 | ||
689 | static void nfs4_free_deleg(struct nfs4_stid *stid) | 688 | static void nfs4_free_deleg(struct nfs4_stid *stid) |
@@ -781,11 +780,10 @@ alloc_init_deleg(struct nfs4_client *clp, struct svc_fh *current_fh, | |||
781 | goto out_dec; | 780 | goto out_dec; |
782 | if (delegation_blocked(¤t_fh->fh_handle)) | 781 | if (delegation_blocked(¤t_fh->fh_handle)) |
783 | goto out_dec; | 782 | goto out_dec; |
784 | dp = delegstateid(nfs4_alloc_stid(clp, deleg_slab)); | 783 | dp = delegstateid(nfs4_alloc_stid(clp, deleg_slab, nfs4_free_deleg)); |
785 | if (dp == NULL) | 784 | if (dp == NULL) |
786 | goto out_dec; | 785 | goto out_dec; |
787 | 786 | ||
788 | dp->dl_stid.sc_free = nfs4_free_deleg; | ||
789 | /* | 787 | /* |
790 | * delegation seqid's are never incremented. The 4.1 special | 788 | * delegation seqid's are never incremented. The 4.1 special |
791 | * meaning of seqid 0 isn't meaningful, really, but let's avoid | 789 | * meaning of seqid 0 isn't meaningful, really, but let's avoid |
@@ -5580,7 +5578,6 @@ init_lock_stateid(struct nfs4_ol_stateid *stp, struct nfs4_lockowner *lo, | |||
5580 | stp->st_stateowner = nfs4_get_stateowner(&lo->lo_owner); | 5578 | stp->st_stateowner = nfs4_get_stateowner(&lo->lo_owner); |
5581 | get_nfs4_file(fp); | 5579 | get_nfs4_file(fp); |
5582 | stp->st_stid.sc_file = fp; | 5580 | stp->st_stid.sc_file = fp; |
5583 | stp->st_stid.sc_free = nfs4_free_lock_stateid; | ||
5584 | stp->st_access_bmap = 0; | 5581 | stp->st_access_bmap = 0; |
5585 | stp->st_deny_bmap = open_stp->st_deny_bmap; | 5582 | stp->st_deny_bmap = open_stp->st_deny_bmap; |
5586 | stp->st_openstp = open_stp; | 5583 | stp->st_openstp = open_stp; |
@@ -5623,7 +5620,7 @@ find_or_create_lock_stateid(struct nfs4_lockowner *lo, struct nfs4_file *fi, | |||
5623 | lst = find_lock_stateid(lo, fi); | 5620 | lst = find_lock_stateid(lo, fi); |
5624 | if (lst == NULL) { | 5621 | if (lst == NULL) { |
5625 | spin_unlock(&clp->cl_lock); | 5622 | spin_unlock(&clp->cl_lock); |
5626 | ns = nfs4_alloc_stid(clp, stateid_slab); | 5623 | ns = nfs4_alloc_stid(clp, stateid_slab, nfs4_free_lock_stateid); |
5627 | if (ns == NULL) | 5624 | if (ns == NULL) |
5628 | return NULL; | 5625 | return NULL; |
5629 | 5626 | ||