Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/ufs/ext2fs/ext2fs_vnops.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/ufs/ext2fs/ext2fs_vnops.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.75.4.3 retrieving revision 1.76 diff -u -p -r1.75.4.3 -r1.76 --- src/sys/ufs/ext2fs/ext2fs_vnops.c 2008/02/18 21:07:28 1.75.4.3 +++ src/sys/ufs/ext2fs/ext2fs_vnops.c 2007/11/26 19:02:27 1.76 @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_vnops.c,v 1.75.4.3 2008/02/18 21:07:28 mjf Exp $ */ +/* $NetBSD: ext2fs_vnops.c,v 1.76 2007/11/26 19:02:27 pooka Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.75.4.3 2008/02/18 21:07:28 mjf Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.76 2007/11/26 19:02:27 pooka Exp $"); #include #include @@ -189,7 +189,7 @@ ext2fs_mknod(void *v) * checked to see if it is an alias of an existing entry in * the inode cache. */ - VOP_UNLOCK(*vpp, 0); + vput(*vpp); (*vpp)->v_type = VNON; vgone(*vpp); error = VFS_VGET(mp, ino, vpp); @@ -400,7 +400,7 @@ ext2fs_setattr(void *v) default: break; } - error = ext2fs_truncate(vp, vap->va_size, 0, cred); + error = ext2fs_truncate(vp, vap->va_size, 0, cred, l->l_proc); if (error) return (error); } @@ -918,7 +918,7 @@ abortit: if (--xp->i_e2fs_nlink != 0) panic("rename: linked directory"); error = ext2fs_truncate(tvp, (off_t)0, IO_SYNC, - tcnp->cn_cred); + tcnp->cn_cred, tcnp->cn_lwp->l_proc); } xp->i_flag |= IN_CHANGE; VN_KNOTE(tdvp, NOTE_WRITE); @@ -1222,7 +1222,8 @@ ext2fs_rmdir(void *v) * worry about them later. */ ip->i_e2fs_nlink -= 2; - error = ext2fs_truncate(vp, (off_t)0, IO_SYNC, cnp->cn_cred); + error = ext2fs_truncate(vp, (off_t)0, IO_SYNC, cnp->cn_cred, + cnp->cn_lwp->l_proc); cache_purge(ITOV(ip)); out: VN_KNOTE(vp, NOTE_DELETE); @@ -1359,7 +1360,7 @@ ext2fs_vinit(struct mount *mntp, int (** { struct timeval tv; struct inode *ip; - struct vnode *vp; + struct vnode *vp, *nvp; vp = *vpp; ip = VTOI(vp); @@ -1367,7 +1368,25 @@ ext2fs_vinit(struct mount *mntp, int (** case VCHR: case VBLK: vp->v_op = specops; - spec_node_init(vp, fs2h32(ip->i_din.e2fs_din->e2di_rdev)); + if ((nvp = checkalias(vp, + fs2h32(ip->i_din.e2fs_din->e2di_rdev), mntp)) != NULL) { + /* + * Discard unneeded vnode, but save its inode. + */ + nvp->v_data = vp->v_data; + vp->v_data = NULL; + vp->v_vflag &= ~VV_LOCKSWORK; + VOP_UNLOCK(vp, 0); + vp->v_op = spec_vnodeop_p; + vrele(vp); + vgone(vp); + lockmgr(&nvp->v_lock, LK_EXCLUSIVE, &nvp->v_interlock); + /* + * Reinitialize aliased inode. + */ + vp = nvp; + ip->i_vnode = vp; + } break; case VFIFO: vp->v_op = fifoops; @@ -1494,6 +1513,7 @@ const struct vnodeopv_entry_desc ext2fs_ { &vop_setattr_desc, ext2fs_setattr }, /* setattr */ { &vop_read_desc, ext2fs_read }, /* read */ { &vop_write_desc, ext2fs_write }, /* write */ + { &vop_lease_desc, ufs_lease_check }, /* lease */ { &vop_ioctl_desc, ufs_ioctl }, /* ioctl */ { &vop_fcntl_desc, ufs_fcntl }, /* fcntl */ { &vop_poll_desc, ufs_poll }, /* poll */ @@ -1542,6 +1562,7 @@ const struct vnodeopv_entry_desc ext2fs_ { &vop_setattr_desc, ext2fs_setattr }, /* setattr */ { &vop_read_desc, ufsspec_read }, /* read */ { &vop_write_desc, ufsspec_write }, /* write */ + { &vop_lease_desc, spec_lease_check }, /* lease */ { &vop_ioctl_desc, spec_ioctl }, /* ioctl */ { &vop_fcntl_desc, ufs_fcntl }, /* fcntl */ { &vop_poll_desc, spec_poll }, /* poll */ @@ -1590,6 +1611,7 @@ const struct vnodeopv_entry_desc ext2fs_ { &vop_setattr_desc, ext2fs_setattr }, /* setattr */ { &vop_read_desc, ufsfifo_read }, /* read */ { &vop_write_desc, ufsfifo_write }, /* write */ + { &vop_lease_desc, fifo_lease_check }, /* lease */ { &vop_ioctl_desc, fifo_ioctl }, /* ioctl */ { &vop_fcntl_desc, ufs_fcntl }, /* fcntl */ { &vop_poll_desc, fifo_poll }, /* poll */