Only truncate the dirhash state when directory truncation succeeds.

From FreeBSD commit f1c05bd42b549bdfbd6d418c0bb9c947293d9837
ok pedro@