zfs: make use of getnewvnode_reserve in zfs_mknode and zfs_zget
getnewvnode_reserve helps to avoid "recursing" back into zfs code via getnewvnode when that latter needs to reclaim some vnodes. zfs code may hold a number of locks around getnewvnode and doesn't expect any recursion to happen on those locks, because that never happens in solaris. I believe that this change also eleiminates a need for the delayed znode destruction via the taskqueue. Many thanks to kib for devising getnewvnode_reserve. Reported by: flo Tested by: bapt, kwm, swills MFC after: 2 weeks X-MFC after: r241556
This commit is contained in:
parent
6684e46988
commit
edb085b8ab
@ -856,6 +856,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr,
|
||||
}
|
||||
}
|
||||
|
||||
getnewvnode_reserve(1);
|
||||
ZFS_OBJ_HOLD_ENTER(zfsvfs, obj);
|
||||
VERIFY(0 == sa_buf_hold(zfsvfs->z_os, obj, NULL, &db));
|
||||
|
||||
@ -1042,6 +1043,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr,
|
||||
KASSERT(err == 0, ("insmntque() failed: error %d", err));
|
||||
}
|
||||
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj);
|
||||
getnewvnode_drop_reserve();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1152,12 +1154,14 @@ zfs_zget(zfsvfs_t *zfsvfs, uint64_t obj_num, znode_t **zpp)
|
||||
|
||||
*zpp = NULL;
|
||||
|
||||
getnewvnode_reserve(1);
|
||||
again:
|
||||
ZFS_OBJ_HOLD_ENTER(zfsvfs, obj_num);
|
||||
|
||||
err = sa_buf_hold(zfsvfs->z_os, obj_num, NULL, &db);
|
||||
if (err) {
|
||||
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num);
|
||||
getnewvnode_drop_reserve();
|
||||
return (err);
|
||||
}
|
||||
|
||||
@ -1168,6 +1172,7 @@ again:
|
||||
doi.doi_bonus_size < sizeof (znode_phys_t)))) {
|
||||
sa_buf_rele(db, NULL);
|
||||
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num);
|
||||
getnewvnode_drop_reserve();
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
@ -1231,6 +1236,7 @@ again:
|
||||
sa_buf_rele(db, NULL);
|
||||
mutex_exit(&zp->z_lock);
|
||||
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num);
|
||||
getnewvnode_drop_reserve();
|
||||
return (err);
|
||||
}
|
||||
|
||||
@ -1266,6 +1272,7 @@ again:
|
||||
}
|
||||
}
|
||||
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num);
|
||||
getnewvnode_drop_reserve();
|
||||
return (err);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user