Date: Fri, 12 Feb 2021 01:07:09 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: ee965dfa6492 - main - vn_open(): If the vnode is reclaimed during open(2), do not return error. Message-ID: <202102120107.11C1795k070535@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ee965dfa64929227ced8adb68900c35f877480e7 commit ee965dfa64929227ced8adb68900c35f877480e7 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-02-03 11:02:18 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-02-12 01:02:20 +0000 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 --- sys/fs/deadfs/dead_vnops.c | 11 +++++++++-- sys/kern/vfs_vnops.c | 2 -- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/fs/deadfs/dead_vnops.c b/sys/fs/deadfs/dead_vnops.c index 09c3c996ee0e..324bbafd7caf 100644 --- a/sys/fs/deadfs/dead_vnops.c +++ b/sys/fs/deadfs/dead_vnops.c @@ -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 diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 6c6727c7f372..f70bcdab4208 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102120107.11C1795k070535>