From: Nick Piggin Subject: Re: [RESEND] [PATCH] VFS: make file->f_pos access atomic on 32bit arch Date: Fri, 10 Oct 2008 13:25:15 +1100 Message-ID: <200810101325.16153.nickpiggin@yahoo.com.au> References: <6.0.0.20.2.20081007140438.0580f110@172.19.0.2> <1223448711.1378.16.camel@lappy.programming.kicks-ass.net> <20081009235158.7d328aa0@diego-desktop> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Peter Zijlstra , Hisashi Hifumi , torvalds@linux-foundation.org, Andrew Morton , Andi Kleen , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, "Aneesh Kumar K.V" , Theodore Ts'o To: dcg Return-path: Received: from smtp102.mail.mud.yahoo.com ([209.191.85.212]:34050 "HELO smtp102.mail.mud.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1750999AbYJJCZY convert rfc822-to-8bit (ORCPT ); Thu, 9 Oct 2008 22:25:24 -0400 In-Reply-To: <20081009235158.7d328aa0@diego-desktop> Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Friday 10 October 2008 08:51, dcg wrote: > El Wed, 08 Oct 2008 08:51:51 +0200, Peter Zijlstra =20 escribi=C3=B3: > > either dup() the fd or open() the file twice. There is absolutely n= o > > valid reason to have two threads read from the same fd without > > synchronising their access to it - never. > > In case this is the final consensus, I think that a topic that is bro= ught > to the list every few months and even generates (aparently not necces= ary) > patches is a hint that there should be somewhere a commentary (*) lik= e > this: > > (*) I don't know if what I wrote is 100% correct. > > > Signed-off-by: Diego Calleja Garc=C3=ADa > > Index: 2.6/include/linux/fs.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- 2.6.orig/include/linux/fs.h 2008-10-09 00:06:50.000000000 +0200 > +++ 2.6/include/linux/fs.h 2008-10-09 00:29:03.000000000 +0200 > @@ -821,6 +821,18 @@ > atomic_long_t f_count; > unsigned int f_flags; > mode_t f_mode; > + /* > + * Linux does NOT guarantee atomic reading/writing to file->f_pos i= n > + * multithread apps running in 32 bit machines. There're several > + * reasons for this behaviour: Note that I don't think we'd want to explicitly guarantee that it is at= omic on 64-bit machines either. It does happen to be, but I don't think we w= ant anybody to rely on that... -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html