Jelajahi Sumber

totemknet: Don't mix corosync and knet error codes

And use correct return code in stats.c.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Jan Friesse 6 tahun lalu
induk
melakukan
380b744ec8
2 mengubah file dengan 9 tambahan dan 2 penghapusan
  1. 1 1
      exec/stats.c
  2. 8 1
      exec/totemknet.c

+ 1 - 1
exec/stats.c

@@ -326,7 +326,7 @@ cs_error_t stats_map_get(const char *key_name,
 			break;
 			break;
 		case STAT_KNET_HANDLE:
 		case STAT_KNET_HANDLE:
 			res = totemknet_handle_get_stats(&knet_handle_stats);
 			res = totemknet_handle_get_stats(&knet_handle_stats);
-			if (res) {
+			if (res != CS_OK) {
 				return res;
 				return res;
 			}
 			}
 			stats_map_set_value(statinfo, &knet_handle_stats, value, value_len, type);
 			stats_map_set_value(statinfo, &knet_handle_stats, value, value_len, type);

+ 8 - 1
exec/totemknet.c

@@ -1515,12 +1515,19 @@ int totemknet_link_get_status (
 int totemknet_handle_get_stats (
 int totemknet_handle_get_stats (
 	struct knet_handle_stats *stats)
 	struct knet_handle_stats *stats)
 {
 {
+	int res;
+
 	/* We are probably not using knet */
 	/* We are probably not using knet */
 	if (!global_instance) {
 	if (!global_instance) {
 		return CS_ERR_NOT_EXIST;
 		return CS_ERR_NOT_EXIST;
 	}
 	}
 
 
-	return knet_handle_get_stats(global_instance->knet_handle, stats, sizeof(struct knet_handle_stats));
+	res = knet_handle_get_stats(global_instance->knet_handle, stats, sizeof(struct knet_handle_stats));
+	if (res != 0) {
+		return (qb_to_cs_error(-errno));
+	}
+
+	return CS_OK;
 }
 }
 
 
 static void timer_function_merge_detect_timeout (
 static void timer_function_merge_detect_timeout (