From owner-freebsd-stable Tue May 4 22:57:48 1999 Delivered-To: freebsd-stable@freebsd.org Received: from shell.webmaster.com (mail.webmaster.com [209.133.28.73]) by hub.freebsd.org (Postfix) with ESMTP id 9396C14F5F for ; Tue, 4 May 1999 22:57:46 -0700 (PDT) (envelope-from davids@webmaster.com) Received: from whenever ([209.133.29.2]) by shell.webmaster.com (Post.Office MTA v3.5.3 release 223 ID# 0-12345L500S10000V35) with SMTP id com; Tue, 4 May 1999 22:57:45 -0700 From: "David Schwartz" To: "Sameer R. Manek" , Subject: RE: bug with lockf(3)? Date: Tue, 4 May 1999 22:57:44 -0700 Message-ID: <000001be96bc$32002180$021d85d1@whenever.youwant.to> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2377.0 In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Given 2 processes A and B, both with open file descriptors to a file, > using open ("file.txt",O_RDWR) > A calls lockf (fd,F_LOCK,0) and proceeds to read/write to file > while file is still locked.... > B calls lockf (fd,F_LOCK,0) and enters blocked stait > A calls lockf (fd,F_ULOCK,0) > B is still in blocked state, until A exit(3)s. As a wild guess, did A move the file pointer inbetween the two calls to lockf? A third parameter of zero means to lock or unlock from the current position to infinity. If you lock zero to infinity, then block on a lock from zero to infinity, the unlock to infinity must also be to zero. My guess is that A's read/write operations leave the file pointer elsewhere, thus causing it to fail to release its lock. DS To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message