[MERGE] add lock in attach

Signed-off-by: David Goulet <dgoulet@efficios.com>