PR kern/40210 5.0 BETA WAPBL related crash

This commit is contained in:
ad 2008-12-21 10:44:32 +00:00
parent d003f8f69b
commit 83f7350f6d
1 changed files with 17 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_vnops.c,v 1.104 2008/10/10 09:21:58 hannken Exp $ */
/* $NetBSD: ffs_vnops.c,v 1.105 2008/12/21 10:44:32 ad Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffs_vnops.c,v 1.104 2008/10/10 09:21:58 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffs_vnops.c,v 1.105 2008/12/21 10:44:32 ad Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -402,12 +402,25 @@ out:
int
ffs_full_fsync(struct vnode *vp, int flags)
{
extern struct vfsops ffs_vfsops;
struct buf *bp, *nbp;
int error, passes, skipmeta, inodedeps_only, waitfor;
struct mount *mp;
bool ffsino;
error = 0;
if ((flags & FSYNC_VFS) != 0) {
KASSERT(vp->v_specmountpoint != NULL);
mp = vp->v_specmountpoint;
ffsino = (mp->mnt_op == &ffs_vfsops);
KASSERT(vp->v_type == VBLK);
} else {
mp = vp->v_mount;
ffsino = true;
KASSERT(vp->v_tag == VT_UFS);
}
if (vp->v_type == VBLK &&
vp->v_specmountpoint != NULL &&
(vp->v_specmountpoint->mnt_flag & MNT_SOFTDEP))
@ -425,11 +438,6 @@ ffs_full_fsync(struct vnode *vp, int flags)
if (vp->v_type == VREG || vp->v_type == VBLK) {
int pflags = PGO_ALLPAGES | PGO_CLEANIT;
if ((flags & FSYNC_VFS) != 0 && vp->v_specmountpoint != NULL)
mp = vp->v_specmountpoint;
else
mp = vp->v_mount;
if ((flags & FSYNC_WAIT))
pflags |= PGO_SYNCIO;
if (vp->v_type == VREG &&
@ -439,7 +447,6 @@ ffs_full_fsync(struct vnode *vp, int flags)
if (error)
return error;
} else {
mp = vp->v_mount;
mutex_exit(&vp->v_interlock);
}
@ -449,7 +456,7 @@ ffs_full_fsync(struct vnode *vp, int flags)
if (flags & FSYNC_DATAONLY)
return error;
if (VTOI(vp) && (VTOI(vp)->i_flag &
if (ffsino && VTOI(vp) && (VTOI(vp)->i_flag &
(IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFY |
IN_MODIFIED | IN_ACCESSED))) {
error = UFS_WAPBL_BEGIN(mp);
@ -569,12 +576,8 @@ loop:
else
waitfor = (flags & FSYNC_WAIT) ? UPDATE_WAIT : 0;
if (vp->v_tag == VT_UFS)
if (ffsino)
error = ffs_update(vp, NULL, NULL, waitfor);
else {
KASSERT(vp->v_type == VBLK);
KASSERT((flags & FSYNC_VFS) != 0);
}
if (error == 0 && flags & FSYNC_CACHE) {
int i = 0;