freebsd-dev/sys/ufs/ffs
Konstantin Belousov b2c3df842b Handle errors from background write of the cylinder group blocks.
First, on the write error, bufdone() call from ffs_backgroundwrite()
panics because pbrelvp() cleared bp->b_bufobj, while brelse() would
try to re-dirty the copy of the cg buffer.  Handle this by setting
B_INVAL for the case of BIO_ERROR.

Second, we must re-dirty the real buffer containing the cylinder group
block data when background write failed.  Real cg buffer was already
marked clean in ffs_bufwrite(). After the BV_BKGRDINPROG flag is
cleared on the real cg buffer in ffs_backgroundwrite(), buffer scan
may reuse the buffer at any moment. The result is lost write, and if
the write error was only transient, we get corrupted bitmaps.

We cannot re-dirty the original cg buffer in the
ffs_backgroundwritedone(), since the context is not sleepable,
preventing us from sleeping for origbp' lock.  Add BV_BKGDERR flag
(protected by the buffer object lock), which is converted into delayed
write by brelse(), bqrelse() and buffer scan.

In collaboration with:	Conrad Meyer <cse.cem@gmail.com>
Reviewed by:	mckusick
Sponsored by:	The FreeBSD Foundation (kib),
	  EMC/Isilon storage division (Conrad)
MFC after:	2 weeks
2015-06-27 09:44:14 +00:00
..
ffs_alloc.c Replace struct filedesc argument in getvnode with struct thread 2015-06-16 13:09:18 +00:00
ffs_balloc.c ufs: small formatting fixes. 2014-03-02 02:52:34 +00:00
ffs_extern.h ufs: small formatting fixes. 2014-03-02 02:52:34 +00:00
ffs_inode.c - Convert the bufobj lock to rwlock. 2013-05-31 00:43:41 +00:00
ffs_rawread.c Initialize the pbuf counter for directio using SYSINIT, instead of 2014-06-08 10:55:06 +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 Remove unused variable. 2015-05-31 15:50:54 +00:00
ffs_subr.c
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 Handle errors from background write of the cylinder group blocks. 2015-06-27 09:44:14 +00:00
ffs_vnops.c Syncing a directory vnode might drop the vnode lock in the 2015-06-03 20:48:00 +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