diff options
author | jeff <jeff@FreeBSD.org> | 2002-05-05 23:17:13 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2002-05-05 23:17:13 +0000 |
commit | 4323e678dac53d14c9b7acd6425cd62e09084a7d (patch) | |
tree | b915f8a164ceef82722c2e8d7ef4bbacb13bb1f4 /sys | |
parent | c5483b31299fa695c49c9430a252b1989c74121a (diff) | |
download | FreeBSD-src-4323e678dac53d14c9b7acd6425cd62e09084a7d.zip FreeBSD-src-4323e678dac53d14c9b7acd6425cd62e09084a7d.tar.gz |
Move a KASSERT() in open() prior to unlocking the vnode. It's not safe to
call VOP_GETVOBJECT without a lock.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_extattr.c | 7 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index f89e8b9..1db5510 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -1765,6 +1765,10 @@ open(td, uap) return 0; } + /* assert that vn_open created a backing object if one is needed */ + KASSERT(!vn_canvmio(vp) || VOP_GETVOBJECT(vp, NULL) == 0, + ("open: vmio vnode has no backing object after vn_open")); + fp->f_data = (caddr_t)vp; fp->f_flag = flags & FMASK; fp->f_ops = &vnops; @@ -1800,9 +1804,6 @@ open(td, uap) if (error) goto bad; } - /* assert that vn_open created a backing object if one is needed */ - KASSERT(!vn_canvmio(vp) || VOP_GETVOBJECT(vp, NULL) == 0, - ("open: vmio vnode has no backing object after vn_open")); /* * Release our private reference, leaving the one associated with * the descriptor table intact. diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index f89e8b9..1db5510 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1765,6 +1765,10 @@ open(td, uap) return 0; } + /* assert that vn_open created a backing object if one is needed */ + KASSERT(!vn_canvmio(vp) || VOP_GETVOBJECT(vp, NULL) == 0, + ("open: vmio vnode has no backing object after vn_open")); + fp->f_data = (caddr_t)vp; fp->f_flag = flags & FMASK; fp->f_ops = &vnops; @@ -1800,9 +1804,6 @@ open(td, uap) if (error) goto bad; } - /* assert that vn_open created a backing object if one is needed */ - KASSERT(!vn_canvmio(vp) || VOP_GETVOBJECT(vp, NULL) == 0, - ("open: vmio vnode has no backing object after vn_open")); /* * Release our private reference, leaving the one associated with * the descriptor table intact. |