projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Typo: occured -> occurred
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
cmd.c
diff --git
a/src/bin/lttng-sessiond/cmd.c
b/src/bin/lttng-sessiond/cmd.c
index c2231f1b07f128de561fd1849ed845c00fc91483..a164cffc0fcd8b049f6ea63dcb19fa4a02707933 100644
(file)
--- a/
src/bin/lttng-sessiond/cmd.c
+++ b/
src/bin/lttng-sessiond/cmd.c
@@
-73,6
+73,11
@@
struct cmd_destroy_session_reply_context {
int reply_sock_fd;
bool implicit_rotation_on_destroy;
struct cmd_destroy_session_reply_context {
int reply_sock_fd;
bool implicit_rotation_on_destroy;
+ /*
+ * Indicates whether or not an error occurred while launching the
+ * destruction of a session.
+ */
+ enum lttng_error_code destruction_status;
};
static enum lttng_error_code wait_on_path(void *path);
};
static enum lttng_error_code wait_on_path(void *path);
@@
-3070,7
+3075,7
@@
void cmd_destroy_session_reply(const struct ltt_session *session,
struct lttng_trace_archive_location *location = NULL;
struct lttcomm_lttng_msg llm = {
.cmd_type = LTTNG_DESTROY_SESSION,
struct lttng_trace_archive_location *location = NULL;
struct lttcomm_lttng_msg llm = {
.cmd_type = LTTNG_DESTROY_SESSION,
- .ret_code =
LTTNG_OK
,
+ .ret_code =
reply_context->destruction_status
,
.pid = UINT32_MAX,
.cmd_header_size =
sizeof(struct lttcomm_session_destroy_command_header),
.pid = UINT32_MAX,
.cmd_header_size =
sizeof(struct lttcomm_session_destroy_command_header),
@@
-3152,6
+3157,7
@@
int cmd_destroy_session(struct ltt_session *session,
int *sock_fd)
{
int ret;
int *sock_fd)
{
int ret;
+ enum lttng_error_code destruction_last_error = LTTNG_OK;
struct cmd_destroy_session_reply_context *reply_context = NULL;
if (sock_fd) {
struct cmd_destroy_session_reply_context *reply_context = NULL;
if (sock_fd) {
@@
-3176,6
+3182,7
@@
int cmd_destroy_session(struct ltt_session *session,
/* Carry on with the destruction of the session. */
ERR("Failed to stop session \"%s\" as part of its destruction: %s",
session->name, lttng_strerror(-ret));
/* Carry on with the destruction of the session. */
ERR("Failed to stop session \"%s\" as part of its destruction: %s",
session->name, lttng_strerror(-ret));
+ destruction_last_error = ret;
}
}
}
}
@@
-3184,6
+3191,7
@@
int cmd_destroy_session(struct ltt_session *session,
session)) {
ERR("Failed to stop the \"rotation schedule\" timer of session %s",
session->name);
session)) {
ERR("Failed to stop the \"rotation schedule\" timer of session %s",
session->name);
+ destruction_last_error = LTTNG_ERR_TIMER_STOP_ERROR;
}
}
}
}
@@
-3203,6
+3211,7
@@
int cmd_destroy_session(struct ltt_session *session,
if (ret != LTTNG_OK) {
ERR("Failed to perform an implicit rotation as part of the destruction of session \"%s\": %s",
session->name, lttng_strerror(-ret));
if (ret != LTTNG_OK) {
ERR("Failed to perform an implicit rotation as part of the destruction of session \"%s\": %s",
session->name, lttng_strerror(-ret));
+ destruction_last_error = -ret;
}
if (reply_context) {
reply_context->implicit_rotation_on_destroy = true;
}
if (reply_context) {
reply_context->implicit_rotation_on_destroy = true;
@@
-3221,6
+3230,7
@@
int cmd_destroy_session(struct ltt_session *session,
if (ret != LTTNG_OK) {
ERR("Failed to perform a quiet rotation as part of the destruction of session \"%s\": %s",
session->name, lttng_strerror(-ret));
if (ret != LTTNG_OK) {
ERR("Failed to perform a quiet rotation as part of the destruction of session \"%s\": %s",
session->name, lttng_strerror(-ret));
+ destruction_last_error = -ret;
}
}
}
}
@@
-3285,6
+3295,7
@@
int cmd_destroy_session(struct ltt_session *session,
*/
session_destroy(session);
if (reply_context) {
*/
session_destroy(session);
if (reply_context) {
+ reply_context->destruction_status = destruction_last_error;
ret = session_add_destroy_notifier(session,
cmd_destroy_session_reply,
(void *) reply_context);
ret = session_add_destroy_notifier(session,
cmd_destroy_session_reply,
(void *) reply_context);
@@
-4777,6
+4788,8
@@
int cmd_rotate_session(struct ltt_session *session,
struct lttng_trace_chunk *chunk_being_archived = NULL;
struct lttng_trace_chunk *new_trace_chunk = NULL;
enum lttng_trace_chunk_status chunk_status;
struct lttng_trace_chunk *chunk_being_archived = NULL;
struct lttng_trace_chunk *new_trace_chunk = NULL;
enum lttng_trace_chunk_status chunk_status;
+ bool failed_to_rotate = false;
+ enum lttng_error_code rotation_fail_code = LTTNG_OK;
assert(session);
assert(session);
@@
-4834,7
+4847,13
@@
int cmd_rotate_session(struct ltt_session *session,
}
}
}
}
- /* The current trace chunk becomes the chunk being archived. */
+ /*
+ * The current trace chunk becomes the chunk being archived.
+ *
+ * After this point, "chunk_being_archived" must absolutely
+ * be closed on the consumer(s), otherwise it will never be
+ * cleaned-up, which will result in a leak.
+ */
ret = session_set_trace_chunk(session, new_trace_chunk,
&chunk_being_archived);
if (ret) {
ret = session_set_trace_chunk(session, new_trace_chunk,
&chunk_being_archived);
if (ret) {
@@
-4850,13
+4869,15
@@
int cmd_rotate_session(struct ltt_session *session,
if (session->kernel_session) {
cmd_ret = kernel_rotate_session(session);
if (cmd_ret != LTTNG_OK) {
if (session->kernel_session) {
cmd_ret = kernel_rotate_session(session);
if (cmd_ret != LTTNG_OK) {
- goto error;
+ failed_to_rotate = true;
+ rotation_fail_code = cmd_ret;
}
}
if (session->ust_session) {
cmd_ret = ust_app_rotate_session(session);
if (cmd_ret != LTTNG_OK) {
}
}
if (session->ust_session) {
cmd_ret = ust_app_rotate_session(session);
if (cmd_ret != LTTNG_OK) {
- goto error;
+ failed_to_rotate = true;
+ rotation_fail_code = cmd_ret;
}
}
}
}
@@
-4871,6
+4892,11
@@
int cmd_rotate_session(struct ltt_session *session,
goto error;
}
goto error;
}
+ if (failed_to_rotate) {
+ cmd_ret = rotation_fail_code;
+ goto error;
+ }
+
session->quiet_rotation = quiet_rotation;
ret = timer_session_rotation_pending_check_start(session,
DEFAULT_ROTATE_PENDING_TIMER);
session->quiet_rotation = quiet_rotation;
ret = timer_session_rotation_pending_check_start(session,
DEFAULT_ROTATE_PENDING_TIMER);
@@
-4957,7
+4983,7
@@
int cmd_rotate_get_info(struct ltt_session *session,
switch (rotation_state) {
case LTTNG_ROTATION_STATE_NO_ROTATION:
switch (rotation_state) {
case LTTNG_ROTATION_STATE_NO_ROTATION:
- DBG("Reporting that no rotation has occured within the lifetime of session \"%s\"",
+ DBG("Reporting that no rotation has occur
r
ed within the lifetime of session \"%s\"",
session->name);
goto end;
case LTTNG_ROTATION_STATE_EXPIRED:
session->name);
goto end;
case LTTNG_ROTATION_STATE_EXPIRED:
This page took
0.046125 seconds
and
5
git commands to generate.