]> git.karo-electronics.de Git - linux-beck.git/commitdiff
nfsd: nfsd4_process_open2() must reference the open stateid
authorTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 30 Jul 2014 01:34:19 +0000 (21:34 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Thu, 31 Jul 2014 18:20:12 +0000 (14:20 -0400)
Ensure that nfsd4_process_open2() keeps a reference to the open
stateid until it is done working with it. Necessary step toward
client_mutex removal.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4state.c

index 5cb6305036cd38aa0b2c0f9a58e6663f8843a930..f3018cb267692043b5f8cd67d8adc7d5a82c6217 100644 (file)
@@ -2996,6 +2996,7 @@ alloc_init_open_stateowner(unsigned int strhashval, struct nfsd4_open *open,
 static void init_open_stateid(struct nfs4_ol_stateid *stp, struct nfs4_file *fp, struct nfsd4_open *open) {
        struct nfs4_openowner *oo = open->op_openowner;
 
+       atomic_inc(&stp->st_stid.sc_count);
        stp->st_stid.sc_type = NFS4_OPEN_STID;
        INIT_LIST_HEAD(&stp->st_locks);
        stp->st_stateowner = &oo->oo_owner;
@@ -3376,6 +3377,7 @@ nfsd4_find_existing_open(struct nfs4_file *fp, struct nfsd4_open *open)
                        continue;
                if (local->st_stateowner == &oo->oo_owner) {
                        ret = local;
+                       atomic_inc(&ret->st_stid.sc_count);
                        break;
                }
        }
@@ -3836,6 +3838,8 @@ out:
                open->op_rflags |= NFS4_OPEN_RESULT_CONFIRM;
        if (dp)
                nfs4_put_stid(&dp->dl_stid);
+       if (stp)
+               nfs4_put_stid(&stp->st_stid);
 
        return status;
 }