From owner-freebsd-current@FreeBSD.ORG Mon Oct 4 05:08:32 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79148106564A; Mon, 4 Oct 2010 05:08:32 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1E4838FC15; Mon, 4 Oct 2010 05:08:31 +0000 (UTC) Received: by iwn10 with SMTP id 10so1886391iwn.13 for ; Sun, 03 Oct 2010 22:08:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=T8sJlTX6m2VXUPw3MEsCAwwXYVgfNMFwyV/D1H71fiY=; b=pkz3ha9QjaB+Oc8SjQ4+3LrbVYJWsGeIRHeJuXstAF3NRXQEjr3YqlJHAHw7n8zSJm MWCsmw51Dt/QyiqBWv+o7z8d4A5l7QvRf9SzJocZt91pB8mAjDZnGg+rYhtSr28NR3Ej wZ/Ehy2UaZMba5jdnGK2yFnKA5WuBmsUe2W8o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=t3Hd8ncsIL5DWFrW9M+X2EVvLdWqaWu1zuMZSM7l9lyXMU+EDDI1vq6ru7INmj/dx3 /s1CGbzqzaRglyNo+ia4dndkOafbSlvinOTtYkwka2KRLZ/D8BPbWPaRLnNoh0jgUFIm F4Jdm/mndwrP3UDDTa26GQ3+CXYZhPVZGBvdk= MIME-Version: 1.0 Received: by 10.231.36.8 with SMTP id r8mr4848856ibd.128.1286168911251; Sun, 03 Oct 2010 22:08:31 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.231.190.68 with HTTP; Sun, 3 Oct 2010 22:08:31 -0700 (PDT) In-Reply-To: References: <20101004123725.65d09b9e.daichi@ongs.co.jp> Date: Sun, 3 Oct 2010 22:08:31 -0700 X-Google-Sender-Auth: wFNpcEJfI6OajxaH5pYis1Yk-Ic Message-ID: From: Garrett Cooper To: Garrett Cooper Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-fs@freebsd.org, freebsd-current@freebsd.org, Daichi GOTO Subject: Re: fcntl always fails to delete lock file, and PID is always -6464 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Oct 2010 05:08:32 -0000 On Sun, Oct 3, 2010 at 10:05 PM, Garrett Cooper wrote= : > On Sun, Oct 3, 2010 at 8:37 PM, Daichi GOTO wrote: >> It looks very strange. fcntl() always fails to delete lock file >> and command.l_pid is always -6464. This issue is disclosed in >> porting Google's Japanese input system called "mozc". >> >> =A0details follow: >> =A0 =A0http://code.google.com/p/mozc/issues/detail?id=3D40 >> >> % uname -a >> FreeBSD parancell.ongs.co.jp 9.0-CURRENT FreeBSD 9.0-CURRENT #6 r213257:= Thu Sep 30 10:30:06 JST 2010 =A0 =A0 root@parancell.ongs.co.jp:/usr/obj/us= r/src/sys/PARANCELL =A0amd64 >> % >> >> My home directory on NFS server. =A0Does anyone have any ideas? > > > =A0 =A0I see some bad assumptions in the code: > > =A0 =A0const int result =3D ::fcntl(*fd, F_SETLK, &command); > =A0 =A0if (-1 =3D=3D result) { =A0// failed > =A0 =A0 =A0::close(*fd); > =A0 =A0 =A0LOG(WARNING) << "already locked"; > =A0 =A0 =A0return false; =A0 // another server is already running > =A0 =A0} > > =A0 =A0If the developer actually coded to POSIX expectations, he/she > would be checking for EACCES/EAGAIN; there are a myriad of other > issues that might be occurring with the software, as per my copy of > SUSv4 (see the ERRORS section of fcntl). I would print out the > strerror for that case. > =A0 =A0Providing a backtrace of the application's execution and the > architecture and what version of FreeBSD you're using would be > helpful. > Thanks, > -Garrett > > PS Quickly looking over this code, it has portability issues assuming > that all Unix based OSes (that aren't under some Mac OSX guard) are > Linux, based on the number of /proc filesystem opens and reads I see > in the code. Sorry... missed some of the details in spite of the trees (FreeBSD version in particular). Thanks, -Garrett