Date: Tue, 01 May 2007 13:34:52 +0200 From: des@des.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) To: Kostik Belousov <kostikbel@gmail.com> Cc: freebsd-current@freebsd.org, Stefan Ehmann <shoesoft@gmx.net> Subject: Re: strace causes panic: sleeping thread Message-ID: <864pmwbwv7.fsf@dwp.des.no> In-Reply-To: <20070501111902.GA2441@deviant.kiev.zoral.com.ua> (Kostik Belousov's message of "Tue, 1 May 2007 14:19:02 %2B0300") References: <200704281128.44077.shoesoft@gmx.net> <20070428115503.GM2441@deviant.kiev.zoral.com.ua> <86y7k8rgc4.fsf@dwp.des.no> <86tzuwrfui.fsf@dwp.des.no> <20070501111902.GA2441@deviant.kiev.zoral.com.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Kostik Belousov <kostikbel@gmail.com> writes: > The procfs PIOCWAIT/PIOCWAIT32 ioctls drop the p_mtx for > sleep. Could it be that p being freed/reused meantime ? So it should be held while the lock is dropped. It is still a procfs issue (and one that was present, although benign, before I removed Giant from pseudofs). Please try this updated patch. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=procfs.diff Index: sys/fs/procfs/procfs_ioctl.c =================================================================== RCS file: /home/ncvs/src/sys/fs/procfs/procfs_ioctl.c,v retrieving revision 1.16 diff -u -r1.16 procfs_ioctl.c --- sys/fs/procfs/procfs_ioctl.c 19 Feb 2007 13:04:25 -0000 1.16 +++ sys/fs/procfs/procfs_ioctl.c 1 May 2007 11:30:22 -0000 @@ -70,7 +70,10 @@ int ival; #endif - PROC_LOCK(p); + KASSERT(p != NULL, + ("%s() called without a process", __func__)); + PROC_LOCK_ASSERT(p, MA_OWNED); + error = 0; switch (cmd) { #if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) @@ -124,8 +127,10 @@ case PIOCWAIT: while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) { /* sleep until p stops */ + _PHOLD(p); error = msleep(&p->p_stype, &p->p_mtx, PWAIT|PCATCH, "pioctl", 0); + _PRELE(p); if (error != 0) break; } @@ -142,8 +147,10 @@ case PIOCWAIT32: while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) { /* sleep until p stops */ + _PHOLD(p); error = msleep(&p->p_stype, &p->p_mtx, PWAIT|PCATCH, "pioctl", 0); + _PRELE(p); if (error != 0) break; } @@ -193,7 +200,6 @@ default: error = (ENOTTY); } - PROC_UNLOCK(p); return (error); } --=-=-=--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?864pmwbwv7.fsf>