core.c: Clean distribution tree structures on IBV_EVENT_SM_CHANGE event

Distribution tree is cleaned when losing "MASTER" status and
when becoming "MASTER". If the IB port on core node was down,
SM could recieve IBV_EVENT_SM_CHANGE only when it becomes "MASTER".

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>