All of lore.kernel.org
 help / color / mirror / Atom feed
* Semantics of racy O_DIRECT writes
@ 2025-01-08 16:33 Travis Downs
  2025-01-09  4:57 ` Theodore Ts'o
  0 siblings, 1 reply; 12+ messages in thread
From: Travis Downs @ 2025-01-08 16:33 UTC (permalink / raw)
  To: linux-block

Hello linux-block,

We are experiencing data corruption in our storage intensive server
application and are wondering about the semantics of "racy" O_DIRECT
writes.

Normally we target XFS, but the question is a general one.

Specifically, imagine that we are writing a single 4K aligned page,
with contents AB00 (each char being 1K bytes). We only care about
the first 2048 bytes (the AB part). We are using libaio writes
(io_submit) with O_DIRECT semantics. While the write is in flight,
i.e.,
after we have submitted it and before we reap it in io_getevents, the
userspace application writes into second half of the page,
changing it to ABCD (let's say via memcpy). The first half is not changed.

The question then is: is this safe in the sense that would result in
ABxx being written where xx "is don't care"? Or could it do something
crazier, like cause later writes to be ignored (e.g. if something in
the kernel storage layer hashes the page for some purpose and
this hash is out of sync with the page at the time it was captured, or
something like that).

Of course, the easy answer is "don't do that", but I still want to
know what happens if we do.

Travis

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

end of thread, other threads:[~2025-02-04 14:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-08 16:33 Semantics of racy O_DIRECT writes Travis Downs
2025-01-09  4:57 ` Theodore Ts'o
2025-01-09 14:16   ` Travis Downs
2025-01-09 15:01     ` Travis Downs
2025-01-09 17:32       ` Bart Van Assche
2025-01-10  9:42         ` Christoph Hellwig
2025-01-31 19:58           ` Travis Downs
2025-01-09 15:51     ` Theodore Ts'o
2025-01-10  8:58       ` Christoph Hellwig
2025-01-31 20:06         ` Travis Downs
2025-02-04  5:19           ` Christoph Hellwig
2025-02-04 14:32             ` Travis Downs

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.