Re: VFS locking: f_pos thread-safe ?

From: Matthias Urlichs
Date: Fri Feb 06 2004 - 05:43:53 EST


Hi, Andrew Morton wrote:
>> touchà :) but still we should do what we can.. want me to make a patch?
>
> Not unless we can think of a way in which it actually matters, thanks.
>
I've written one of those... a migration program from an old
fixed-record-size database to SQL. Somebody had the brilliant idea to let
two threads read the file concurrently, postprocess the thing (which took
a variable amount of time depending on what was in the record) and then
feed it to the database (ditto).

When that idea didn't work, I used a separate reader thread and
coordinated buffer usage with semaphores or whatever, making the thing a
whole lot more complicated in the process. :-/

So count me as one of those people who think that it does matter -- if N
threads read a file of M bytes, they should collectively get M bytes from
it (possibly out of order, of course, but that's a different problem).
Anything else would be inconsistent.

Same thing goes for writing (in append mode as well as otherwise).

--
Matthias Urlichs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/