When vn_open() is failing because it cannot allocate a vm object, call

VOP_CLOSE() on the vnode, so that VOP_OPEN() and VOP_CLOSE() calls
are symmetric in all failure cases.  This prevents an 'open' reference
from being leaked in that unlikely failure scenario.
This commit is contained in:
Robert Watson 2002-02-18 00:26:10 +00:00
parent 3056874a81
commit 4729fbd85f

View File

@ -199,7 +199,7 @@ vn_open_cred(ndp, flagp, cmode, cred)
*/
if (vn_canvmio(vp) == TRUE) {
if ((error = vfs_object_create(vp, td, cred)) != 0)
/* XXX: Should VOP_CLOSE() again here. */
VOP_CLOSE(vp, fmode, cred, td);
goto bad;
}