From: guijianfeng@cn.fujitsu.com (Gui Jianfeng)
Subject: [ltt-dev] [PATCH] LTTNG: hold markers_mutex during marker section iteration
Date: Wed, 18 Mar 2009 17:35:11 +0800 [thread overview]
Message-ID: <49C0C04F.3090809@cn.fujitsu.com> (raw)
In-Reply-To: <20090314024914.GA22526@Krystal>
Hold the markers_mutex during marker section iteration.
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
next prev parent reply other threads:[~2009-03-18 9:35 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 ` Gui Jianfeng [this message]
2009-03-23 16:54 ` [ltt-dev] [PATCH] LTTNG: hold markers_mutex during marker section iteration Mathieu Desnoyers
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=49C0C04F.3090809@cn.fujitsu.com \
--to=guijianfeng@cn.fujitsu.com \
/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