From: Sunil Mushran <sunil.mushran@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] BUG? a racy code at o2hb_heartbeat_group_drop_item()
Date: Tue, 17 Aug 2010 10:31:27 -0700 [thread overview]
Message-ID: <4C6AC76F.2030308@oracle.com> (raw)
In-Reply-To: <AANLkTim-tiG_K4mF4ymEoQu6Sug9fjUvq-KNHr9G65Hh@mail.gmail.com>
On 08/17/2010 05:51 AM, ?? shin hong wrote:
> Hello. I am reporting an atomic instructions usage
> which seem be racy at fs/ocfs2/cluster/heartbeat.c in Linux 2.6.35.
>
> I am reporting this issue while I read the recent code.
> Since I do not have much background, I am not certain whether it is
> correct or not.
> But I hope this report is helpful. Please examine the code.
>
> In o2hb_heartbeat_group_drop_item(), there are following codes:
>
> 1626 if (atomic_read(®->hr_steady_iterations) != 0) {
> 1627 atomic_set(®->hr_steady_iterations, 0);
>
>
> It first checks®->hr_steady_iterations and then updates its value.
>
> In the case where other threads manipulate the same
> ®->hr_steady_iterations concurrently,
> race condition might be possible.
>
> I think it would be better to guarantee consecutive executions of
> read and write by special purposed atomic operations (e.g. atomic_xchg)
>
> Please examine the issue and let me know your opinion. Thank you.
>
This should be safe. The only thread that could be decrementing
hr_steady_iterations is stopped before this check.
prev parent reply other threads:[~2010-08-17 17:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-17 12:51 [Ocfs2-devel] BUG? a racy code at o2hb_heartbeat_group_drop_item() 홍신 shin hong
2010-08-17 17:31 ` Sunil Mushran [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=4C6AC76F.2030308@oracle.com \
--to=sunil.mushran@oracle.com \
--cc=ocfs2-devel@oss.oracle.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;
as well as URLs for NNTP newsgroup(s).