Make sure vcache_reclaim() will complete before file system suspension.

This commit is contained in:
hannken 2017-02-17 08:27:58 +00:00
parent 4b595f6ef6
commit 4f18a321ca
1 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_vnode.c,v 1.73 2017/01/27 10:50:10 hannken Exp $ */ /* $NetBSD: vfs_vnode.c,v 1.74 2017/02/17 08:27:58 hannken Exp $ */
/*- /*-
* Copyright (c) 1997-2011 The NetBSD Foundation, Inc. * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@ -156,7 +156,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.73 2017/01/27 10:50:10 hannken Exp $"); __KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.74 2017/02/17 08:27:58 hannken Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/kernel.h> #include <sys/kernel.h>
@ -1441,6 +1441,7 @@ vcache_reclaim(vnode_t *vp)
{ {
lwp_t *l = curlwp; lwp_t *l = curlwp;
vnode_impl_t *vip = VNODE_TO_VIMPL(vp); vnode_impl_t *vip = VNODE_TO_VIMPL(vp);
struct mount *mp = vp->v_mount;
uint32_t hash; uint32_t hash;
uint8_t temp_buf[64], *temp_key; uint8_t temp_buf[64], *temp_key;
size_t temp_key_len; size_t temp_key_len;
@ -1477,6 +1478,8 @@ vcache_reclaim(vnode_t *vp)
vip->vi_key.vk_key = temp_key; vip->vi_key.vk_key = temp_key;
mutex_exit(&vcache_lock); mutex_exit(&vcache_lock);
fstrans_start(mp, FSTRANS_LAZY);
/* /*
* Clean out any cached data associated with the vnode. * Clean out any cached data associated with the vnode.
* If purging an active vnode, it must be closed and * If purging an active vnode, it must be closed and
@ -1537,6 +1540,8 @@ vcache_reclaim(vnode_t *vp)
vp->v_tag = VT_NON; vp->v_tag = VT_NON;
KNOTE(&vp->v_klist, NOTE_REVOKE); KNOTE(&vp->v_klist, NOTE_REVOKE);
fstrans_done(mp);
KASSERT((vp->v_iflag & VI_ONWORKLST) == 0); KASSERT((vp->v_iflag & VI_ONWORKLST) == 0);
} }