From: mathieu.desnoyers@polymtl.ca (Mathieu Desnoyers)
Subject: [ltt-dev] [PATCH] LTTNG: hold markers_mutex during marker section iteration
Date: Mon, 23 Mar 2009 12:54:20 -0400 [thread overview]
Message-ID: <20090323165420.GB24084@Krystal> (raw)
In-Reply-To: <49C0C04F.3090809@cn.fujitsu.com>
* Gui Jianfeng (guijianfeng at cn.fujitsu.com) wrote:
> Hold the markers_mutex during marker section iteration.
>
Will merge, thanks !
Mathieu
> Signed-off-by: Gui Jianfeng <guijianfeng at cn.fujitsu.com>
> ---
> kernel/marker.c | 2 ++
> ltt/ltt-trace-control.c | 12 ++++++++++++
> 2 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/marker.c b/kernel/marker.c
> index 7d11393..93ffa8e 100644
> --- a/kernel/marker.c
> +++ b/kernel/marker.c
> @@ -44,11 +44,13 @@ void lock_markers(void)
> {
> mutex_lock(&markers_mutex);
> }
> +EXPORT_SYMBOL_GPL(lock_markers);
>
> void unlock_markers(void)
> {
> mutex_unlock(&markers_mutex);
> }
> +EXPORT_SYMBOL_GPL(unlock_markers);
>
> /*
> * Marker hash table, containing the active markers.
> diff --git a/ltt/ltt-trace-control.c b/ltt/ltt-trace-control.c
> index c1c44c6..63cbb29 100644
> --- a/ltt/ltt-trace-control.c
> +++ b/ltt/ltt-trace-control.c
> @@ -846,6 +846,8 @@ static ssize_t marker_info_read(struct file *filp, char __user *ubuf,
> len = 0;
> buf = (char *)__get_free_page(GFP_KERNEL);
>
> + lock_markers();
> +
> marker_iter_reset(&iter);
> marker_iter_start(&iter);
> for (; iter.marker != NULL; marker_iter_next(&iter)) {
> @@ -872,6 +874,8 @@ static ssize_t marker_info_read(struct file *filp, char __user *ubuf,
> }
> marker_iter_stop(&iter);
>
> + unlock_markers();
> +
> if (len >= PAGE_SIZE) {
> len = PAGE_SIZE;
> buf[PAGE_SIZE] = '\0';
> @@ -958,6 +962,8 @@ static int build_marker_control_files(void)
> if (!markers_control_dir)
> return -EEXIST;
>
> + lock_markers();
> +
> marker_iter_reset(&iter);
> marker_iter_start(&iter);
> for (; iter.marker != NULL; marker_iter_next(&iter)) {
> @@ -966,6 +972,9 @@ static int build_marker_control_files(void)
> goto err_build_fail;
> }
> marker_iter_stop(&iter);
> +
> + unlock_markers();
> +
> return 0;
>
> err_build_fail:
> @@ -991,6 +1000,8 @@ static int remove_marker_control_dir(struct module *mod, struct marker *marker)
> return -ENOENT;
> name = marker_d->d_name.name;
>
> + lock_markers();
> +
> marker_iter_reset(&iter);
> marker_iter_start(&iter);
> for (; iter.marker != NULL; marker_iter_next(&iter)) {
> @@ -1008,6 +1019,7 @@ static int remove_marker_control_dir(struct module *mod, struct marker *marker)
>
> end:
> marker_iter_stop(&iter);
> + unlock_markers();
> return 0;
> }
>
> --
> 1.5.4.rc3
>
>
>
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
prev parent reply other threads:[~2009-03-23 16:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-13 1:44 [ltt-dev] [PATCH v2] LTTNG: Make marker enabled in advance Gui Jianfeng
2009-03-14 2:49 ` Mathieu Desnoyers
2009-03-16 2:52 ` Gui Jianfeng
2009-03-16 11:13 ` Gui Jianfeng
2009-03-16 12:26 ` Mathieu Desnoyers
2009-03-18 9:35 ` [ltt-dev] [PATCH] LTTNG: hold markers_mutex during marker section iteration Gui Jianfeng
2009-03-23 16:54 ` Mathieu Desnoyers [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090323165420.GB24084@Krystal \
--to=mathieu.desnoyers@polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox