Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Oct 2010 22:08:31 -0700
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        Garrett Cooper <gcooper@freebsd.org>
Cc:        freebsd-fs@freebsd.org, freebsd-current@freebsd.org, Daichi GOTO <daichi@ongs.co.jp>
Subject:   Re: fcntl always fails to delete lock file, and PID is always -6464
Message-ID:  <AANLkTikQqO2X3jw3xGXpzD6n0=z3LScFLb1qtWA76ZUi@mail.gmail.com>
In-Reply-To: <AANLkTinZg3n3wDUzQFPv_Gq1o2hswGL3%2B4o0brmTi0-h@mail.gmail.com>
References:  <20101004123725.65d09b9e.daichi@ongs.co.jp> <AANLkTinZg3n3wDUzQFPv_Gq1o2hswGL3%2B4o0brmTi0-h@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Oct 3, 2010 at 10:05 PM, Garrett Cooper <gcooper@freebsd.org> wrote=
:
> On Sun, Oct 3, 2010 at 8:37 PM, Daichi GOTO <daichi@ongs.co.jp> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikQqO2X3jw3xGXpzD6n0=z3LScFLb1qtWA76ZUi>