Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Nov 1998 21:05:16 +1100
From:      Peter Jeremy <peter.jeremy@auss2.alcatel.com.au>
To:        peter@netplex.com.au
Cc:        hackers@FreeBSD.ORG
Subject:   MMAP and sync writes (Re: sync writes with softupdates enabled)
Message-ID:  <98Nov4.210449est.40336@border.alcanet.com.au>

next in thread | raw e-mail | index | archive | help
Peter Wemm <peter@netplex.com.au> 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 <sys/mount.h>

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?98Nov4.210449est.40336>