All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Becker <Joel.Becker@oracle.com>
To: Werner Almesberger <wa@almesberger.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: VFS locking: f_pos thread-safe ?
Date: Fri, 6 Feb 2004 10:37:46 -0800	[thread overview]
Message-ID: <20040206183746.GR4902@ca-server1.us.oracle.com> (raw)
In-Reply-To: <20040206041223.A18820@almesberger.net>

On Fri, Feb 06, 2004 at 04:12:24AM -0300, Werner Almesberger wrote:
> Section 2.9.7 of the "Austin" draft of IEEE Std. 1003.1-200x,
> 28-JUL-2000, says:
> 
> "[...] read( ) [...] shall be atomic with respect to each other
>  in the effects specified in IEEE Std. 1003.1-200x when they
>  operate on regular files. If two threads each call one of these
>  functions, each call shall either see all of the specified
>  effects of the other call, or none of them."

	This reads:  "all of the specified effects of the other call,
or none of them."  If I read that correctly, if f_pos is at N, and
threads A and B concurrently read M bytes, then each thread's read()
must either start at f_pos = N or f_pos = N+M, but never at N < f_pos <
N+M.  So as long as our code doesn't partially update f_pos, it is
valid.  
	Of course, that doesn't change the possible race updating
f_pos at the end of each thread's call.

Joel

-- 

"In a crisis, don't hide behind anything or anybody. They're going
 to find you anyway."
	- Paul "Bear" Bryant

Joel Becker
Senior Member of Technical Staff
Oracle Corporation
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

  parent reply	other threads:[~2004-02-06 18:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-06  7:12 VFS locking: f_pos thread-safe ? Werner Almesberger
2004-02-06  7:55 ` Andrew Morton
2004-02-06 18:37 ` Joel Becker [this message]
2004-02-06 19:05   ` Matthias Urlichs
2004-02-07  1:35     ` Joel Becker
2004-02-06 20:09   ` Werner Almesberger
2004-02-06 20:56     ` Valdis.Kletnieks
2004-02-07  0:55       ` Werner Almesberger
2004-02-06 20:54 ` Andries Brouwer
2004-02-07 23:45   ` Werner Almesberger
  -- strict thread matches above, loose matches on Subject: below --
2004-02-06  9:09 Matt
2004-02-06  9:16 ` Andrew Morton
2004-02-06  9:26   ` Matt
2004-02-06  9:35     ` Andrew Morton
2004-02-06 10:19       ` Matthias Urlichs
2004-02-06 11:18         ` viro
2004-02-06 18:59           ` Matthias Urlichs
2004-02-06 19:54             ` Werner Almesberger
2004-02-08 15:58             ` Kai Henningsen
2004-02-19 15:14               ` Pavel Machek
     [not found]         ` <20040206101941.4cd9c882.shemminger@osdl.org>
2004-02-06 18:47           ` Matthias Urlichs
2004-02-06 13:50       ` Werner Almesberger
2004-02-06 13:56         ` viro
2004-02-06 14:24           ` Werner Almesberger

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=20040206183746.GR4902@ca-server1.us.oracle.com \
    --to=joel.becker@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wa@almesberger.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.