3552 condensing one space map burns 3 seconds of CPU in spa_sync() threa...

...d (fix race condition)

Ported-by: Richard Yao <ryao@gentoo.org>

References:
https://www.illumos.org/issues/3552
illumos/illumos-gate@03f8c366886542ed249a15d755ae78ea4e775d9d

Porting notes:

This fixes an upstream regression that was introduced in
zfsonlinux/zfs@e51be06697762215dc3b679f8668987034a5a048, which ported
the Illumos 3552 changes. This fix was added to upstream rather quickly,
but at the time of the port, no one spotted it and the race was rare
enough that it passed our regression test. I discovered this when
comparing our metaslab.c to the illumos metaslab.c.

Closes:
zfsonlinux/zfs#1687
zfsonlinux/zfs#1720
zfsonlinux/zfs#1747