VFS: fix locking bug in clone_opcl
When VFS runs out of vnodes after closing a vnode in opcl, common_open will try to unlock a vnode through unlock_filp that has already been unlocked in clone_opcl. By first obtaining and locking a new vnode this situation is prevented; if there are no free vnodes, common_open will unlock a still locked vnode.
This commit is contained in:
parent
f6b0d662b5
commit
66dbf73049
1 changed files with 14 additions and 16 deletions
|
@ -900,16 +900,14 @@ int clone_opcl(
|
|||
}
|
||||
|
||||
/* Drop old node and use the new values */
|
||||
assert(FD_ISSET(scratch(fp).file.fd_nr, &fp->fp_filp_inuse));
|
||||
vp = fp->fp_filp[scratch(fp).file.fd_nr]->filp_vno;
|
||||
|
||||
unlock_vnode(vp);
|
||||
put_vnode(vp);
|
||||
if ((vp = get_free_vnode()) == NULL)
|
||||
return(err_code);
|
||||
|
||||
lock_vnode(vp, VNODE_OPCL);
|
||||
|
||||
assert(FD_ISSET(scratch(fp).file.fd_nr, &fp->fp_filp_inuse));
|
||||
unlock_vnode(fp->fp_filp[scratch(fp).file.fd_nr]->filp_vno);
|
||||
put_vnode(fp->fp_filp[scratch(fp).file.fd_nr]->filp_vno);
|
||||
|
||||
vp->v_fs_e = res.fs_e;
|
||||
vp->v_vmnt = NULL;
|
||||
vp->v_dev = NO_DEV;
|
||||
|
|
Loading…
Reference in a new issue