From owner-freebsd-fs@FreeBSD.ORG Tue Oct 5 06:56:12 2010 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE1F6106566C; Tue, 5 Oct 2010 06:56:12 +0000 (UTC) (envelope-from daichi@freebsd.org) Received: from natial.ongs.co.jp (natial.ongs.co.jp [202.216.246.90]) by mx1.freebsd.org (Postfix) with ESMTP id A91358FC08; Tue, 5 Oct 2010 06:56:12 +0000 (UTC) Received: from parancell.ongs.co.jp (dullmdaler.ongs.co.jp [202.216.246.94]) by natial.ongs.co.jp (Postfix) with ESMTPSA id 69B5812543B; Tue, 5 Oct 2010 15:39:26 +0900 (JST) Date: Tue, 5 Oct 2010 15:39:26 +0900 From: Daichi GOTO To: Garrett Cooper Message-Id: <20101005153926.88b4c1e1.daichi@freebsd.org> In-Reply-To: References: <20101004123725.65d09b9e.daichi@ongs.co.jp> <20101004144927.36822f07.daichi@ongs.co.jp> <20101005093826.17432b1e.daichi@ongs.co.jp> Organization: FreeBSD Project X-Mailer: Sylpheed 3.0.3 (GTK+ 2.20.1; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-fs@freebsd.org, freebsd-current@freebsd.org Subject: Re: fcntl always fails to delete lock file, and PID is always -6464 X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Oct 2010 06:56:13 -0000 Next step discussion engaged from this research I guess. Should we do change FreeBSD's fcntl(2) to return correct l_pid when called with F_SETLK? Or keep current behavior?? I want to hear other developers ideas and suggetions. On Mon, 4 Oct 2010 20:17:08 -0700 Garrett Cooper wrote: > test_fcntl: fcntl: Resource temporarily unavailable > PID=1 has the lock > > Huh...? init has the file locked...? WTF?! > So assuming Occam's Razor, I did a bit more reading and it turns > out that l_pid is only populated when you call with F_GETLK: > > negative, l_start means end edge of the region. >>> The l_pid and l_sysid > fields are only used with F_GETLK to return the process ID of the process > holding a blocking lock and the system ID of the system that owns that > process. Locks created by the local system will have a system ID of > zero. <<< After a successful F_GETLK request, the value of l_whence is > SEEK_SET. > > Thus, after fixing the test app I'm getting a sensical value: -- Daichi GOTO 81-42-316-7945 | daichi@ongs.co.jp | http://www.ongs.co.jp LinkedIn: http://linkedin.com/in/daichigoto