Просмотр исходного кода

logsys: Properly lock flt data before dump

Data needs to be locked, otherwise resulting fdata file may be
incorrect.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
Jan Friesse 15 лет назад
Родитель
Сommit
c5e8237325
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      exec/logsys.c

+ 4 - 0
exec/logsys.c

@@ -1617,6 +1617,8 @@ int logsys_log_rec_store (const char *filename)
 		return (-1);
 		return (-1);
 	}
 	}
 
 
+	logsys_flt_lock();
+
 	this_write_size = write (fd, &flt_data_size, sizeof(uint32_t));
 	this_write_size = write (fd, &flt_data_size, sizeof(uint32_t));
 	if (this_write_size != sizeof(unsigned int)) {
 	if (this_write_size != sizeof(unsigned int)) {
 		goto error_exit;
 		goto error_exit;
@@ -1643,10 +1645,12 @@ int logsys_log_rec_store (const char *filename)
 		goto error_exit;
 		goto error_exit;
 	}
 	}
 
 
+	logsys_flt_unlock();
 	close (fd);
 	close (fd);
 	return (0);
 	return (0);
 
 
 error_exit:
 error_exit:
+	logsys_flt_unlock();
 	close (fd);
 	close (fd);
 	return (-1);
 	return (-1);
 }
 }