This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[BUGFIX PATCH] Fix relay_old implementation of fsize_max and fnum_max.


With old relayfs, out_fd is used only when non-bulk mode. However,
open_oldoutfile and open_relayfs_files open files with fopen and
set only percpu_tmpfile. This will cause a problem with -S option,
that out_fd will be closed when the file size reaches fsize_max
and new fd will be opened only on percpu_tmpfile.

So, out_fd should be synchronized with percpu_tmpfile.

* runtime/staprun/relay_old.c (open_oldoutfile): Set fd of output file
  to out_fd[cpu].
  (open_relayfs_files): Ditto.
---

 runtime/staprun/relay_old.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/runtime/staprun/relay_old.c b/runtime/staprun/relay_old.c
index 71d8ace..0254173 100644
--- a/runtime/staprun/relay_old.c
+++ b/runtime/staprun/relay_old.c
@@ -110,7 +110,8 @@ static int open_oldoutfile(int fnum, int cpu, int remove_file)
 		perr("Couldn't open output file %s", buf);
 		return -1;
 	}
-	if (set_clexec(fileno(percpu_tmpfile[cpu])) < 0) {
+	out_fd[cpu] = fileno(percpu_tmpfile[cpu]);
+	if (set_clexec(out_fd[cpu]) < 0) {
 		perr("Couldn't clear exec bit of open output file %s", buf);
 		return -1;
 	}
@@ -181,7 +182,8 @@ static int open_relayfs_files(int cpu, const char *relay_filebase, const char *p
 		perr("Couldn't open output file %s", tmp);
 		goto err2;
 	}
-	if (set_clexec(fileno(percpu_tmpfile[cpu])) < 0) {
+	out_fd[cpu] = fileno(percpu_tmpfile[cpu]);
+	if (set_clexec(out_fd[cpu]) < 0) {
 		perr("Couldn't open output file %s", tmp);
 		goto err2;
 	}


-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]