Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/fuse/fuse_node.c
Show First 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | fuse_vnode_alloc(struct mount *mp, | ||||
} | } | ||||
*vpp = NULL; | *vpp = NULL; | ||||
err = vfs_hash_get(mp, fuse_vnode_hash(nodeid), LK_EXCLUSIVE, td, vpp, | err = vfs_hash_get(mp, fuse_vnode_hash(nodeid), LK_EXCLUSIVE, td, vpp, | ||||
fuse_vnode_cmp, &nodeid); | fuse_vnode_cmp, &nodeid); | ||||
if (err) | if (err) | ||||
return (err); | return (err); | ||||
if (*vpp) { | if (*vpp) { | ||||
if ((*vpp)->v_type != vtyp) { | if ((*vpp)->v_type == vtyp) { | ||||
/* Reuse a vnode that hasn't yet been reclaimed */ | |||||
MPASS((*vpp)->v_data != NULL); | |||||
MPASS(VTOFUD(*vpp)->nid == nodeid); | |||||
SDT_PROBE2(fusefs, , node, trace, 1, | |||||
"vnode taken from hash"); | |||||
return (0); | |||||
} else { | |||||
/* | /* | ||||
* STALE vnode! This probably indicates a buggy | * The inode changed types! If we get here, we can't | ||||
* server, but it could also be the result of a race | * tell whether the inode's entry cache had expired | ||||
* between FUSE_LOOKUP and another client's | * yet. So this could be the result of a buggy server, | ||||
* FUSE_UNLINK/FUSE_CREATE | * but more likely the server just reused an inode | ||||
* number following an entry cache expiration. | |||||
*/ | */ | ||||
SDT_PROBE3(fusefs, , node, stale_vnode, *vpp, vtyp, | SDT_PROBE3(fusefs, , node, stale_vnode, *vpp, vtyp, | ||||
nodeid); | nodeid); | ||||
fuse_internal_vnode_disappear(*vpp); | fuse_internal_vnode_disappear(*vpp); | ||||
vgone(*vpp); | |||||
lockmgr((*vpp)->v_vnlock, LK_RELEASE, NULL); | lockmgr((*vpp)->v_vnlock, LK_RELEASE, NULL); | ||||
*vpp = NULL; | |||||
return (EAGAIN); | |||||
} | } | ||||
MPASS((*vpp)->v_data != NULL); | |||||
MPASS(VTOFUD(*vpp)->nid == nodeid); | |||||
SDT_PROBE2(fusefs, , node, trace, 1, "vnode taken from hash"); | |||||
return (0); | |||||
} | } | ||||
fvdat = malloc(sizeof(*fvdat), M_FUSEVN, M_WAITOK | M_ZERO); | fvdat = malloc(sizeof(*fvdat), M_FUSEVN, M_WAITOK | M_ZERO); | ||||
switch (vtyp) { | switch (vtyp) { | ||||
case VFIFO: | case VFIFO: | ||||
err = getnewvnode("fuse", mp, &fuse_fifoops, vpp); | err = getnewvnode("fuse", mp, &fuse_fifoops, vpp); | ||||
break; | break; | ||||
default: | default: | ||||
err = getnewvnode("fuse", mp, &fuse_vnops, vpp); | err = getnewvnode("fuse", mp, &fuse_vnops, vpp); | ||||
▲ Show 20 Lines • Show All 283 Lines • Show Last 20 Lines |