From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jamie Lokier Subject: Re: file offset corruption on 32-bit machines? Date: Thu, 10 Apr 2008 16:14:06 +0100 Message-ID: <20080410151406.GA17051@shareable.org> References: <200804101555.58643.mhocko@suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Michal Hocko , Meelis Roos , Linux Kernel list , linux-fsdevel@vger.kernel.org To: Martin Mares Return-path: Received: from mail2.shareable.org ([80.68.89.115]:46060 "EHLO mail2.shareable.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756029AbYDJPOM (ORCPT ); Thu, 10 Apr 2008 11:14:12 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Martin Mares wrote: > > [*] file_pos_{read,write} (fs/read_write.c) are not called under > > lock (in sys_read, sys_write, ...), so even if f_pos is written > > atomically, you will be able to get races when accessing shared > > descriptor from different threads. > > There are however cases when such behavior is perfectly valid: For example > you can have a file of records of a fixed size, whose order does not matter. > Then multiple processes can produce the records in parallel, sharing > a single fd. A rather more common thing: Does this problem apply when appending lines or records to a log file, with or without O_APPEND? Also, can this problem affect programs doing concurrent reads/writes using pread/pwrite (or the AIO equivalents)? -- Jamie