lkml.org 
[lkml]   [2004]   [Feb]   [6]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateFri, 6 Feb 2004 10:37:46 -0800
FromJoel Becker <>
SubjectRe: VFS locking: f_pos thread-safe ?
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:00    [from the cache]
©2003-2008