public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* BUG? a possible bug for the absence of memory barrier
@ 2009-09-09 15:15 홍신 shin hong
  2009-09-10 20:38 ` Chris Mason
  0 siblings, 1 reply; 2+ messages in thread
From: 홍신 shin hong @ 2009-09-09 15:15 UTC (permalink / raw)
  To: linux-btrfs

Hello. I am reporting possible bugs caused
by the absence of memory barriers.

Please examine this issue and let me know your opinion.

In add_async_extent(), an async_extent object is allocated and initialized
and then links to &cow->extents.

However, since there is no memory barrier
between the initialization and the linking to the list,
these two operations are executed opposite order.
And the re-ordering might result race condition.

The similar issue is also in join_transaction().

Thank you

Sincerely

Shin Hong

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: BUG? a possible bug for the absence of memory barrier
  2009-09-09 15:15 BUG? a possible bug for the absence of memory barrier 홍신 shin hong
@ 2009-09-10 20:38 ` Chris Mason
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Mason @ 2009-09-10 20:38 UTC (permalink / raw)
  To: 홍신 shin hong; +Cc: linux-btrfs

On Thu, Sep 10, 2009 at 12:15:24AM +0900, =ED=99=8D=EC=8B=A0 shin hong =
wrote:
> Hello. I am reporting possible bugs caused
> by the absence of memory barriers.
>=20
> Please examine this issue and let me know your opinion.
>=20
> In add_async_extent(), an async_extent object is allocated and initia=
lized
> and then links to &cow->extents.

Memory barriers have an impact when there are multiple CPUs accessing
the same data structures at the same time.  In the case of
add_async_extent only one worker thread is working on that list at a
time.

>=20
> However, since there is no memory barrier
> between the initialization and the linking to the list,
> these two operations are executed opposite order.
> And the re-ordering might result race condition.
>=20
> The similar issue is also in join_transaction().

In join_transaction, that list is protected by the trans_mutex.

-chris
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-10 20:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-09 15:15 BUG? a possible bug for the absence of memory barrier 홍신 shin hong
2009-09-10 20:38 ` Chris Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox