From owner-freebsd-current Sun Jul 7 16:42:30 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C80A637B400 for ; Sun, 7 Jul 2002 16:42:27 -0700 (PDT) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id A179643E09 for ; Sun, 7 Jul 2002 16:42:21 -0700 (PDT) (envelope-from dl-freebsd@catspoiler.org) Received: from mousie.catspoiler.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.12.3/8.12.3) with ESMTP id g67Nhs0M024152 for ; Sun, 7 Jul 2002 16:43:58 -0700 (PDT) (envelope-from dl-freebsd@catspoiler.org) Message-Id: <200207072343.g67Nhs0M024152@gw.catspoiler.org> Date: Sun, 7 Jul 2002 16:42:59 -0700 (PDT) From: Don Lewis Subject: "pipe mutex" vs. "sigio lock" lock order reversal To: current@FreeBSD.ORG MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This error showed up in my logs this morning while I was building some ports on a uni-processor box. I'm running a version of -current from July 7 about 1 AM PDT. Jul 7 07:47:09 scratch kernel: lock order reversal Jul 7 07:47:09 scratch kernel: 1st 0xcabf7980 pipe mutex (pipe mutex) @ /usr/src/sys/kern/sys_pipe.c:451 Jul 7 07:47:09 scratch kernel: 2nd 0xc0474300 sigio lock (sigio lock) @ /usr/src/sys/kern/kern_sig.c:2113 I don't understand all the new locking stuff in -current, but it looks to me like maybe there should be a PIPE_UNLOCK()/PIPE_LOCK() wrapper around the following code in sys_pipe.c since a SIGIO could happen during the msleep(). /* * Handle non-blocking mode operation or * wait for more data. */ if (fp->f_flag & FNONBLOCK) { error = EAGAIN; } else { rpipe->pipe_state |= PIPE_WANTR; if ((error = msleep(rpipe, PIPE_MTX(rpipe), PRIBIO | PCATCH, "piperd", 0)) == 0) error = pipelock(rpipe, 1); } if (error) goto unlocked_error; I don't see a way for the locks to be asserted in the opposite order, though I suppose there might be a case of PROC_LOCK() followed by PIPE_LOCK() that would conflict with SIGIO_LOCK() followed by PROC_LOCK(). To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message