Blame SOURCES/0021-Load-leases-DB-in-non-replay-mode-only.patch

df4638
commit 50c2b3ba8ce030a47b55dd707bb8a6ab20444a05
df4638
Author: Pavel Zhukov <pzhukov@redhat.com>
df4638
Date:   Thu Feb 21 10:44:06 2019 +0100
df4638
df4638
    Load leases DB in non-replay mode only
df4638
df4638
diff --git a/server/confpars.c b/server/confpars.c
df4638
index 2743979..6b61964 100644
df4638
--- a/server/confpars.c
df4638
+++ b/server/confpars.c
df4638
@@ -134,6 +134,11 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
df4638
 
df4638
 	cfile = (struct parse *)0;
df4638
 #if defined (TRACING)
df4638
+	// No need to dmalloc huge memory region if we're not going to re-play
df4638
+	if (!trace_record()){
df4638
+		status = new_parse(&cfile, file, NULL, 0, filename, 0);
df4638
+		goto noreplay;
df4638
+	};
df4638
 	flen = lseek (file, (off_t)0, SEEK_END);
df4638
 	if (flen < 0) {
df4638
 	      boom:
df4638
@@ -165,7 +170,6 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
df4638
 	if (result != ulen)
df4638
 		log_fatal ("%s: short read of %d bytes instead of %d.",
df4638
 			   filename, ulen, result);
df4638
-	close (file);
df4638
       memfile:
df4638
 	/* If we're recording, write out the filename and file contents. */
df4638
 	if (trace_record ())
df4638
@@ -174,6 +178,9 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
df4638
 #else
df4638
 	status = new_parse(&cfile, file, NULL, 0, filename, 0);
df4638
 #endif
df4638
+      noreplay:
df4638
+	if (!trace_playback())
df4638
+		close (file);
df4638
 	if (status != ISC_R_SUCCESS || cfile == NULL)
df4638
 		return status;
df4638
 
df4638
@@ -183,7 +190,8 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
df4638
 		status = conf_file_subparse (cfile, group, group_type);
df4638
 	end_parse (&cfile);
df4638
 #if defined (TRACING)
df4638
-	dfree (dbuf, MDL);
df4638
+	if (trace_record())
df4638
+	    dfree (dbuf, MDL);
df4638
 #endif
df4638
 	return status;
df4638
 }