On 06/28/2016 04:39 PM, Christoph Hellwig wrote:
On Tue, Jun 28, 2016 at 04:27:03PM +0300, Boaz Harrosh wrote:
>> Right. And an existing application can get DAX turned on under its
>> back, and will now suddently get different synchronization behavior.
>> That is if it's writes happen to be aligned to the fs block size.
> Is there an actual application that does that? or is this purely
> theoretical right now?
Lots of them. The typical case is multithreaded (or preforked like old
apache) daemons that use O_APPEND to write to a common log file. Then
again those log records will usually not be 4k aligned, so they'd still
accidentally get the exclusive locking even without this patch. But
beware the case where a log record actually matches the alignment..
But O_APPEND is exclusion problem of i_size update not of the actual memcpy
done in parallel or not.
Actually with O_APPEND each write request should write a different region
of the file, there are no overlapping writes. And no issue of which version of the
write came last and got its data written.
If it is the issue of isize update vs O_APPEND is a different issue don't
you think? One way that we solved it is to update isize = isize + len;
atomically before starting the IO, then on the error case sub the unwritten
bytes. And still allow concurrent writers. I agree that isize updates needs
to be atomic, but why does the memcpy?
And BTW in NFS O_APPEND concurrent readers to a writer may see
ZEROs in the interim.
I still don't see how an application can use the fact that two writers
will not give them mixed records. And surly it does not work on a shared
FS. So I was really wondering if you know of any such app
---end quoted text---