freebsd-nq/sys/ufs/ffs
Kirk McKusick d2a28cb080 The bread() function was inconsistent about whether it would return
a buffer pointer in the event of an error (for some errors it would
return a buffer pointer and for other errors it would not return a
buffer pointer). The cluster_read() function was similarly inconsistent.

Clients of these functions were inconsistent in handling errors.
Some would assume that no buffer was returned after an error and
would thus lose buffers under certain error conditions. Others would
assume that brelse() should always be called after an error and
would thus panic the system under certain error conditions.

To correct both of these problems with minimal code churn, bread()
and cluster_write() now always free the buffer when returning an
error thus ensuring that buffers will never be lost. The brelse()
routine checks for being passed a NULL buffer pointer and silently
returns to avoid panics. Thus both approaches to handling error
returns from bread() and cluster_read() will work correctly.

Future code should be written assuming that bread() and cluster_read()
will never return a buffer with an error, so should not attempt to
brelse() the buffer when an error is returned.

Reviewed by: kib
2016-01-27 21:23:01 +00:00
..
ffs_alloc.c Do not relocate extents to make them contiguous if the underlying drive can do 2015-10-16 03:06:02 +00:00
ffs_balloc.c Do not perform read-ahead for BA_CLRBUF request when we are low on 2015-10-27 13:44:13 +00:00
ffs_extern.h ufs: small formatting fixes. 2014-03-02 02:52:34 +00:00
ffs_inode.c The bread() function was inconsistent about whether it would return 2016-01-27 21:23:01 +00:00
ffs_rawread.c Refactor unmapped buffer address handling. 2015-07-23 19:13:41 +00:00
ffs_snapshot.c The VOP_LOOKUP() implementations for CREATE op do not put the name 2014-12-18 10:01:12 +00:00
ffs_softdep.c Recheck curthread->td_su after the VFS_SYNC() call, and re-sync if the 2015-12-21 11:50:32 +00:00
ffs_subr.c - Make 'struct buf *buf' private to vfs_bio.c. Having a global variable 2015-07-29 02:26:57 +00:00
ffs_suspend.c Remove several write-only variables, all reported by the gcc 4.9 2015-05-29 13:24:17 +00:00
ffs_tables.c
ffs_vfsops.c For performance reasons, it is useful to have a single string used as 2015-11-29 21:01:02 +00:00
ffs_vnops.c Refactor unmapped buffer address handling. 2015-07-23 19:13:41 +00:00
fs.h ufs: small formatting fixes. 2014-03-02 02:52:34 +00:00
softdep.h When mounting SU-enabled mount point, wait until the softdep_flush() 2015-01-30 11:41:46 +00:00