diff options
author | kan <kan@FreeBSD.org> | 2003-11-19 04:14:42 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2003-11-19 04:14:42 +0000 |
commit | 23ba01be794edbf1f9b407af953ad1d2261345b8 (patch) | |
tree | 5d73ee8570b0a82ddaef4594728473f2807f25be /sys/fs | |
parent | 75a6d15c52bad05737859d9aad8f63b11af0fe4e (diff) | |
download | FreeBSD-src-23ba01be794edbf1f9b407af953ad1d2261345b8.zip FreeBSD-src-23ba01be794edbf1f9b407af953ad1d2261345b8.tar.gz |
Fix vnode locking in fdesc_setattr. Lock vnode before invoking
VOP_SETATTR on it.
Approved by: re@ (rwatson)
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/fdescfs/fdesc_vnops.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index a3e4c12..4f4ab54 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -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); } |