Properly lock slave and master in zt_unlink (bug #1008)