Message ID | 20110410162056.GB26233@fieldses.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
J. Bruce Fields: > On Tue, Mar 29, 2011 at 11:41:39AM +0800, Mi Jinlong wrote: >> >> J. Bruce Fields: >>> On Mon, Mar 28, 2011 at 03:15:09PM +0800, Mi Jinlong wrote: >>>> >>>> Content-Type: text/plain; charset=ISO-2022-JP >>>> Content-Transfer-Encoding: 7bit >>> Thanks, Mi Jinlong, the analysis is helpful, but I don't think your fix >>> is right. >>> >>> I think the problem here is basically that the cleanup on exit from >>> nfsd4_lock() may have to deal with a lock stateid that is partially >>> initialized, in that everything has been setup except the stuff that's >>> done by get_lock_access(). >> You are right. >> >>> Maybe something like this?? But I'm not able to test right now. >>> >>> --b. >>> >>> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c >>> index fbde6f7..9e8ef31 100644 >>> --- a/fs/nfsd/nfs4state.c >>> +++ b/fs/nfsd/nfs4state.c >>> @@ -397,10 +397,13 @@ static void unhash_generic_stateid(struct nfs4_stateid *stp) >>> >>> static void free_generic_stateid(struct nfs4_stateid *stp) >>> { >>> - int oflag = nfs4_access_bmap_to_omode(stp); >>> + int oflag; >>> >>> - nfs4_file_put_access(stp->st_file, oflag); >>> - put_nfs4_file(stp->st_file); >>> + if (stp->st_access_bmap) { >>> + nfs4_access_bmap_to_omode(stp); >> This line should be >> >> oflag = nfs4_access_bmap_to_omode(stp); >> >> otherwise, uninitialized oflag will be used at the next line. >> >> After this patch, kernel runs correctly! > > So you tested something like this?--b. Yes, I have test this patch again, that's OK.
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index fbde6f7..8e3c407 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -397,10 +397,13 @@ static void unhash_generic_stateid(struct nfs4_stateid *stp) static void free_generic_stateid(struct nfs4_stateid *stp) { - int oflag = nfs4_access_bmap_to_omode(stp); + int oflag; - nfs4_file_put_access(stp->st_file, oflag); - put_nfs4_file(stp->st_file); + if (stp->st_access_bmap) { + oflag = nfs4_access_bmap_to_omode(stp); + nfs4_file_put_access(stp->st_file, oflag); + put_nfs4_file(stp->st_file); + } kmem_cache_free(stateid_slab, stp); }