This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Semaphores in libc


On Mon, Jan 04, 2010 at 02:05:01PM +0100, Petar Bogdanovic wrote:
> > 
> > Ok. If link($unique, $lockfile) returns success, then your process got
> > the lock. If it returns failure, but stat($unique) returns the number of
> > hardlinks > 1, then the link actually succeeded, but the client NFS code
> > may have for some reason got confused.
> 
> Or another thread got the lock in the meantime.

Hm, no. If stat($unique) returns an hard-link count greater than 1, then
the lockfile is the one created by the link().

> It's not that much
> about NFS as it is about the stat(2) call lacking value.  Whatever
> stat(2) returns, you can't rely on it since other things can happen
> between link(), stat() and your next step.

Well, there is a link to your unique (per process) file, so if it isn't
the lockfile, what is it?

> Why is the return value of link() not sufficient? (given a properly
> functioning NFS-client)

Maybe the standard is too lenient allowing properly functioning clients
work in mysterious ways? As you can see in the link I posted, NFS isn't
POSIX compliant.

-- 
lfr
0/0

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]