On 7/25/2011 4:47 AM, Robert Watson wrote:

On Mon, 18 Jul 2011, Andriy Gapon wrote:

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.

Jon Anderson spotted that here during some Capsicum work -- initially we were concerned it was a local patch, but it sounds like it might be less local. I think he saw it on calls to open(2) as well, and I couldn't help but wonder (given its recent arrival) if it was an outcome of the change to break falloc into two parts, leading to some or another problematic handling of file descriptor numbers. I.e., it's not so much that -512 is being returned, as a number that's a bad file descriptor. (Although now having seen 512 twice on two different machines, that particular explanation seems less credible). Perhaps this is indeed unrelated to Capsicum, and triggered by a clang bug or something else.

I've CC'd Jon, maybe he has gained further insight since we chatted.

Robert


I've been building head every single day to check for the disappearance of this bug, and it seems to be gone as of 224302 (maybe before, but 224302 is what I built). I wrote a program to do tons of open()s and truncate()s to try to get the error, where initially I'd get an error every other attempt, then it was every 100 or so iterations it would fail, now I've tested 500,000 opens and truncates and there have been no issues.

-Brandon Falk
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to