zfsonlinux/zfs — pull request #2290 by ryao (2014-05-01 19:14:02+00:00)
Title: Fix use of uninitialized where in zfs_range_add_reader

Under certain circumstances, zfs_range_add_reader will pass an
uninitialized where from avl_find() to avl_nearest(), which triggers
undefined behavior. When assertions are enabled, the where is
initialized to 0, which triggers an assertion:

SPLError: 31638:0:(avl.c:222:avl_nearest()) ASSERTION(tree->avl_root == NULL) failed

In this situation, we must also call avl_add() instead of avl_insert(),
or a similar failure should result.

Signed-off-by: Richard Yao