Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Apr 1998 06:00:02 -0700 (PDT)
From:      Peter Wemm <peter@netplex.com.au>
To:        freebsd-bugs
Subject:   Re: kern/6212: Two bugs with MFS filesystem fixed, two features added 
Message-ID:  <199804071300.GAA19942@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/6212; it has been noted by GNATS.

From: Peter Wemm <peter@netplex.com.au>
To: dg@root.com
Cc: dyson@freebsd.org, freebsd-gnats-submit@freebsd.org
Subject: Re: kern/6212: Two bugs with MFS filesystem fixed, two features added 
Date: Tue, 07 Apr 1998 20:56:13 +0800

 David Greenman wrote:
 > > Although, I'm puzzled why the msync() is needed at all, since it's just a
 > > mmap'ed file.  Perhaps there is some new lurking problem with synchronizing
 > > of mmap'ed files... :-/
 > 
 >    We've gone both ways with this issue in the past, but the final resolution
 > was that it is better to require the msync() rather than automatically
 > flushing VM system managed pages to the backing store.
 
 Hmm..  Matt points out that a 'sync' command will cause the writeback, the
 dirty pages will get written to the file providing the mmap() backing
 store. The pre-softdep code ran a sync every 30 seconds in process 3
 (update) so this was being "handled".
 
 However, the syncer process doesn't seem to do this any more..  It looks
 like the syncer is not doing that old 30-second sync did.
 
 I suspect that this is a result of the differences between the FreeBSD vs.
 the 4.4Lite2 derived systems that Kirk wrote the code on.
 
 Hmm.. the old update() called 'vfs_msync(mp)' for each mountpoint every 30
 seconds, and this does a walkthrough of the vnodes with OBJ_MIGHTBEDIRTY
 and does a vm_object_page_clean() on them.  This is no longer happening
 after softdep, and probably explains the failure to write out dirty mmap
 regions. vfs_msync() (called at sync(2), unmount(2) and from the old update 
 process) is documented as:
 /*
  * perform msync on all vnodes under a mount point
  * the mount point must be locked.
  */
 
 I think the loss of this call that is the culprit.
 
 Hmm.  syncer called VOP_FSYNC() which schedules a vm_object_page_clean() on 
 all vnodes that it knows about.  We could get an aged graduated writeback by 
 tagging all "dirty" mmap vnodes as needing "work to be done" and syncer will 
 take care of it for us.
 
 Or, perhaps something like this (UNTESTED!!):
 Index: vfs_subr.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/kern/vfs_subr.c,v
 retrieving revision 1.148
 diff -u -r1.148 vfs_subr.c
 --- vfs_subr.c	1998/03/30 09:51:08	1.148
 +++ vfs_subr.c	1998/04/07 12:46:55
 @@ -2742,6 +2740,7 @@
  		return (0);
  	asyncflag = mp->mnt_flag & MNT_ASYNC;
  	mp->mnt_flag &= ~MNT_ASYNC;
 +	vfs_msync(mp, MNT_NOWAIT);
  	VFS_SYNC(mp, MNT_LAZY, ap->a_cred, p);
  	if (asyncflag)
  		mp->mnt_flag |= MNT_ASYNC;
 
 This basically makes the periodic pseudo-sync do an implied msync like it
 did before the softdep changes.  This is a little more coarse though, 
 it'll cause the writeback to be scheduled in periodic chunks rather than 
 the smooth flow that the syncer tries to achieve.
 
 Cheers,
 -Peter
 --
 Peter Wemm <peter@netplex.com.au>   Netplex Consulting
 
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804071300.GAA19942>