Implement locking in new layout

Signed-off-by: Michal Čihař <michal@cihar.com>