From owner-freebsd-current Sun May 19 13:36:18 2002 Delivered-To: freebsd-current@freebsd.org Received: from snipe.prod.itd.earthlink.net (snipe.mail.pas.earthlink.net [207.217.120.62]) by hub.freebsd.org (Postfix) with ESMTP id 9565E37B40A; Sun, 19 May 2002 13:36:14 -0700 (PDT) Received: from pool0109.cvx40-bradley.dialup.earthlink.net ([216.244.42.109] helo=mindspring.com) by snipe.prod.itd.earthlink.net with esmtp (Exim 3.33 #2) id 179XPZ-00002M-00; Sun, 19 May 2002 13:36:14 -0700 Message-ID: <3CE80C9F.17B3C23B@mindspring.com> Date: Sun, 19 May 2002 13:35:43 -0700 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Robert Watson Cc: current@FreeBSD.org Subject: Re: Bug in -current flock()? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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