From owner-freebsd-current Fri Dec 6 14: 6: 8 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 A0EC237B401 for ; Fri, 6 Dec 2002 14:06:04 -0800 (PST) Received: from beastie.mckusick.com (beastie.mckusick.com [209.31.233.184]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1DB7143E9C for ; Fri, 6 Dec 2002 14:06:04 -0800 (PST) (envelope-from mckusick@beastie.mckusick.com) Received: from beastie.mckusick.com (localhost [127.0.0.1]) by beastie.mckusick.com (8.12.3/8.12.3) with ESMTP id gB6M5q59093906; Fri, 6 Dec 2002 14:05:52 -0800 (PST) (envelope-from mckusick@beastie.mckusick.com) Message-Id: <200212062205.gB6M5q59093906@beastie.mckusick.com> To: Archie Cobbs Subject: Re: backgroud fsck is still locking up system (fwd) Cc: Nate Lawson , freebsd-current@FreeBSD.org In-Reply-To: Your message of "Fri, 06 Dec 2002 13:01:20 PST." <200212062101.gB6L1KaP065709@arch20m.dellroad.org> Date: Fri, 06 Dec 2002 14:05:52 -0800 From: Kirk McKusick 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 From: Archie Cobbs Subject: Re: backgroud fsck is still locking up system (fwd) In-Reply-To: <200212061941.gB6Jf659093594@beastie.mckusick.com> To: Kirk McKusick Date: Fri, 6 Dec 2002 13:01:20 -0800 (PST) CC: Archie Cobbs , Nate Lawson , freebsd-current@FreeBSD.org X-ASK-Info: Whitelist match Kirk McKusick wrote: > by the syncer who is also blocked. Could you please run the following > command on your system and send me the results: > > sysctl vfs.lodirtybuffers > sysctl vfs.hidirtybuffers > sysctl vfs.numdirtybuffers > > both before and after the lockup. If you cannot run this command after > the lockup, the global variable names are: > > lodirtybuffers > hidirtybuffers > numdirtybuffers Before (system running normally): vfs.lodirtybuffers: 126 vfs.hidirtybuffers: 252 vfs.numdirtybuffers: 0 After: vfs.lodirtybuffers: 126 vfs.hidirtybuffers: 252 vfs.numdirtybuffers: 445 -Archie __________________________________________________________________________ Archie Cobbs * Packet Design * http://www.packetdesign.com OK, it looks like my hypothesis on having a small number of buffers and running out of them is the problem. I enclose below a patch which should check for the problem arising and help to mitigate it. I would appreciate you dropping it into your kernel and seeing if it solves your problem. The fix is not ideal, but merely to see if it solves this problem. If it does, I will figure out how to do it properly. Thanks for your help. Kirk McKusick Index: sys/buf.h =================================================================== RCS file: /usr/ncvs/src/sys/sys/buf.h,v retrieving revision 1.138 diff -c -r1.138 buf.h *** sys/buf.h 2002/08/30 04:04:37 1.138 --- sys/buf.h 2002/12/06 21:44:25 *************** *** 468,473 **** --- 468,474 ---- caddr_t kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est); void bufinit(void); void bwillwrite(void); + int checkdirtybufs(struct vnode *); int buf_dirty_count_severe(void); void bremfree(struct buf *); int bread(struct vnode *, daddr_t, int, struct ucred *, struct buf **); Index: kern/vfs_bio.c =================================================================== RCS file: /usr/ncvs/src/sys/kern/vfs_bio.c,v retrieving revision 1.342 diff -c -r1.342 vfs_bio.c *** kern/vfs_bio.c 2002/11/23 19:10:30 1.342 --- kern/vfs_bio.c 2002/12/06 21:44:35 *************** *** 1114,1119 **** --- 1114,1137 ---- } /* + * Check to see if a vnode holds too many dirty buffers. If it does, + * flush it. + */ + int + checkdirtybufs(struct vnode *vp) + { + struct buf *bp; + int dirtycnt = 0, error = 0; + struct thread *td = curthread; + + TAILQ_FOREACH(bp, &vp->v_dirtyblkhd, b_vnbufs) + dirtycnt++; + if (dirtycnt > lodirtybuffers) + error = VOP_FSYNC(vp, td->td_ucred, MNT_NOWAIT, td); + return (error); + } + + /* * Return true if we have too many dirty buffers. */ int Index: ufs/ffs/ffs_balloc.c =================================================================== RCS file: /usr/ncvs/src/sys/ufs/ffs/ffs_balloc.c,v retrieving revision 1.39 diff -c -r1.39 ffs_balloc.c *** ufs/ffs/ffs_balloc.c 2002/10/22 01:14:25 1.39 --- ufs/ffs/ffs_balloc.c 2002/12/06 21:49:56 *************** *** 295,300 **** --- 295,301 ---- if (bp->b_bufsize == fs->fs_bsize) bp->b_flags |= B_CLUSTEROK; bdwrite(bp); + checkdirtybufs(vp); } } /* *************** *** 335,340 **** --- 336,342 ---- if (bp->b_bufsize == fs->fs_bsize) bp->b_flags |= B_CLUSTEROK; bdwrite(bp); + checkdirtybufs(vp); } *bpp = nbp; return (0); *************** *** 756,761 **** --- 758,764 ---- if (bp->b_bufsize == fs->fs_bsize) bp->b_flags |= B_CLUSTEROK; bdwrite(bp); + checkdirtybufs(vp); } } /* *************** *** 796,801 **** --- 799,805 ---- if (bp->b_bufsize == fs->fs_bsize) bp->b_flags |= B_CLUSTEROK; bdwrite(bp); + checkdirtybufs(vp); } *bpp = nbp; return (0); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message