From owner-freebsd-bugs Thu Mar 11 9:10:27 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 10B8D14D08 for ; Thu, 11 Mar 1999 09:10:15 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.2/8.9.2) id JAA18308; Thu, 11 Mar 1999 09:10:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Date: Thu, 11 Mar 1999 09:10:01 -0800 (PST) Message-Id: <199903111710.JAA18308@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Cy Schubert Subject: Re: kern/10528: MFS fails to die when system shut down Reply-To: Cy Schubert Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR kern/10528; it has been noted by GNATS. From: Cy Schubert To: Matthew Dillon Cc: Cy Schubert - ITSD Open Systems Group , freebsd-gnats-submit@FreeBSD.ORG, cschuber@uumail.gov.bc.ca Subject: Re: kern/10528: MFS fails to die when system shut down Date: Thu, 11 Mar 1999 08:01:53 -0800 Excellent, thanks. I will apply your patch on my systems here. Regards, Phone: (250)387-8437 Cy Schubert Fax: (250)387-5766 Open Systems Group Internet: Cy.Schubert@uumail.gov.bc.ca ITSD Cy.Schubert@gems8.gov.bc.ca Province of BC In message <199903110740.XAA61921@apollo.backplane.com>, Matthew Dillon writes: > :Matthew, I've been trying to solve a "syncing filesystems... giving up" > :problem under 3.1. My first cut was effective under some > :circumstances, e.g. copying files to MFS but if MFS was used for /tmp > :and X was in use at the time of the shutdown, my patch would still > :fail. I've devised a better patch as follows. What do you think? > : > :What I've done is change the P_SYSTEM flag to a P_NOSWAP. What I don't > :understand is the comment about the swapper continuously trying to kill > :MFS. I can see why you don't want it to swap out, because of potential > :... > > The problem is that if the system runs out of swap space and memory, > it will attempt to kill the 'largest' process. This from > vm/vm_pageout.c: > > ... > /* > * make sure that we have swap space -- if we are low on memory and > * swap -- then kill the biggest process. > */ > if ((vm_swap_size == 0 || swap_pager_full) && > ((cnt.v_free_count + cnt.v_cache_count) < cnt.v_free_min)) { > bigproc = NULL; > bigsize = 0; > for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) { > /* > * if this is a system process, skip it > */ > if ((p->p_flag & P_SYSTEM) || (p->p_pid == 1) || > ((p->p_pid < 48) && (vm_swap_size != 0))) { > continue; > } > > ... > > Current setting P_NOSWAP will not prevent the system from trying to > kill the process. Perhaps, though, it would be safe to add P_NOSWAP > in and not have the system try to swap out a P_NOSWAP process either, > which with your patch would solve both problems. > > P_NOSWAP appears to only be set normally when the system is in the > midst of a fork. I think it would be safe to modify pageout.c from > > if ((p->p_flag & P_SYSTEM) || (p->p_pid == 1) || ... > > to > > if ((p->p_flag & (P_NOSWAP|P_SYSTEM)) || (p->p_pid == 1) || ... > > *PLUS* your patch. I will submit your patch, plus my modification > above, to core. > > -Matt > Matthew Dillon > > > :deadlock. It solves a "syncing filesystems" problem during shutdown. > :I tested during a shutdown while a file is currently being written > :to /tmp. Previously the system would panic: vinvalbuf: dirty bufs. > :With the patch below it doesn't do that any more. Does my patch > :introduce another problem? > : > :I'd appreciate some guidance. > : > :--- src/sys/ufs/mfs/mfs_vfsops.c.orig Thu Dec 31 20:14:11 1998 > :+++ src/sys/ufs/mfs/mfs_vfsops.c Wed Mar 10 21:08:13 1999 > :@@ -399,7 +399,8 @@ > : * can we swap out this process - not unless you want a deadlock, > : * anyway. > : */ > :- curproc->p_flag |= P_SYSTEM; > :+ /* curproc->p_flag |= P_SYSTEM; */ > :+ curproc->p_flag |= P_NOSWAP; > : > : while (mfsp->mfs_active) { > : while (bp = bufq_first(&mfsp->buf_queue)) { > : > :Regards, Phone: (250)387-8437 > :Cy Schubert Fax: (250)387-5766 > :Open Systems Group Internet: Cy.Schubert@uumail.gov.bc.ca > :ITSD Cy.Schubert@gems8.gov.bc.ca > :Province of BC > : > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message