Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Jul 2002 16:42:59 -0700 (PDT)
From:      Don Lewis <dl-freebsd@catspoiler.org>
To:        current@FreeBSD.ORG
Subject:   "pipe mutex" vs. "sigio lock" lock order reversal
Message-ID:  <200207072343.g67Nhs0M024152@gw.catspoiler.org>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207072343.g67Nhs0M024152>