kernel: Use fhold() instead of increasing f_count manually
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 15 Sep 2015 12:49:30 +0000 (20:49 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 16 Sep 2015 05:52:23 +0000 (13:52 +0800)
sys/netgraph/socket/ng_socket.c
sys/vfs/nfs/nfs_syscalls.c
sys/vfs/portal/portal_vfsops.c

index 372076d..835164b 100644 (file)
@@ -618,7 +618,7 @@ ng_internalize(struct mbuf *control, struct thread *td)
                vn = (struct vnode *) fp->f_data;
                if (vn && (vn->v_type == VCHR)) {
                        /* for a VCHR, actually reference the FILE */
-                       fp->f_count++;
+                       fhold(fp);
                        /* XXX then what :) */
                        /* how to pass on to other modules? */
                } else {
index c11142c..ac4936a 100644 (file)
@@ -420,7 +420,7 @@ nfssvc_addsock(struct file *fp, struct sockaddr *mynam, struct thread *td)
 
        slp->ns_so = so;
        slp->ns_nam = mynam;
-       fp->f_count++;
+       fhold(fp);
        slp->ns_fp = fp;
 
        so->so_upcallarg = (caddr_t)slp;
index 9643b88..1712478 100644 (file)
@@ -121,7 +121,8 @@ portal_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred)
        VTOPORTAL(rvp)->pt_size = 0;
        VTOPORTAL(rvp)->pt_fileid = PORTAL_ROOTFILEID;
        fmp->pm_root = rvp;
-       fmp->pm_server = fp; fp->f_count++;
+       fmp->pm_server = fp;
+       fhold(fp);
 
        mp->mnt_flag |= MNT_LOCAL;
        mp->mnt_data = (qaddr_t) fmp;