From owner-freebsd-current Tue Apr 8 05:54:23 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id FAA07229 for current-outgoing; Tue, 8 Apr 1997 05:54:23 -0700 (PDT) Received: from nlsystems.com (nlsys.demon.co.uk [158.152.125.33]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id FAA07221 for ; Tue, 8 Apr 1997 05:54:19 -0700 (PDT) Received: from herring.nlsystems.com (herring.nlsystems.com [10.0.0.2]) by nlsystems.com (8.8.5/8.8.5) with SMTP id NAA04649 for ; Tue, 8 Apr 1997 13:54:00 +0100 (BST) Date: Tue, 8 Apr 1997 13:54:00 +0100 (BST) From: Doug Rabson To: current@freebsd.org Subject: Fixes to NFSv3 for review Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk I recently added code to NFS to use write clustering for NFSv3 commits. This improves write performance for NFSv3 considerably. Unfortunately, it also had a bug which was triggered by code which write many small blocks. The symptom which I saw was a panic("nfsbioread") when performing a make world on a machine with NFS mounted src and obj. I have a fix but I am going on holiday tomorrow for a week and I don't want to commit anything without being around to deal with any subsequent problems. Could someone review and possibly commit this fix. The bug is present in both 2.2 and 3.0 branches. Index: nfs/nfs_bio.c =================================================================== RCS file: /home/ncvs/src/sys/nfs/nfs_bio.c,v retrieving revision 1.34 diff -u -r1.34 nfs_bio.c --- nfs_bio.c 1997/04/03 07:52:00 1.34 +++ nfs_bio.c 1997/04/08 11:41:17 @@ -962,9 +962,12 @@ iomode = NFSV3WRITE_FILESYNC; bp->b_flags |= B_WRITEINPROG; error = nfs_writerpc(vp, uiop, cr, &iomode, &must_commit); - if (!error && iomode == NFSV3WRITE_UNSTABLE) - bp->b_flags |= B_NEEDCOMMIT | B_CLUSTEROK; - else + if (!error && iomode == NFSV3WRITE_UNSTABLE) { + bp->b_flags |= B_NEEDCOMMIT; + if (bp->b_dirtyoff == 0 + && bp->b_dirtyend == bp->b_bufsize) + bp->b_flags |= B_CLUSTEROK; + } else bp->b_flags &= ~B_NEEDCOMMIT; bp->b_flags &= ~B_WRITEINPROG; Index: kern/vfs_cluster.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_cluster.c,v retrieving revision 1.44 diff -u -r1.44 vfs_cluster.c --- vfs_cluster.c 1997/04/01 11:48:30 1.44 +++ vfs_cluster.c 1997/04/08 11:46:12 @@ -468,6 +468,7 @@ tbp->b_flags |= B_ERROR; tbp->b_error = error; } + tbp->b_dirtyoff = tbp->b_dirtyend = 0; biodone(tbp); } relpbuf(bp); -- Doug Rabson Mail: dfr@nlsystems.com Nonlinear Systems Ltd. Phone: +44 181 951 1891