From: Ingo Molnar <mingo@kernel.org>
To: Milos Vyletel <milos@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@kernel.org>, Don Zickus <dzickus@redhat.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
"Steven Rostedt (Red Hat)" <rostedt@goodmis.org>,
"open list:PERFORMANCE EVENT..." <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] perf tools: avoid possible race condition in copyfile
Date: Thu, 4 Jun 2015 11:11:00 +0200 [thread overview]
Message-ID: <20150604091100.GA19775@gmail.com> (raw)
In-Reply-To: <1433407453-28739-1-git-send-email-milos@redhat.com>
* Milos Vyletel <milos@redhat.com> wrote:
> Use unique temporary files when copying to buildid dir to prevent races
> in case multiple instances are trying to copy same file. This is done by
>
> - creating template in form <path>/.<filename>.XXXXXX where the suffix is
> used by mkstemp() to create unique file
> - change file mode
> - copy content
> - if successful link temp file to target file
> - unlink temp file
>
> At this point the only file left at target path should be the desired
> one either created by us or other instance if we raced. This should also
> prevent not yet fully copied files to be visible to to other perf
> instances that could try to parse them.
>
> On top of that slow_copyfile no longer needs to deal with file mode when
> creating file since temporary file is already created and mode is set.
>
> Signed-off-by: Milos Vyletel <milos@redhat.com>
Ok, that looks nice!
Assuming it passes testing you can add my ack to it:
Acked-by: Ingo Molnar <mingo@kernel.org>
Is there any other place in tools/perf where we are using file locking or racy
shared access to the same file(s)?
Thanks,
Ingo
next prev parent reply other threads:[~2015-06-04 9:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-04 8:44 [PATCH] perf tools: avoid possible race condition in copyfile Milos Vyletel
2015-06-04 9:11 ` Ingo Molnar [this message]
2015-06-04 9:45 ` Milos Vyletel
2015-06-08 13:39 ` Arnaldo Carvalho de Melo
2015-06-08 13:58 ` Milos Vyletel
2015-06-08 14:18 ` Arnaldo Carvalho de Melo
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=20150604091100.GA19775@gmail.com \
--to=mingo@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dzickus@redhat.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=milos@redhat.com \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=rostedt@goodmis.org \
/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