1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-28 16:43:09 +00:00

Take vnode pointer and hold it under znode lock, so we won't race with

zfs_reclaim(). This may or may not fix problem reported by kris, but it's
definiatelly better that way.
This commit is contained in:
Pawel Jakub Dawidek 2007-04-08 10:29:14 +00:00
parent b63b0c6529
commit 61cfeccd58
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=168488
2 changed files with 6 additions and 4 deletions

View File

@ -68,16 +68,17 @@ static void
znode_pageout_func(dmu_buf_t *dbuf, void *user_ptr)
{
znode_t *zp = user_ptr;
vnode_t *vp = ZTOV(zp);
vnode_t *vp;
mutex_enter(&zp->z_lock);
vp = ZTOV(zp);
if (vp == NULL) {
mutex_exit(&zp->z_lock);
zfs_znode_free(zp);
} else if (vp->v_count == 0) {
ZTOV(zp) = NULL;
mutex_exit(&zp->z_lock);
vhold(vp);
mutex_exit(&zp->z_lock);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread);
vrecycle(vp, curthread);
VOP_UNLOCK(vp, 0, curthread);

View File

@ -68,16 +68,17 @@ static void
znode_pageout_func(dmu_buf_t *dbuf, void *user_ptr)
{
znode_t *zp = user_ptr;
vnode_t *vp = ZTOV(zp);
vnode_t *vp;
mutex_enter(&zp->z_lock);
vp = ZTOV(zp);
if (vp == NULL) {
mutex_exit(&zp->z_lock);
zfs_znode_free(zp);
} else if (vp->v_count == 0) {
ZTOV(zp) = NULL;
mutex_exit(&zp->z_lock);
vhold(vp);
mutex_exit(&zp->z_lock);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread);
vrecycle(vp, curthread);
VOP_UNLOCK(vp, 0, curthread);