projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: keep ust/kernel session items around for destroy notifier
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
save.c
diff --git
a/src/bin/lttng-sessiond/save.c
b/src/bin/lttng-sessiond/save.c
index 8daf870c270395ab3675b6eb35a15db81c8f3168..00cdd9364d5f4ff6c7b438debfb66972b9084e4b 100644
(file)
--- a/
src/bin/lttng-sessiond/save.c
+++ b/
src/bin/lttng-sessiond/save.c
@@
-2284,8
+2284,7
@@
static
int save_session(struct ltt_session *session,
struct lttng_save_session_attr *attr, lttng_sock_cred *creds)
{
int save_session(struct ltt_session *session,
struct lttng_save_session_attr *attr, lttng_sock_cred *creds)
{
- int ret, fd;
- unsigned int file_opened = 0; /* Indicate if the file has been opened */
+ int ret, fd = -1;
char config_file_path[PATH_MAX];
size_t len;
struct config_writer *writer = NULL;
char config_file_path[PATH_MAX];
size_t len;
struct config_writer *writer = NULL;
@@
-2301,7
+2300,7
@@
int save_session(struct ltt_session *session,
if (!session_access_ok(session,
LTTNG_SOCK_GET_UID_CRED(creds),
if (!session_access_ok(session,
LTTNG_SOCK_GET_UID_CRED(creds),
- LTTNG_SOCK_GET_GID_CRED(creds))) {
+ LTTNG_SOCK_GET_GID_CRED(creds))
|| session->destroyed
) {
ret = LTTNG_ERR_EPERM;
goto end;
}
ret = LTTNG_ERR_EPERM;
goto end;
}
@@
-2378,7
+2377,6
@@
int save_session(struct ltt_session *session,
ret = LTTNG_ERR_SAVE_IO_FAIL;
goto end;
}
ret = LTTNG_ERR_SAVE_IO_FAIL;
goto end;
}
- file_opened = 1;
writer = config_writer_create(fd, 1);
if (!writer) {
writer = config_writer_create(fd, 1);
if (!writer) {
@@
-2492,12
+2490,12
@@
end:
}
if (ret) {
/* Delete file in case of error */
}
if (ret) {
/* Delete file in case of error */
- if (
file_opened
&& unlink(config_file_path)) {
+ if (
(fd >= 0)
&& unlink(config_file_path)) {
PERROR("Unlinking XML session configuration.");
}
}
PERROR("Unlinking XML session configuration.");
}
}
- if (f
ile_opened
) {
+ if (f
d >= 0
) {
ret = close(fd);
if (ret) {
PERROR("Closing XML session configuration");
ret = close(fd);
if (ret) {
PERROR("Closing XML session configuration");
@@
-2527,6
+2525,7
@@
int cmd_save_sessions(struct lttng_save_session_attr *attr,
session_lock(session);
ret = save_session(session, attr, creds);
session_unlock(session);
session_lock(session);
ret = save_session(session, attr, creds);
session_unlock(session);
+ session_put(session);
if (ret) {
goto end;
}
if (ret) {
goto end;
}
@@
-2534,10
+2533,13
@@
int cmd_save_sessions(struct lttng_save_session_attr *attr,
struct ltt_session_list *list = session_get_list();
cds_list_for_each_entry(session, &list->head, list) {
struct ltt_session_list *list = session_get_list();
cds_list_for_each_entry(session, &list->head, list) {
+ if (!session_get(session)) {
+ continue;
+ }
session_lock(session);
ret = save_session(session, attr, creds);
session_unlock(session);
session_lock(session);
ret = save_session(session, attr, creds);
session_unlock(session);
-
+ session_put(session);
/* Don't abort if we don't have the required permissions. */
if (ret && ret != LTTNG_ERR_EPERM) {
goto end;
/* Don't abort if we don't have the required permissions. */
if (ret && ret != LTTNG_ERR_EPERM) {
goto end;
This page took
0.028382 seconds
and
4
git commands to generate.