From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 19 11:58:48 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 A9F67106564A for ; Tue, 19 Jul 2011 11:58:48 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 548668FC0C for ; Tue, 19 Jul 2011 11:58:47 +0000 (UTC) Received: by vws18 with SMTP id 18so3951007vws.13 for ; Tue, 19 Jul 2011 04:58:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=UQSjZu7mJVUvt1glp3gNYXcfOz4zi2WzVnKEYlGe8SI=; b=UNPARXCmeCFlq+DI2RhP2BBcEOluHe3+xzQBFDxNOj5cIvmwEUbqARnYEe2C/a0TA7 ubYOOgHJs74ij5FbV7TAb5agwLrta2Yt3+dtpgl+unQ5VEzIfuENCtYMPveEbG1bqfTC 6oU3NIDsrM/NqsERu2GhwFmXWwuzy29rA6NLk= MIME-Version: 1.0 Received: by 10.220.57.11 with SMTP id a11mr1510764vch.4.1311076727211; Tue, 19 Jul 2011 04:58:47 -0700 (PDT) Received: by 10.220.203.202 with HTTP; Tue, 19 Jul 2011 04:58:47 -0700 (PDT) In-Reply-To: <4E24CD87.4010906@gamozo.org> References: <4E2448D1.6020504@gamozo.org> <4E244EE1.40604@FreeBSD.org> <4E24CD87.4010906@gamozo.org> Date: Tue, 19 Jul 2011 04:58:47 -0700 Message-ID: From: Garrett Cooper To: Brandon Falk Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 11:58:48 -0000 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 wa= s >>> 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 issue= s >>> 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'> =A0test` fails every other try. You have the same issue wit= h >>> text >>> editors like `edit` where it fails every other save. There are no issue= s >>> with >>> `echo 'hi'>> =A0test` 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() =A0 (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 curren= tly > 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? Thanks, -Garrett