ocfs2-devel.oss.oracle.com archive mirror
 help / color / mirror / Atom feed
From: "홍신 shin hong" <hongshin@gmail.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 21:51:06 +0900	[thread overview]
Message-ID: <AANLkTim-tiG_K4mF4ymEoQu6Sug9fjUvq-KNHr9G65Hh@mail.gmail.com> (raw)

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(&reg->hr_steady_iterations) != 0) {
1627                atomic_set(&reg->hr_steady_iterations, 0);


It first checks &reg->hr_steady_iterations and then updates its value.

In the case where other threads manipulate the same
&reg->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.

Sincerely
Shin Hong

             reply	other threads:[~2010-08-17 12:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-17 12:51 홍신 shin hong [this message]
2010-08-17 17:31 ` [Ocfs2-devel] BUG? a racy code at o2hb_heartbeat_group_drop_item() Sunil Mushran

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=AANLkTim-tiG_K4mF4ymEoQu6Sug9fjUvq-KNHr9G65Hh@mail.gmail.com \
    --to=hongshin@gmail.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).