[Ocfs2-devel] BUG? a racy code at o2hb_heartbeat_group_drop_item()
홍신 shin hong
hongshin at gmail.com
Tue Aug 17 05:51:06 PDT 2010
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.
Sincerely
Shin Hong
More information about the Ocfs2-devel
mailing list