From kris@obsecurity.org  Thu Mar  9 02:39:35 2006
Return-Path: <kris@obsecurity.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 950E816A420
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  9 Mar 2006 02:39:35 +0000 (GMT)
	(envelope-from kris@obsecurity.org)
Received: from elvis.mu.org (elvis.mu.org [192.203.228.196])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 66A7343D45
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  9 Mar 2006 02:39:35 +0000 (GMT)
	(envelope-from kris@obsecurity.org)
Received: from obsecurity.dyndns.org (elvis.mu.org [192.203.228.196])
	by elvis.mu.org (Postfix) with ESMTP id 4F5DB1A4D80
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  8 Mar 2006 18:39:35 -0800 (PST)
Received: by obsecurity.dyndns.org (Postfix, from userid 1000)
	id 9141652058; Wed,  8 Mar 2006 21:39:34 -0500 (EST)
Message-Id: <20060309023934.9141652058@obsecurity.dyndns.org>
Date: Wed,  8 Mar 2006 21:39:34 -0500 (EST)
From: Kris Kennaway <kris@obsecurity.org>
Reply-To: Kris Kennaway <kris@obsecurity.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: O_NONBLOCK may block with rpc.lockd
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         94258
>Category:       bin
>Synopsis:       [rpc] O_NONBLOCK may block with rpc.lockd
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 09 02:40:07 GMT 2006
>Closed-Date:    
>Last-Modified:  Thu Mar 09 04:33:41 GMT 2006
>Originator:     Kris Kennaway
>Release:        FreeBSD 6.0-STABLE i386
>Organization:
FreeBSD
>Environment:
System: FreeBSD xor.obsecurity.org 6.0-STABLE FreeBSD 6.0-STABLE #13: Sun Nov 6 12:45:25 EST 2005 kkenn@xor.obsecurity.org:/mnt/src/sys/i386/compile/XOR i386

>Description:

When the rpc.lockd server is unreachable, locks acquired with
O_NONBLOCK may block.  They also block for a few minutes after
rpc.lockd is restarted, but they eventually complete.

>How-To-Repeat:

On the server:

dosirak# killall -KILL rpc.lockd

On the client:

haessal# lockf -t 0 -k pid echo Yay
load: 0.00  cmd: lockf 1467 [lockd] 0.00u 0.00s 0% 528k
[hangs forever]

After rpc.lockd is restarted, it still takes a few minutes for the
lock operation to complete successfully.  New locks acquired in this
period also block.

>Fix:

Unsure.  Returning EWOULDBLOCK may not be correct since this means

     [EWOULDBLOCK]      O_NONBLOCK and one of O_SHLOCK or O_EXLOCK is speci-
                        fied and the file is locked.

and the file may or may not be locked.  Perhaps blocking is even
correct behaviour according to the relevant standards, though this is
counter-intuitive.
>Release-Note:
>Audit-Trail:
>Unformatted:
