From owner-freebsd-current@FreeBSD.ORG Fri Jul 4 00:45:35 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B8F47D9; Fri, 4 Jul 2014 00:45:35 +0000 (UTC) Received: from mail-qa0-x22c.google.com (mail-qa0-x22c.google.com [IPv6:2607:f8b0:400d:c00::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E8862767; Fri, 4 Jul 2014 00:45:35 +0000 (UTC) Received: by mail-qa0-f44.google.com with SMTP id hw13so819046qab.17 for ; Thu, 03 Jul 2014 17:45:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=0IVFqMKpoPAx1ZIQqD/bVB+sG5tnXnl/84kbGvm9uN4=; b=Go3PkBe+rbPKqPI8mDdt8PWAqB0qddb6oGaHeaJvNAL70yv/Jyom+ySWddvsDGBs0V uS5kC18Icky/dU9R9QRVW8Gaa/fNXLWOH6IiLJPau4380LfXofVy+JjroDL2yUSIpMLv 3zBUsbfFc4mDu6WX3Lk+oOqwQIo4+6YoDZ+OSPppoFQkhSu7/IhFCEW1bhLbvkoF9fMY EvXmSQHEjhPWHl3NxquhI7fAR84hQsMRuzxT+w7PP/AST7+HtMtmvcKxTUpJh6NOzYZO UNSe7LuAw205ct8mkoQsD36oL04NN6Gs4PTIJnSm3X0CJGhExl4ExjqWDKsSicPp/DF+ agaQ== MIME-Version: 1.0 X-Received: by 10.140.34.195 with SMTP id l61mr12384760qgl.87.1404434734621; Thu, 03 Jul 2014 17:45:34 -0700 (PDT) Received: by 10.224.202.193 with HTTP; Thu, 3 Jul 2014 17:45:34 -0700 (PDT) Date: Thu, 3 Jul 2014 17:45:34 -0700 Message-ID: Subject: EDEADLK from fcntl(F_SETFL) ? From: Adrian Chadd To: "freebsd-arch@freebsd.org" , freebsd-current Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jul 2014 00:45:35 -0000 Hi! I've seen sqlite3 crap out due to "disk IO error". It looks like the F_SETFL path is returning EDEADLK when it shouldn't be - only the "wait" version of this should be. The kernel code looks to be: lf_setlock() -> lf_add_outgoing() -> lf_add_edge() -> graph_add_edge() -> EDEADLK .. and lf_setlock() will return an error from lf_add_outgoing() without checking if it's (a) EDEADLK, and (b) whether we're going to sleep or not. So, sqlite3 trips up on this. I'm sure other things do. What should the correct thing be? It looks like EWOULDBLOCK is the correct value to return for F_SETFL failing, not EDEADLK. What do those-who-know-POSIX-standards-better-than-I think? Thanks! -a