From 932d0a40cf41c443be4cd15cf1b7e3681b989c0c Mon Sep 17 00:00:00 2001
From: Corey Farrell <git@cfware.com>
Date: Tue, 2 Oct 2018 18:15:47 -0400
Subject: [PATCH] astobj2: Comment on OBJ_NOLOCK in ao2_container_clone.

The test for OBJ_NOLOCK looks wrong but it isn't.  Add comments to
prevent confusion.

Change-Id: I9662b82eb39e7627a1f1944fd18f967a2b987344
---
 main/astobj2_container.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/main/astobj2_container.c b/main/astobj2_container.c
index 9bea58f74d..51978674e1 100644
--- a/main/astobj2_container.c
+++ b/main/astobj2_container.c
@@ -718,6 +718,9 @@ struct ao2_container *__ao2_container_clone(struct ao2_container *orig, enum sea
 		return NULL;
 	}
 
+	/* This test is correct.  clone must be locked before calling
+	 * ao2_container_dup when the OBJ_NOLOCK flag is set, otherwise
+	 * we could have errors in __adjust_lock. */
 	if (flags & OBJ_NOLOCK) {
 		ao2_wrlock(clone);
 	}
-- 
GitLab