From owner-freebsd-fs@FreeBSD.ORG Tue Oct 5 17:09:19 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 83EF3106566B; Tue, 5 Oct 2010 17:09:19 +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 24FF58FC12; Tue, 5 Oct 2010 17:09:19 +0000 (UTC) Received: by iwn34 with SMTP id 34so1892686iwn.13 for ; Tue, 05 Oct 2010 10:09:18 -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=ecVuMdFNpCr0ADGRJnGUVWQA6DxDKlhAJIkZry85au4=; b=rMHCLvb7njYctbm3+xjlH2N5hgq8HcR3/Ee/hh4CvqlJSKEnChioIJU1WkWFAQ3Ma9 OatVGloDgH4vQA+tViLq9SFf6BxslLh/WitpvA/W4EqEwv55u96Sz1YH+j8c+0uCj54N iHH1fqnL/xMYPeLOuOAW5KFNo4L0izS5X10gM= 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=I3oym9Vtv0GcN6LoarXn5voTMSQQ5A10VE7/Rk2+yK4caUlIih95rjzyYKUIa2rOcJ dF8SqfQM3PN4mAacV2MYTXOia2f7guLn+vrrcXiy+TP3aP5HvP9TwB43X2ZLhNi8bSJ3 fmx0kUb78wW4qRAijUr17dnetPUCf9zSb1SR4= MIME-Version: 1.0 Received: by 10.231.170.208 with SMTP id e16mr12462933ibz.44.1286298558688; Tue, 05 Oct 2010 10:09:18 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.231.184.3 with HTTP; Tue, 5 Oct 2010 10:09:18 -0700 (PDT) In-Reply-To: References: <20101004123725.65d09b9e.daichi@ongs.co.jp> <20101004144927.36822f07.daichi@ongs.co.jp> <20101005093826.17432b1e.daichi@ongs.co.jp> <20101005153410.598e4484.daichi@ongs.co.jp> <20101005175536.a67998ae.daichi@ongs.co.jp> Date: Tue, 5 Oct 2010 10:09:18 -0700 X-Google-Sender-Auth: Gf6mQNSXTqDyWTkOG8_fb_kYWrs Message-ID: From: Garrett Cooper To: Garrett Cooper Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 17:09:19 -0000 On Tue, Oct 5, 2010 at 8:58 AM, Garrett Cooper wrote: > On Tue, Oct 5, 2010 at 7:52 AM, Garrett Cooper wrot= e: >> On Tue, Oct 5, 2010 at 1:55 AM, Daichi GOTO wrote: >>> On Tue, 5 Oct 2010 01:23:02 -0700 >>> Garrett Cooper wrote: >>>> 2010/10/4 Daichi GOTO : >>>> > Thanks nice test tool :) =C2=A0And at last I got it excepting one my= stery! >>>> > >>>> > On Mon, 4 Oct 2010 20:17:08 -0700 >>>> > Garrett Cooper wrote: >>>> >> Following through the same process on FreeBSD... >>>> >> >>>> >> Window 1: >>>> >> $ ls -l /tmp/lockfile >>>> >> ls: /tmp/lockfile: No such file or directory >>>> >> $ ./test_fcntl >>>> >> >>>> >> Window 2: >>>> >> >>>> >> $ ls -l /tmp/lockfile >>>> >> -rwsr-x--- =C2=A01 garrcoop =C2=A0wheel =C2=A00 Oct =C2=A04 20:14 /= tmp/lockfile >>>> >> $ ./test_fcntl >>>> >> test_fcntl: fcntl: Resource temporarily unavailable >>>> > >>>> > Just my mystery is as follow: >>>> > >>>> > Windows 1: >>>> > % ./test_fcntl >>>> > My pid: 43490 >>>> > >>>> > Windows 2: >>>> > % ls -l /tmp/lockfile >>>> > -r-sr-x--- =C2=A01 daichi =C2=A0wheel =C2=A00 10=E6=9C=88 =C2=A05 15= :02 /tmp/lockfile =C2=A0 =C2=A0<--- is it weird, isn't it? >>>> > % ./test_fcntl >>>> > test_fcntl: open: Permission denied >>>> > % >>>> > >>>> > Oops... What's wrong... /tmp is as follow: >>>> > >>>> > % mount | grep tmp >>>> > /dev/ada0s1f on /tmp (ufs, local, noatime, soft-updates) >>>> > % dumpfs /tmp | grep journal >>>> > flags =C2=A0 soft-updates+journal >>>> > % >>>> > >>>> > And working scene: >>>> > >>>> > Windows 2: >>>> > % chmod u+w /tmp/lockfile >>>> > % ls -l /tmp/lockfile >>>> > -rwsr-x--- =C2=A01 daichi =C2=A0wheel =C2=A00 10=E6=9C=88 =C2=A05 15= :22 /tmp/lockfile >>>> > % ./test_fcntl >>>> > My pid: 43646 >>>> > test_fcntl: fcntl[1]: Resource temporarily unavailable >>>> > PID=3D43490 has the lock >>>> > % >>>> >>>> What's your umask and what are the permissions on /tmp? >>> >>> % ll / | grep tmp >>> drwxrwxrwt =C2=A014 root =C2=A0wheel =C2=A0 =C2=A0 =C2=A01024 10=E6=9C= =88 =C2=A05 17:19 tmp >>> % umask >>> 022 >>> % rm -f test >>> % touch test >>> % ll | grep test >>> -rw-r--r-- =C2=A0 1 daichi =C2=A0wheel =C2=A0 =C2=A0 0 10=E6=9C=88 =C2= =A05 17:52 test >>> % >> >> =C2=A0 =C2=A0The permissions look ok from my perspective, but the umask = is >> different, so you might want to try my umask to make sure that your >> results match mine (and we need to check the requirements to determine >> whether or not the behavior for FreeBSD's umask syscall is correct): >> >> $ ls -la /tmp/ | head -n 2 >> total 462686 >> drwxrwxrwt =C2=A051 root =C2=A0 =C2=A0 wheel =C2=A0 =C2=A0 =C2=A0 =C2=A0= 11776 Oct =C2=A05 03:11 . >> $ umask >> 0022 >> >> =C2=A0 =C2=A0Where and how is /tmp mounted (is it a real partition, what >> filesystem, etc)? >> =C2=A0 =C2=A0BTW, when I change my umask to match your's I don't get the= same >> results you do on my home machine: >> >> Window 1: >> >> $ umask 022 >> $ ./test_fcntl >> My pid: 17353 >> >> Window 2: >> >> $ ./test_fcntl >> My pid: 17356 >> test_fcntl: fcntl[1]: Resource temporarily unavailable >> PID=3D17353 has the lock >> $ ls -l /tmp/lockfile >> -rwSr----- =C2=A01 gcooper =C2=A0wheel =C2=A00 Oct =C2=A05 07:49 /tmp/lo= ckfile >> >> =C2=A0 =C2=A0Just to note, the tests before were run on the RHEL 4.8 box= with >> the following info, and the FreeBSD box with the following info: >> >> Red Hat Enterprise Linux AS release 4 (Nahant Update 8) >> Linux sjc-lds-102 2.6.9-89.0.11.ELsmp #1 SMP Mon Aug 31 11:00:34 EDT >> 2009 x86_64 x86_64 x86_64 GNU/Linux >> >> FreeBSD bioshock.cisco.com 9.0-CURRENT FreeBSD 9.0-CURRENT #1 >> r211767M: Sat Aug 28 00:28:45 PDT 2010 >> garrcoop@bioshock.cisco.com:/usr/obj/usr/src/sys/BIOSHOCK =C2=A0amd64 >> >> =C2=A0 =C2=A0The tests above were run on a FreeBSD box with the followin= g info: >> >> FreeBSD bayonetta.local 9.0-CURRENT FreeBSD 9.0-CURRENT #9 r211309M: >> Thu Aug 19 22:50:36 PDT 2010 >> root@bayonetta.local:/usr/obj/usr/src/sys/BAYONETTA =C2=A0amd64 >> >> =C2=A0 =C2=A0On bayonetta /tmp is SUJ backed (probably should change tha= t >> though), and on bioshock it's not SUJ backed. > > And while this might be a good mental exercise, I think we're missing > the original point of your bug: > > You were getting ECONNREFUSED because a socket was in `use', even > though all instances of mozc_server were dead (at least that's the > case with me). So the question I guess that's worth asking is: Statement incorrect: socket wasn't in use. The logic needs to be rewritten to account for this case and setup the socket again if this occurs. It would be a good idea to do this if the file wasn't locked. > 1. What process/application does it need to establish a Unix style socket= with? > 2. Why isn't that socket being cleaned up by the OS at exit? Thanks! -Garrett