Add zio constructor/destructor
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 23 Feb 2012 23:32:51 +0000 (15:32 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 21 Mar 2012 21:51:44 +0000 (14:51 -0700)
commit49be0ccf1fdc2ce852271d4d2f8b7a9c2c4be6db
treeaed0f86abdf017fc9edb8593895aef671597cfd7
parentc8df41538db3723edf3536379a78fbaf68f037d0
Add zio constructor/destructor

Add a standard zio constructor and destructor.  Normally, this is
done to reduce to cost of allocating a new structure by reducing
expensive operations such as memory allocations.  However, in this
case none of the operations moved out of zio_create() were really
very expensive.

This change was principly made as a debug patch (and workaround)
for a zio_destroy() race.  The is good evidence that zio_create()
is reinitializing a mutex which is really still in use by another
thread.  This would completely explain the observed symptoms in
the issue report.

This patch doesn't fix the root cause of the race, but it should
make it less likely by only initializing the mutex once in the
constructor.  Also, this particular flaw might have gone unnoticed
in other zfs implementations due to the specific implementation
details of Linux ticket spinlocks.

Once the real root cause is determined and resolved this change
can be safely reverted.  Until then this should help workaround
the issue.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #496
module/zfs/zio.c