Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 May 2002 13:35:43 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Robert Watson <rwatson@FreeBSD.org>
Cc:        current@FreeBSD.org
Subject:   Re: Bug in -current flock()?
Message-ID:  <3CE80C9F.17B3C23B@mindspring.com>
References:  <Pine.NEB.3.96L.1020519102843.72574Q-100000@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Robert Watson wrote:
> I don't know much (anything) about the advisory locking code, but was
> puzzled to see the following at the bottom of the flock() system call code
> in kern_descrip.c:

[ ... ]

> My reading of that is that the fp->f_flag field will be unconditionally
> updated to include FHASLOCK, even if VOP_ADVLOCK() returns an error.  Is
> this correct?

Yes.

The FS on which the VOP_ADVLOCK is being called may be a union of two
underlying FS's.

If the lock succeeds on one and fails on the other, you are screwed,
unless you change how the VOP_ADVLOCK semantics are handled.

Backing out the lock on the FS that succeeds doesn't work because of
lock coelescing, and the fact that it is not delayed until both have
succeeded or failed.  It means that if your attempted lock intersects
any preexiting lock, you will have an irreversible promotion or
demotion of the lock, and that simply removing the lock could remove
locking that should remain asserted (after all, the call is reporting
that the state has not changed).

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CE80C9F.17B3C23B>