diff options
| author | Simon L. B. Nielsen <simon@FreeBSD.org> | 2008-02-14 11:44:31 +0000 |
|---|---|---|
| committer | Simon L. B. Nielsen <simon@FreeBSD.org> | 2008-02-14 11:44:31 +0000 |
| commit | 1b7089994ced9be5f5defe4fbeba532847829b6f (patch) | |
| tree | 222b3284491d2eac0031b87892acec39fc669129 /sys | |
| parent | b4437c3d322a0f6d23d12b6f76d2fc72d2ff0ec2 (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/kern/kern_descrip.c | 2 | ||||
| -rw-r--r-- | sys/kern/uipc_syscalls.c | 31 |
2 files changed, 18 insertions, 15 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 7e53062594931..27a5289976c10 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -2050,7 +2050,7 @@ _fgetvp(struct thread *td, int fd, struct vnode **vpp, int flags) int error; *vpp = NULL; - if ((error = _fget(td, fd, &fp, 0, 0)) != 0) + if ((error = _fget(td, fd, &fp, flags, 0)) != 0) return (error); if (fp->f_vnode == NULL) { error = EINVAL; diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 789276e112077..97093766c7b01 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1796,20 +1796,23 @@ kern_sendfile(struct thread *td, struct sendfile_args *uap, goto out; vfslocked = VFS_LOCK_GIANT(vp->v_mount); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - obj = vp->v_object; - if (obj != NULL) { - /* - * Temporarily increase the backing VM object's reference - * count so that a forced reclamation of its vnode does not - * immediately destroy it. - */ - VM_OBJECT_LOCK(obj); - if ((obj->flags & OBJ_DEAD) == 0) { - vm_object_reference_locked(obj); - VM_OBJECT_UNLOCK(obj); - } else { - VM_OBJECT_UNLOCK(obj); - obj = NULL; + if (vp->v_type == VREG) { + obj = vp->v_object; + if (obj != NULL) { + /* + * Temporarily increase the backing VM + * object's reference count so that a forced + * reclamation of its vnode does not + * immediately destroy it. + */ + VM_OBJECT_LOCK(obj); + if ((obj->flags & OBJ_DEAD) == 0) { + vm_object_reference_locked(obj); + VM_OBJECT_UNLOCK(obj); + } else { + VM_OBJECT_UNLOCK(obj); + obj = NULL; + } } } VOP_UNLOCK(vp, 0); |
