NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/46282: 6.0_BETA crash: msdosfs_bmap -> pcbmap -> bread -> bio_doread

The following reply was made to PR kern/46282; it has been noted by GNATS.

From: Chuck Silvers <>
Subject: Re: kern/46282: 6.0_BETA crash: msdosfs_bmap -> pcbmap -> bread ->
Date: Sat, 31 Mar 2012 14:25:26 -0700

 On Sat, Mar 31, 2012 at 07:55:04AM +0000, J. Hannken-Illjes wrote:
 >  Please try the attached patch. It replaces bread() with
 >  getblk() / VOP_STRATEGY() and returns an error if getblk() fails.
 I don't think that expanding bread() like this is the way to go.
 several other file systems (nilfs, ntfs, maybe others) also have this problem,
 we don't want a bunch of copies of this all over the place.
 it would be better to make bread() and bio_doread() handle this case.
 there's a wrinkle with that though.  currently bread() always returns
 a buffer via bpp even if it returns an error, and the caller is expected
 to brelse() that buffer.  if getblk() returns NULL then we have no buffer
 for the caller to brelse().  the best thing to do would be to change things
 so that if bread() returns an error, bread() takes care of brelse()ing
 the buffer (if any) instead of the caller doing it.  that means changing
 all ~140 callers, but it's a pretty straightforward change.

Home | Main Index | Thread Index | Old Index