HAMMER VFS - Reorganize the use of hammer_del_buffers(), fix rare deadlocks
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 26 Jan 2009 06:34:42 +0000 (22:34 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 26 Jan 2009 06:34:42 +0000 (22:34 -0800)
commit362ec2dc8da3cf56732007d509fadaf1808abe5c
tree1d09a339492b994c9d28c97e5e17cd4b0876aaf1
parent19168d41f0ee9eace4a412c47e3e9b412746c064
HAMMER VFS - Reorganize the use of hammer_del_buffers(), fix rare deadlocks

The previous attempt at fixing a deadlock due to a hammer_buffer being
held cached across long-blocking procedures failed to catch all cases.
Implement a more complete and less invasive fix.  These buffers are
typically held in the hammer_cursor structure.

Instead of trying to release such cached data buffers proactively,
we instead allow hammer_del_buffers() to return a temporary failure when
called from the reservation code.  If hammer_del_buffers() is unable to
completely eradicate underlying buffers due to them being referenced via
the above cache entities the related hammer_reserve structure is simply
re-added to the delayed-release queue.

The related big-block are thus not reused until all such cached entites
have been dereferenced.  The relaxed requirements on the cached entities
removes the possibility of a deadlock in the invalidation code and also
simplifies hammer_io_inval()'s handling of the hammer_buffer<->buffer_cache
coupling case.
sys/vfs/hammer/hammer.h
sys/vfs/hammer/hammer_blockmap.c
sys/vfs/hammer/hammer_cursor.c
sys/vfs/hammer/hammer_io.c
sys/vfs/hammer/hammer_ondisk.c