From: dcg <diegocalleja@gmail.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Hisashi Hifumi <hifumi.hisashi@oss.ntt.co.jp>,
Nick Piggin <nickpiggin@yahoo.com.au>,
torvalds@linux-foundation.org,
Andrew Morton <akpm@linux-foundation.org>,
Andi Kleen <andi@firstfloor.org>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
"Theodore Ts'o" <tytso@mit.edu>
Subject: Re: [RESEND] [PATCH] VFS: make file->f_pos access atomic on 32bit arch
Date: Thu, 9 Oct 2008 23:51:58 +0200 [thread overview]
Message-ID: <20081009235158.7d328aa0@diego-desktop> (raw)
In-Reply-To: <1223448711.1378.16.camel@lappy.programming.kicks-ass.net>
El Wed, 08 Oct 2008 08:51:51 +0200, Peter Zijlstra <a.p.zijlstra@chello.nl> escribió:
> either dup() the fd or open() the file twice. There is absolutely no
> 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 brought
to the list every few months and even generates (aparently not neccesary)
patches is a hint that there should be somewhere a commentary (*) like
this:
(*) I don't know if what I wrote is 100% correct.
Signed-off-by: Diego Calleja García <diegocg@gmail.com>
Index: 2.6/include/linux/fs.h
===================================================================
--- 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 in
+ * multithread apps running in 32 bit machines. There're several
+ * reasons for this behaviour:
+ * - Specifications don't say it must be implemented that way.
+ * - This behaviour is part of the Linux semantics.
+ * - Any application that does multithreaded access to file->f_pos
+ * should be doing its own locking: the processes should synchronize
+ * themselves when accessing a file descriptor. If an application
+ * doesn't do that, its file descriptor handling is buggy anyway and
+ * must be fixed to access file->f_pos properly.
+ */
loff_t f_pos;
struct fown_struct f_owner;
unsigned int f_uid, f_gid;
next prev parent reply other threads:[~2008-10-09 21:52 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-07 5:07 [RESEND] [PATCH] VFS: make file->f_pos access atomic on 32bit arch Hisashi Hifumi
2008-10-07 6:43 ` Andi Kleen
2008-10-07 10:11 ` Hisashi Hifumi
2008-10-07 10:29 ` Andi Kleen
2008-10-07 16:27 ` Nick Piggin
2008-10-07 17:50 ` Andrew Morton
2008-10-07 18:59 ` Peter Zijlstra
2008-10-08 2:35 ` Nick Piggin
2008-10-08 2:52 ` Matthew Wilcox
2008-10-09 12:23 ` Pavel Machek
2008-10-09 12:49 ` Valdis.Kletnieks
2008-10-09 13:01 ` Matthew Wilcox
2008-10-09 13:38 ` Miklos Szeredi
2008-10-09 14:58 ` Linus Torvalds
2008-10-09 17:29 ` Jeremy Fitzhardinge
2008-10-08 4:48 ` Hisashi Hifumi
2008-10-08 5:10 ` Nick Piggin
2008-10-08 5:16 ` Matthew Wilcox
2008-10-08 6:28 ` Andrew Morton
2008-10-08 6:51 ` Peter Zijlstra
2008-10-08 8:32 ` Eric Dumazet
2008-10-08 8:48 ` Nick Piggin
2008-10-08 9:17 ` Peter Zijlstra
2008-10-09 21:51 ` dcg [this message]
2008-10-10 2:25 ` Nick Piggin
2008-10-09 12:16 ` Pavel Machek
2008-10-08 0:40 ` Nick Piggin
2008-10-07 18:00 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081009235158.7d328aa0@diego-desktop \
--to=diegocalleja@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=hifumi.hisashi@oss.ntt.co.jp \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox