mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
vn_open(): If the vnode is reclaimed during open(2), do not return error.
Most future operations on the returned file descriptor will fail anyway, and application should be ready to handle that failures. Not forcing it to understand the transient failure mode on open, which is implementation-specific, should make us less special without loss of reporting of errors. Suggested by: chs Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
08c2dc2841
commit
ee965dfa64
2 changed files with 9 additions and 4 deletions
|
|
@ -45,6 +45,7 @@
|
|||
*/
|
||||
static vop_lookup_t dead_lookup;
|
||||
static vop_open_t dead_open;
|
||||
static vop_close_t dead_close;
|
||||
static vop_getwritemount_t dead_getwritemount;
|
||||
static vop_rename_t dead_rename;
|
||||
static vop_unset_text_t dead_unset_text;
|
||||
|
|
@ -55,6 +56,7 @@ struct vop_vector dead_vnodeops = {
|
|||
.vop_access = VOP_EBADF,
|
||||
.vop_advlock = VOP_EBADF,
|
||||
.vop_bmap = VOP_EBADF,
|
||||
.vop_close = dead_close,
|
||||
.vop_create = VOP_PANIC,
|
||||
.vop_getattr = VOP_EBADF,
|
||||
.vop_getwritemount = dead_getwritemount,
|
||||
|
|
@ -104,13 +106,18 @@ dead_lookup(struct vop_lookup_args *ap)
|
|||
}
|
||||
|
||||
/*
|
||||
* Open always fails as if device did not exist.
|
||||
* Silently succeed open and close.
|
||||
*/
|
||||
static int
|
||||
dead_open(struct vop_open_args *ap)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (ENXIO);
|
||||
static int
|
||||
dead_close(struct vop_close_args *ap)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -356,8 +356,6 @@ vn_open_vnode_advlock(struct vnode *vp, int fmode, struct file *fp)
|
|||
fp->f_flag |= FHASLOCK;
|
||||
|
||||
vn_lock(vp, lock_flags | LK_RETRY);
|
||||
if (error == 0 && VN_IS_DOOMED(vp))
|
||||
error = ENOENT;
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue