nfsd: fix bug on nfs4 stateid deallocation
authorycnian@gmail.com <ycnian@gmail.com>
Mon, 11 Mar 2013 00:46:14 +0000 (08:46 +0800)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 3 Apr 2013 15:48:34 +0000 (11:48 -0400)
NFS4_OO_PURGE_CLOSE is not handled properly. To avoid memory leak, nfs4
stateid which is pointed by oo_last_closed_stid is freed in nfsd4_close(),
but NFS4_OO_PURGE_CLOSE isn't cleared meanwhile. So the stateid released in
THIS close procedure may be freed immediately in the coming encoding function.
Sorry that Signed-off-by was forgotten in last version.

Signed-off-by: Yanchuan Nian <ycnian@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4state.c

index baf314a950b8421fc637a94ceb1504f3b12f6321..aac878ecabc4c1d9bcd599671cb006d5d6bdb061 100644 (file)
@@ -3823,6 +3823,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 
        nfsd4_close_open_stateid(stp);
        release_last_closed_stateid(oo);
+       oo->oo_flags &= ~NFS4_OO_PURGE_CLOSE;
        oo->oo_last_closed_stid = stp;
 
        if (list_empty(&oo->oo_owner.so_stateids)) {