Add ddt_object_count() error handling
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 26 Oct 2012 17:01:49 +0000 (10:01 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 29 Oct 2012 15:57:45 +0000 (08:57 -0700)
commite8fd45a0f975c6b8ae8cd644714fc21f14fac2bf
tree59aa8971d8aba6dcd8b173d630ffb71b61e8e573
parent178e73b376297be44253f7655cd8cba3cf082171
Add ddt_object_count() error handling

The interface for the ddt_zap_count() function assumes it can
never fail.  However, internally ddt_zap_count() is implemented
with zap_count() which can potentially fail.  Now because there
was no way to return the error to the caller a VERIFY was used
to ensure this case never happens.

Unfortunately, it has been observed that pools can be damaged in
such a way that zap_count() fails.  The result is that the pool can
not be imported without hitting the VERIFY and crashing the system.

This patch reworks ddt_object_count() so the error can be safely
caught and returned to the caller.  This allows a pool which has
be damaged in this way to be safely rewound for import.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #910
cmd/zdb/zdb.c
include/sys/ddt.h
module/zfs/ddt.c
module/zfs/ddt_zap.c