changeset 614:be5d61e30d01

objstore: unqualified open should check the number of heads not versions Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Thu, 15 Nov 2018 15:50:05 -0500
parents 0e7e00acfe88
children 7476345dbe01
files src/objstore/obj.c
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/objstore/obj.c	Thu Nov 15 17:24:12 2018 -0500
+++ b/src/objstore/obj.c	Thu Nov 15 15:50:05 2018 -0500
@@ -333,15 +333,14 @@
 		ver = __fetch_ver(obj, clock);
 		if (!IS_ERR(ver))
 			return ver;
-	} else if (obj->nversions == 1) {
+	} else if (rb_numnodes(&obj->heads) == 1) {
 		/*
-		 * We are *not* looking for a specific version, and there is
-		 * only one version available, so we just return that.
-		 * We require that the initobj obj op pre-caches all heads,
-		 * therefore even though obj->versions is only a cache, we
-		 * know that we have the only version and that it is a head.
+		 * We are *not* looking for a specific version, but there is
+		 * only one head, so we return that.  We require that the
+		 * initobj obj op pre-caches all heads, so we are certain
+		 * that there are no other heads that haven't been cached.
 		 */
-		ver = rb_first(&obj->versions);
+		ver = rb_first(&obj->heads);
 
 		ASSERT3P(ver, !=, NULL);