uprobes: Introduce uprobe_is_active()
authorOleg Nesterov <oleg@redhat.com>
Sun, 25 Nov 2012 21:01:42 +0000 (22:01 +0100)
committerOleg Nesterov <oleg@redhat.com>
Fri, 8 Feb 2013 16:47:09 +0000 (17:47 +0100)
commit06b7bcd8cbd7eb1af331e437ec3d8f5182ae1b7e
treead2fc6a39d2c5ecfa45f4cd13fd0140839894b52
parent441f1eb7db8babe2b6b4bc805f023739dbb70e33
uprobes: Introduce uprobe_is_active()

The lifetime of uprobe->rb_node and uprobe->inode is not refcounted,
delete_uprobe() is called when we detect that uprobe has no consumers,
and it would be deadly wrong to do this twice.

Change delete_uprobe() to WARN() if it was already called. We use
RB_CLEAR_NODE() to mark uprobe "inactive", then RB_EMPTY_NODE() can
be used to detect this case.

RB_EMPTY_NODE() is not used directly, we add the trivial helper for
the next change.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Anton Arapov <anton@redhat.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
kernel/events/uprobes.c