Fix vnode locking in fdesc_setattr. Lock vnode before invoking

VOP_SETATTR on it.

Approved by:	re@ (rwatson)
This commit is contained in:
Alexander Kabaev 2003-11-19 04:14:42 +00:00
parent 501f5ff123
commit c391349841
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=122893

View File

@ -395,12 +395,12 @@ fdesc_setattr(ap)
return (error);
}
vp = fp->f_vnode;
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) {
fdrop(fp, ap->a_td);
return (error);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, ap->a_td);
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) == 0) {
error = VOP_SETATTR(vp, ap->a_vap, ap->a_cred, ap->a_td);
vn_finished_write(mp);
}
error = VOP_SETATTR(vp, ap->a_vap, ap->a_cred, ap->a_td);
vn_finished_write(mp);
VOP_UNLOCK(vp, 0, ap->a_td);
fdrop(fp, ap->a_td);
return (error);
}