From owner-freebsd-current Mon Aug 7 10: 3:23 2000 Delivered-To: freebsd-current@freebsd.org Received: from critter.freebsd.dk (flutter.freebsd.dk [212.242.40.147]) by hub.freebsd.org (Postfix) with ESMTP id C49AF37B9BD; Mon, 7 Aug 2000 10:03:13 -0700 (PDT) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.9.3/8.9.3) with ESMTP id TAA10028; Mon, 7 Aug 2000 19:03:08 +0200 (CEST) (envelope-from phk@critter.freebsd.dk) To: Matt Dillon Cc: Mike Smith , Alfred Perlstein , Stephen McKay , freebsd-current@FreeBSD.ORG, dillon@FreeBSD.ORG Subject: Re: Ugly, slow shutdown In-Reply-To: Your message of "Mon, 07 Aug 2000 09:47:36 PDT." <200008071647.JAA36775@earth.backplane.com> Date: Mon, 07 Aug 2000 19:03:08 +0200 Message-ID: <10026.965667788@critter.freebsd.dk> From: Poul-Henning Kamp Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message <200008071647.JAA36775@earth.backplane.com>, Matt Dillon writes: >:> * Stephen McKay [000805 08:49] wrote: >:> > >:> > Patch 2 is smaller and possibly controversial. Normally bufdaemon and >:> > syncer are sleeping when they are told to suspend. This delays shutdown >:> > by a few boring seconds. With this patch, it is zippier. I expect people >:> > to complain about this shortcut, but every sleeping process should expect >:> > to be woken for no reason at all. Basic kernel premise. >:> >:> You better bet it's controversial, this isn't "Basic kernel premise" >: >:Actually, that depends. It is definitely poor programming practice to >:not check the condition for which you slept on wakeup. >: >:> *boom* *crash* *ow* :) >: >:Doctor: So don't do that. > > I gotta agree. This is very bad programming practice. There are many, > many places in the kernel where tsleep() is called with a 0 delay and > assumed not to return until something meaningful happens. For example, > for handling NFS retries, some of the locking code (I think), and I > could probably find many others. Then this code should be changed to do the right thing, which is to *always* check the condition being slept on before proceeding. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD coreteam member | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message