s3:registry: fix race in reg_setvalue that could lead to data corruption