Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147906566
D29830.1784750956.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D29830.1784750956.diff
View Options
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -451,16 +451,34 @@
/*
* Error from advlock or VOP_ADD_WRITECOUNT() still requires
* calling VOP_CLOSE() to pair with earlier VOP_OPEN().
- * Arrange for that by having fdrop() to use vn_closefile().
*/
if (error != 0) {
- fp->f_flag |= FOPENFAILED;
- fp->f_vnode = vp;
- if (fp->f_ops == &badfileops) {
- fp->f_type = DTYPE_VNODE;
- fp->f_ops = &vnops;
+ if (fp != NULL) {
+ /*
+ * Arrange the call by having fdrop() to use
+ * vn_closefile(). This is to satisfy
+ * filesystems like devfs or tmpfs, which
+ * override fo_close().
+ */
+ fp->f_flag |= FOPENFAILED;
+ fp->f_vnode = vp;
+ if (fp->f_ops == &badfileops) {
+ fp->f_type = DTYPE_VNODE;
+ fp->f_ops = &vnops;
+ }
+ vref(vp);
+ } else {
+ /*
+ * If there is no fp, due to kernel-mode open,
+ * we can call VOP_CLOSE() now.
+ */
+ if (vp->v_type != VFIFO && (fmode & FWRITE) != 0 &&
+ !MNT_EXTENDED_SHARED(vp->v_mount) &&
+ VOP_ISLOCKED(vp) != LK_EXCLUSIVE)
+ vn_lock(vp, LK_UPGRADE | LK_RETRY);
+ (void)VOP_CLOSE(vp, fmode & (FREAD | FWRITE | FEXEC),
+ cred, td);
}
- vref(vp);
}
ASSERT_VOP_LOCKED(vp, "vn_open_vnode");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 22, 8:09 PM (5 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29230826
Default Alt Text
D29830.1784750956.diff (1 KB)
Attached To
Mode
D29830: vn_open_vnode(): handle error when fp == NULL
Attached
Detach File
Event Timeline
Log In to Comment