Subject: kern/1448: Undefined behaviour of bread in case of error
To: None <>
From: Wolfgang Solfrank <>
List: netbsd-bugs
Date: 09/10/1995 16:49:33
>Number:         1448
>Category:       kern
>Synopsis:       Undefined behaviour of bread in case of error
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 11 21:20:06 1995
>Originator:     Wolfgang Solfrank
>Release:        NetBSD-current as of 09 Sep 95

System: NetBSD 1.0A NetBSD 1.0A (charles) #129: Sat Sep 9 21:28:49 MET DST 1995 ws@kurt:/files/NetBSD/kernel/NetBSD/sys/arch/i386/compile/charles i386


The expected behaviour of bread in case of error is unclear. There are
conflicting uses even in ffs, even in one single source file, e.g. in

In e.g. ffs_reload the code reads:

	if (error = bread(..., &bp))
		return (error);

without further manipulation of the buffer pointed to by bp.

At some other point, e.g. ffs_vget, it reads:

	if (error = bread(..., &bp)) {
		return (error);

So it's unclear, whether bread should return the buffer B_BUSY or not.
The current implementation does indeed the former.


Be unlucky and get an I/O error in one of the places similar to the first
example above. After that you are unable to unmount the filesystem in question
(or to do a standard reboot).


My personal preference is for bread to not return the buffer in case of error.
But that's a matter of taste (mainly).

Anyway, the error cases of bread usages in all filesystems need some