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:
parent
b63b0c6529
commit
61cfeccd58
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=168488
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user