From owner-freebsd-hackers Wed Nov 4 02:05:45 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id CAA27660 for freebsd-hackers-outgoing; Wed, 4 Nov 1998 02:05:45 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from alcanet.com.au (border.alcanet.com.au [203.62.196.10]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id CAA27650 for ; Wed, 4 Nov 1998 02:05:39 -0800 (PST) (envelope-from peter.jeremy@auss2.alcatel.com.au) Received: by border.alcanet.com.au id <40336>; Wed, 4 Nov 1998 21:04:49 +1100 Date: Wed, 4 Nov 1998 21:05:16 +1100 From: Peter Jeremy Subject: MMAP and sync writes (Re: sync writes with softupdates enabled) To: peter@netplex.com.au Cc: hackers@FreeBSD.ORG Message-Id: <98Nov4.210449est.40336@border.alcanet.com.au> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Peter Wemm wrote: >> Note that there is a similar bug in 2.2.x. The fix is similar, but >> needs some thought since there appears to be a problem with the >> parameters to vm_object_page_clean(). In particular, `syncio' is >> defined as boolean_t, as passed as the `waitfor' argument to >> VOP_FSYNC() - which is MNT_ASYNC or MNT_SYNC elsewhere. I haven't >> had the time to work out the correct definitions. > >Use TRUE and FALSE instead of OBJPC_SYNC and 0. I don't think it's that simple. The following is from 2.2.7-RELEASE: Looking at vm_object_page_clean(), all the existing calls use TRUE or FALSE (or 1 or 0, which is equivalent, if less clear). This matches the definition 'boolean_t syncio'. Within vm_object_page_clean(), syncio is only used as: VOP_FSYNC(vp, NULL, syncio, curproc); The problem is that everywhere else, VOP_FSYNC() is called with the third parameter as one of the following: a) MNT_WAIT or MNT_NOWAIT explicitly specified. b) (struct vop_fsync_args).a_waitfor c) the 2nd argument of {fstype}_sync, invoked via VFS_SYNC() and explicitly defined as MNT_WAIT or MNT_NOWAIT in a_waitfor is only assigned from VOP_FSYNC() and is compared against MNT_WAIT/MNT_NOWAIT everywhere except: ffs_inode.c:ffs_update() if (ap->a_waitfor && (ap->a_vp->v_mount->mnt_flag & MNT_ASYNC) == 0) return (bwrite(bp)); lfs_inode.c:lfs_update() error = (ap->a_waitfor & LFS_SYNC ? lfs_vflush(vp) : 0); if(ap->a_waitfor & LFS_SYNC && vp->v_dirtyblkhd.lh_first != NULL) VFS_SYNC() is invoked with the second parameter as one of the following: a) MNT_WAIT or MNT_NOWAIT explicitly specified. b) 1 in lfs_vfsops.c:lfs_unmount() Based on the above, I believe the 4th argument to vm_object_page_clean() should really be an int and all calls should be updated to pass MNT_WAIT or MNT_NOWAIT. These discrepancies would be far more obvious if more of the kernel magic numbers were enum's instead of #defines - the compiler would have some hope of pointing out the inconsistencies. Peter -- Peter Jeremy (VK2PJ) peter.jeremy@alcatel.com.au Alcatel Australia Limited 41 Mandible St Phone: +61 2 9690 5019 ALEXANDRIA NSW 2015 Fax: +61 2 9690 5247 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message