f_offset

Jeff Roberson jroberson at jroberson.net
Mon Apr 14 08:30:22 UTC 2008


On Mon, 14 Apr 2008, Poul-Henning Kamp wrote:

> In message <20080413131422.V959 at desktop>, Jeff Roberson writes:
>
>> However, f_offset is fetched and set with a shared vnode lock for readers.
>
> "fetched AND set" with a shared lock ?
>
> How can that possibly work out sanely ?

It doesn't matter which reader wins the race to update offset as long as 
the resulting offset is entirely valid from one.  This is a userspace race 
otherwise.

There is a complication for 64bit offsets on 32bit machines that needs 
some MD support.  Otherwise the write happens in two instructions and can 
have mixed results.

Jeff

>
> -- 
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk at FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
>


More information about the freebsd-arch mailing list