X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fbuffer-registry.c;h=2df98d7360445b42ae4aba1941cd976d16e6d723;hb=3cc048812bf25b42003b40b6b868b9366faefafb;hp=765294fa4ca33f11fe9b4f331a3c46e4e3bb0ac3;hpb=7972aab22f74b18faa168c0482216a3dd711a075;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/buffer-registry.c b/src/bin/lttng-sessiond/buffer-registry.c index 765294fa4..2df98d736 100644 --- a/src/bin/lttng-sessiond/buffer-registry.c +++ b/src/bin/lttng-sessiond/buffer-registry.c @@ -506,12 +506,14 @@ void buffer_reg_channel_destroy(struct buffer_reg_channel *regp, buffer_reg_stream_destroy(sreg, domain); } - ret = ust_ctl_release_object(-1, regp->obj.ust); - if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { - ERR("Buffer reg channel release obj handle %d failed with ret %d", - regp->obj.ust->handle, ret); + if (regp->obj.ust) { + ret = ust_ctl_release_object(-1, regp->obj.ust); + if (ret < 0 && ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { + ERR("Buffer reg channel release obj handle %d failed with ret %d", + regp->obj.ust->handle, ret); + } + free(regp->obj.ust); } - free(regp->obj.ust); lttng_fd_put(LTTNG_FD_APPS, 1); break; } @@ -525,8 +527,10 @@ void buffer_reg_channel_destroy(struct buffer_reg_channel *regp, /* * Destroy a buffer registry session with the given domain. + * + * Should *NOT* be called with RCU read-side lock held. */ -void buffer_reg_session_destroy(struct buffer_reg_session *regp, +static void buffer_reg_session_destroy(struct buffer_reg_session *regp, enum lttng_domain_type domain) { int ret; @@ -543,9 +547,10 @@ void buffer_reg_session_destroy(struct buffer_reg_session *regp, assert(!ret); buffer_reg_channel_destroy(reg_chan, domain); } - lttng_ht_destroy(regp->channels); rcu_read_unlock(); + lttng_ht_destroy(regp->channels); + switch (domain) { case LTTNG_DOMAIN_UST: ust_registry_session_destroy(regp->reg.ust); @@ -560,8 +565,7 @@ void buffer_reg_session_destroy(struct buffer_reg_session *regp, } /* - * Remove buffer registry UID object from the global hash table. RCU read side - * lock MUST be acquired before calling this. + * Remove buffer registry UID object from the global hash table. */ void buffer_reg_uid_remove(struct buffer_reg_uid *regp) { @@ -570,9 +574,11 @@ void buffer_reg_uid_remove(struct buffer_reg_uid *regp) assert(regp); + rcu_read_lock(); iter.iter.node = ®p->node.node; ret = lttng_ht_del(buffer_registry_uid, &iter); assert(!ret); + rcu_read_unlock(); } static void rcu_free_buffer_reg_uid(struct rcu_head *head) @@ -618,11 +624,12 @@ void buffer_reg_uid_destroy(struct buffer_reg_uid *regp, goto destroy; } + rcu_read_lock(); /* Get the right socket from the consumer object. */ socket = consumer_find_socket_by_bitness(regp->bits_per_long, consumer); if (!socket) { - goto destroy; + goto unlock; } switch (regp->domain) { @@ -635,9 +642,12 @@ void buffer_reg_uid_destroy(struct buffer_reg_uid *regp, break; default: assert(0); + rcu_read_unlock(); return; } +unlock: + rcu_read_unlock(); destroy: call_rcu(®p->node.head, rcu_free_buffer_reg_uid); } @@ -677,6 +687,8 @@ void buffer_reg_pid_destroy(struct buffer_reg_pid *regp) /* * Destroy per PID and UID registry hash table. + * + * Should *NOT* be called with RCU read-side lock held. */ void buffer_reg_destroy_registries(void) {