Re: Concurrent read/writes on the same file

Stephen C. Tweedie (sct@redhat.com)
Wed, 9 Dec 1998 11:50:02 GMT


Hi,

On Wed, 9 Dec 1998 16:55:30 +1300, Chris Wedgwood <cw@ix.net.nz> said:

> On Tue, Dec 08, 1998 at 12:26:53PM +0000, Stephen C. Tweedie wrote:
>> [...] Reads are not locked.

> What about one reader and one writer -- here I assume the read is
> locked, or do we just get trashed data? (Assuming we do, its still
> OK, it really up to an application to not read/write to a file at the
> same time and expect consistency).

No automatic locking is done in the kernel for this case. Use kernel
record locking with flock/fcntl if you want that: that's what it's
there for!

I've considered it more than once, but the performance penalty of
doing range locking is too high --- it pollutes the fast path of
accessing data in the cache --- and locking the entire inode destroys
parallelism.

--Stephen

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