More style cleanup. Use ANSI C definition for vn_closefile(). Switch
to VNASSERT in _vn_lock(), simplify messages. Sponsored by: The FreeBSD Foundation X-MFC with: r312600, r312601, r312602, r312606
This commit is contained in:
parent
eacfb4abea
commit
59831bdd34
@ -1538,27 +1538,21 @@ _vn_lock(struct vnode *vp, int flags, char *file, int line)
|
|||||||
int error;
|
int error;
|
||||||
|
|
||||||
VNASSERT((flags & LK_TYPE_MASK) != 0, vp,
|
VNASSERT((flags & LK_TYPE_MASK) != 0, vp,
|
||||||
("vn_lock called with no locktype."));
|
("vn_lock: no locktype"));
|
||||||
#ifdef DEBUG_VFS_LOCKS
|
VNASSERT(vp->v_holdcnt != 0, vp, ("vn_lock: zero hold count"));
|
||||||
KASSERT(vp->v_holdcnt != 0,
|
|
||||||
("vn_lock %p: zero hold count", vp));
|
|
||||||
#endif
|
|
||||||
retry:
|
retry:
|
||||||
error = VOP_LOCK1(vp, flags, file, line);
|
error = VOP_LOCK1(vp, flags, file, line);
|
||||||
flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */
|
flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */
|
||||||
KASSERT((flags & LK_RETRY) == 0 || error == 0,
|
KASSERT((flags & LK_RETRY) == 0 || error == 0,
|
||||||
("LK_RETRY set with incompatible flags (0x%x) or "
|
("vn_lock: error %d incompatible with flags %#x", error, flags));
|
||||||
" an error occurred (%d)", flags, error));
|
|
||||||
|
|
||||||
if ((flags & LK_RETRY) == 0) {
|
if ((flags & LK_RETRY) == 0) {
|
||||||
if (error == 0 && vp->v_iflag & VI_DOOMED) {
|
if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0) {
|
||||||
VOP_UNLOCK(vp, 0);
|
VOP_UNLOCK(vp, 0);
|
||||||
error = ENOENT;
|
error = ENOENT;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (error != 0)
|
||||||
if (error != 0)
|
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1566,9 +1560,7 @@ retry:
|
|||||||
* File table vnode close routine.
|
* File table vnode close routine.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
vn_closefile(fp, td)
|
vn_closefile(struct file *fp, struct thread *td)
|
||||||
struct file *fp;
|
|
||||||
struct thread *td;
|
|
||||||
{
|
{
|
||||||
struct vnode *vp;
|
struct vnode *vp;
|
||||||
struct flock lf;
|
struct flock lf;
|
||||||
@ -1577,12 +1569,14 @@ vn_closefile(fp, td)
|
|||||||
vp = fp->f_vnode;
|
vp = fp->f_vnode;
|
||||||
fp->f_ops = &badfileops;
|
fp->f_ops = &badfileops;
|
||||||
|
|
||||||
if (__predict_false(fp->f_flag & FHASLOCK) && fp->f_type == DTYPE_VNODE)
|
if (__predict_false((fp->f_flag & FHASLOCK) != 0) &&
|
||||||
|
fp->f_type == DTYPE_VNODE)
|
||||||
vrefact(vp);
|
vrefact(vp);
|
||||||
|
|
||||||
error = vn_close(vp, fp->f_flag, fp->f_cred, td);
|
error = vn_close(vp, fp->f_flag, fp->f_cred, td);
|
||||||
|
|
||||||
if (__predict_false(fp->f_flag & FHASLOCK) && fp->f_type == DTYPE_VNODE) {
|
if (__predict_false((fp->f_flag & FHASLOCK) != 0) &&
|
||||||
|
fp->f_type == DTYPE_VNODE) {
|
||||||
lf.l_whence = SEEK_SET;
|
lf.l_whence = SEEK_SET;
|
||||||
lf.l_start = 0;
|
lf.l_start = 0;
|
||||||
lf.l_len = 0;
|
lf.l_len = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user