From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 19 15:29:47 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3602106566C; Tue, 19 Jul 2011 15:29:47 +0000 (UTC) (envelope-from falkman@gamozo.org) Received: from mta31.charter.net (mta31.charter.net [216.33.127.82]) by mx1.freebsd.org (Postfix) with ESMTP id 5C0928FC08; Tue, 19 Jul 2011 15:29:47 +0000 (UTC) Received: from imp09 ([10.20.200.9]) by mta31.charter.net (InterMail vM.7.09.02.04 201-2219-117-106-20090629) with ESMTP id <20110719152946.OWPH3994.mta31.charter.net@imp09>; Tue, 19 Jul 2011 11:29:46 -0400 Received: from [192.168.1.125] ([75.135.75.204]) by imp09 with smtp.charter.net id 9rVl1h00K4QU3rf05rVlyG; Tue, 19 Jul 2011 11:29:46 -0400 X-Authority-Analysis: v=1.1 cv=1b2X7W/SifksZeClH/haT1SUt4udqxFGF00pZw2/jJk= c=1 sm=1 a=qGV6uSQ7kSsA:10 a=YzQM1Zd3q-sA:10 a=EZ1XIdwCItEA:10 a=8nJEP1OIZ-IA:10 a=HEs2YkztZRVyeANDsLw8Eg==:17 a=pGLkceISAAAA:8 a=5Qp8lWOuAAAA:8 a=Rtm9G2dbfmXd8Fkf3IEA:9 a=t9f34lXaIuT1MRZ0JjoA:7 a=wPNLvfGTeEIA:10 a=MSl-tDqOz04A:10 a=gzg3p7Doww8A:10 a=HEs2YkztZRVyeANDsLw8Eg==:117 Message-ID: <4E25A2F4.2030707@gamozo.org> Date: Tue, 19 Jul 2011 10:29:56 -0500 From: Brandon Falk User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: Garrett Cooper References: <4E2448D1.6020504@gamozo.org> <4E244EE1.40604@FreeBSD.org> <4E24CD87.4010906@gamozo.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org, Andriy Gapon Subject: Re: Issue with 'Unknown Error: -512' X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2011 15:29:47 -0000 On 7/19/2011 7:31 AM, Garrett Cooper wrote: > On Tue, Jul 19, 2011 at 4:58 AM, Garrett Cooper wrote: >> On Mon, Jul 18, 2011 at 5:19 PM, Brandon Falk wrote: >>> On 7/18/2011 10:18 AM, Andriy Gapon wrote: >>>> on 18/07/2011 17:53 Brandon Falk said the following: >>>>> Hello, >>>>> >>>>> In recent branches (confirmed with 224119) builds compiled with clang >>>>> happen to >>>>> throw 'Unknown error: -512' in a lot of places, making the system >>>>> unusable. >>>>> (Untested on gcc compiled systems). Originally I thought the problem was >>>>> with >>>>> specific programs, then I narrowed it down to file I/O, and now I've >>>>> narrowed it >>>>> down to open() with O_TRUNC. Without O_TRUNC there seems to be no issues >>>>> whatsoever. With O_TRUNC on open() it fails with that 'Unknown error: >>>>> -512' every >>>>> other time you run the program. Common issues, portsnap is affected, >>>>> making it >>>>> impossible to fetch/extract ports. As well as redirecting output in >>>>> shells eg >>>>> `echo 'hi'> test` fails every other try. You have the same issue with >>>>> text >>>>> editors like `edit` where it fails every other save. There are no issues >>>>> with >>>>> `echo 'hi'>> test` as there is no O_TRUNC, it only seems to be an >>>>> O_TRUNC error. >>>>> >>>>> Any tips? Otherwise I'll be looking into this today myself. >>>> Just a hint that you could try using DTrace syscall and fbt providers to >>>> see where >>>> in kernel (if in kernel) that -512 return value originates. >>>> >>> Update: >>> >>> I've traced more and more into the kernel, and currently I have found the >>> following trace: >>> >>>>>> ufs_setattr() (in sys/ufs/ufs/ufs_vnops.c:507) >>> (In truncate a bunch of stuff is done, but it succeeds until VOP_SETATTR) >>>>>> vn_truncate() (in sys/kern/vfs_vnops.c:636) >>>>>> kern_openat() (in sys/kern/vfs_syscalls.c:1043) >>>>>> kern_open() (in sys/kern/vfs_syscalls.c:1035) >>>>>> open() (in sys/kern/vfs_syscalls.c:1006) >>> ufs_setattr() returns with -1 (EPERM) >>> >>> I'll continue to try to find the exact problem. A quick workaround currently >>> would probably be to use a different filesystem other than ufs, but then >>> again, I have no clue if other filesystems have the same issue. >>> >>> Hopefully that trace will help anyone who wants to help out. >> What UFS options do you have defined in your kernel? > Also, what does mount say and have you tried running as root? > Thanks, > -Garrett > Garrett, I am running as root. No issues with the mounting. As for options, which do you want? -Brandon Falk