aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/nfs4state.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 1dfc8ee85c93..fdbfbcb70914 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -470,7 +470,7 @@ kmem_cache *slab)
470 struct nfs4_stid *stid; 470 struct nfs4_stid *stid;
471 int new_id; 471 int new_id;
472 472
473 stid = kmem_cache_alloc(slab, GFP_KERNEL); 473 stid = kmem_cache_zalloc(slab, GFP_KERNEL);
474 if (!stid) 474 if (!stid)
475 return NULL; 475 return NULL;
476 476
@@ -478,11 +478,9 @@ kmem_cache *slab)
478 if (new_id < 0) 478 if (new_id < 0)
479 goto out_free; 479 goto out_free;
480 stid->sc_client = cl; 480 stid->sc_client = cl;
481 stid->sc_type = 0;
482 stid->sc_stateid.si_opaque.so_id = new_id; 481 stid->sc_stateid.si_opaque.so_id = new_id;
483 stid->sc_stateid.si_opaque.so_clid = cl->cl_clientid; 482 stid->sc_stateid.si_opaque.so_clid = cl->cl_clientid;
484 /* Will be incremented before return to client: */ 483 /* Will be incremented before return to client: */
485 stid->sc_stateid.si_generation = 0;
486 atomic_set(&stid->sc_count, 1); 484 atomic_set(&stid->sc_count, 1);
487 485
488 /* 486 /*
@@ -603,10 +601,8 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_ol_stateid *stp, struct sv
603 INIT_LIST_HEAD(&dp->dl_perfile); 601 INIT_LIST_HEAD(&dp->dl_perfile);
604 INIT_LIST_HEAD(&dp->dl_perclnt); 602 INIT_LIST_HEAD(&dp->dl_perclnt);
605 INIT_LIST_HEAD(&dp->dl_recall_lru); 603 INIT_LIST_HEAD(&dp->dl_recall_lru);
606 dp->dl_file = NULL;
607 dp->dl_type = NFS4_OPEN_DELEGATE_READ; 604 dp->dl_type = NFS4_OPEN_DELEGATE_READ;
608 fh_copy_shallow(&dp->dl_fh, &current_fh->fh_handle); 605 fh_copy_shallow(&dp->dl_fh, &current_fh->fh_handle);
609 dp->dl_time = 0;
610 INIT_WORK(&dp->dl_recall.cb_work, nfsd4_run_cb_recall); 606 INIT_WORK(&dp->dl_recall.cb_work, nfsd4_run_cb_recall);
611 return dp; 607 return dp;
612} 608}
@@ -627,6 +623,8 @@ void
627nfs4_put_delegation(struct nfs4_delegation *dp) 623nfs4_put_delegation(struct nfs4_delegation *dp)
628{ 624{
629 if (atomic_dec_and_test(&dp->dl_stid.sc_count)) { 625 if (atomic_dec_and_test(&dp->dl_stid.sc_count)) {
626 if (dp->dl_file)
627 put_nfs4_file(dp->dl_file);
630 remove_stid(&dp->dl_stid); 628 remove_stid(&dp->dl_stid);
631 nfs4_free_stid(deleg_slab, &dp->dl_stid); 629 nfs4_free_stid(deleg_slab, &dp->dl_stid);
632 num_delegations--; 630 num_delegations--;
@@ -678,13 +676,9 @@ unhash_delegation(struct nfs4_delegation *dp)
678 list_del_init(&dp->dl_recall_lru); 676 list_del_init(&dp->dl_recall_lru);
679 list_del_init(&dp->dl_perfile); 677 list_del_init(&dp->dl_perfile);
680 spin_unlock(&fp->fi_lock); 678 spin_unlock(&fp->fi_lock);
681 if (fp) { 679 if (fp)
682 nfs4_put_deleg_lease(fp); 680 nfs4_put_deleg_lease(fp);
683 dp->dl_file = NULL;
684 }
685 spin_unlock(&state_lock); 681 spin_unlock(&state_lock);
686 if (fp)
687 put_nfs4_file(fp);
688} 682}
689 683
690static void destroy_revoked_delegation(struct nfs4_delegation *dp) 684static void destroy_revoked_delegation(struct nfs4_delegation *dp)
@@ -892,12 +886,12 @@ static void unhash_generic_stateid(struct nfs4_ol_stateid *stp)
892static void close_generic_stateid(struct nfs4_ol_stateid *stp) 886static void close_generic_stateid(struct nfs4_ol_stateid *stp)
893{ 887{
894 release_all_access(stp); 888 release_all_access(stp);
895 put_nfs4_file(stp->st_file);
896 stp->st_file = NULL;
897} 889}
898 890
899static void free_generic_stateid(struct nfs4_ol_stateid *stp) 891static void free_generic_stateid(struct nfs4_ol_stateid *stp)
900{ 892{
893 if (stp->st_file)
894 put_nfs4_file(stp->st_file);
901 remove_stid(&stp->st_stid); 895 remove_stid(&stp->st_stid);
902 nfs4_free_stid(stateid_slab, &stp->st_stid); 896 nfs4_free_stid(stateid_slab, &stp->st_stid);
903} 897}
@@ -4469,6 +4463,10 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)
4469 if (list_empty(&oo->oo_owner.so_stateids)) 4463 if (list_empty(&oo->oo_owner.so_stateids))
4470 release_openowner(oo); 4464 release_openowner(oo);
4471 } else { 4465 } else {
4466 if (s->st_file) {
4467 put_nfs4_file(s->st_file);
4468 s->st_file = NULL;
4469 }
4472 oo->oo_last_closed_stid = s; 4470 oo->oo_last_closed_stid = s;
4473 /* 4471 /*
4474 * In the 4.0 case we need to keep the owners around a 4472 * In the 4.0 case we need to keep the owners around a