unregister event when FD is closed
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 18 May 2011 15:22:05 +0000 (11:22 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 18 May 2011 15:22:05 +0000 (11:22 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
ltt-debugfs-abi.c
ltt-events.c
ltt-events.h

index 7c9f88ab98d0ed98bf26a0018208d56183b57963..403657e6c4c6b86107b06eb8c8631ddcc7582516 100644 (file)
@@ -520,8 +520,10 @@ int lttng_event_release(struct inode *inode, struct file *file)
 {
        struct ltt_event *event = file->private_data;
 
-       if (event)
+       if (event) {
+               ltt_event_unregister(event);
                fput(event->chan->file);
+       }
        return 0;
 }
 
index 1aadd9f37faffafef8776bf23abc5d4726238693..73ea08ea843eff4252277bc4a4d70dc8908e51f1 100644 (file)
@@ -22,6 +22,8 @@ static LIST_HEAD(ltt_transport_list);
 static DEFINE_MUTEX(sessions_mutex);
 static struct kmem_cache *event_cache;
 
+static void _ltt_event_destroy(struct ltt_event *event);
+static int _ltt_event_unregister(struct ltt_event *event);
 static
 int _ltt_event_metadata_statedump(struct ltt_session *session,
                                  struct ltt_channel *chan,
@@ -277,9 +279,23 @@ int _ltt_event_unregister(struct ltt_event *event)
        return ret;
 }
 
+/*
+ * Used when an event FD is released.
+ */
+int ltt_event_unregister(struct ltt_event *event)
+{
+       int ret;
+
+       mutex_lock(&sessions_mutex);
+       ret = ltt_event_unregister(event);
+       mutex_unlock(&sessions_mutex);
+       return ret;
+}
+
 /*
  * Only used internally at session destruction.
  */
+static
 void _ltt_event_destroy(struct ltt_event *event)
 {
        ltt_event_put(event->desc);
index a5eab5b8b7ca1fecf5ed681282be8a1b08aee123..0911a5ef300a1311d0ef6c2ec1a83ac6255b385d 100644 (file)
@@ -212,8 +212,7 @@ struct ltt_event *ltt_event_create(struct ltt_channel *chan,
                                   enum instrum_type itype,
                                   const struct lttng_event_desc *event_desc,
                                   void *filter);
-int _ltt_event_unregister(struct ltt_event *event);
-void _ltt_event_destroy(struct ltt_event *event);
+int ltt_event_unregister(struct ltt_event *event);
 
 void ltt_transport_register(struct ltt_transport *transport);
 void ltt_transport_unregister(struct ltt_transport *transport);
This page took 0.027826 seconds and 4 git commands to generate.