Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Jan 2008 22:13:31 GMT
From:      John Birrell <jb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 134416 for review
Message-ID:  <200801292213.m0TMDVwv031674@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=134416

Change 134416 by jb@jb_freebsd1 on 2008/01/29 22:13:29

	Undo the over lerge of the locking changes from current.

Affected files ...

.. //depot/projects/dtrace7/src/sys/compat/opensolaris/kern/opensolaris_kobj.c#3 edit
.. //depot/projects/dtrace7/src/sys/compat/opensolaris/kern/opensolaris_vfs.c#4 edit
.. //depot/projects/dtrace7/src/sys/compat/opensolaris/sys/vnode.h#3 edit
.. //depot/projects/dtrace7/src/sys/contrib/opensolaris/uts/common/fs/gfs.c#4 edit
.. //depot/projects/dtrace7/src/sys/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c#4 edit
.. //depot/projects/dtrace7/src/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c#4 edit
.. //depot/projects/dtrace7/src/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c#4 edit
.. //depot/projects/dtrace7/src/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c#4 edit
.. //depot/projects/dtrace7/src/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c#4 edit
.. //depot/projects/dtrace7/src/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c#4 edit

Differences ...

==== //depot/projects/dtrace7/src/sys/compat/opensolaris/kern/opensolaris_kobj.c#3 (text+ko) ====

@@ -77,12 +77,12 @@
 
 	flags = FREAD;
 	NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, file, td);
-	error = vn_open_cred(&nd, &flags, 0, curthread->td_ucred, NULL);
+	error = vn_open_cred(&nd, &flags, 0, td->td_ucred, NULL);
 	NDFREE(&nd, NDF_ONLY_PNBUF);
 	if (error != 0)
 		return (NULL);
 	/* We just unlock so we hold a reference. */
-	VOP_UNLOCK(nd.ni_vp, 0);
+	VOP_UNLOCK(nd.ni_vp, 0, td);
 	return (nd.ni_vp);
 }
 
@@ -123,9 +123,9 @@
 	struct vattr va;
 	int error;
 
-	vn_lock(vp, LK_SHARED | LK_RETRY);
+	vn_lock(vp, LK_SHARED | LK_RETRY, td);
 	error = VOP_GETATTR(vp, &va, td->td_ucred, td);
-	VOP_UNLOCK(vp, 0);
+	VOP_UNLOCK(vp, 0, td);
 	if (error == 0)
 		*size = (uint64_t)va.va_size;
 	return (error);
@@ -176,9 +176,9 @@
 	auio.uio_resid = size;
 	auio.uio_td = td;
 
-	vn_lock(vp, LK_SHARED | LK_RETRY);
+	vn_lock(vp, LK_SHARED | LK_RETRY, td);
 	error = VOP_READ(vp, &auio, IO_UNIT | IO_SYNC, td->td_ucred);
-	VOP_UNLOCK(vp, 0);
+	VOP_UNLOCK(vp, 0, td);
 	return (error != 0 ? -1 : size - auio.uio_resid);
 }
 

==== //depot/projects/dtrace7/src/sys/compat/opensolaris/kern/opensolaris_vfs.c#4 (text+ko) ====

@@ -192,9 +192,9 @@
 	/*
 	 * Allocate and initialize the filesystem.
 	 */
-	vn_lock(vp, LK_SHARED | LK_RETRY);
+	vn_lock(vp, LK_SHARED | LK_RETRY, td);
 	mp = vfs_mount_alloc(vp, vfsp, fspath, td);
-	VOP_UNLOCK(vp, 0);
+	VOP_UNLOCK(vp, 0, td);
 
 	mp->mnt_optnew = NULL;
 	vfs_setmntopt(mp, "from", fspec, 0);
@@ -238,7 +238,7 @@
 	 * mnt_optnew.
 	*/
 	mp->mnt_optnew = NULL;
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
 	/*
 	 * Put the new filesystem on the mount list after root.
 	 */
@@ -260,7 +260,7 @@
 			panic("mount: lost mount");
 		mountcheckdirs(vp, mvp);
 		vput(mvp);
-		VOP_UNLOCK(vp, 0);
+		VOP_UNLOCK(vp, 0, td);
 		if ((mp->mnt_flag & MNT_RDONLY) == 0)
 			error = vfs_allocate_syncvnode(mp);
 		vfs_unbusy(mp, td);
@@ -272,7 +272,7 @@
 		VI_LOCK(vp);
 		vp->v_iflag &= ~VI_MOUNT;
 		VI_UNLOCK(vp);
-		VOP_UNLOCK(vp, 0);
+		VOP_UNLOCK(vp, 0, td);
 		vfs_unbusy(mp, td);
 		vfs_mount_destroy(mp);
 	}

==== //depot/projects/dtrace7/src/sys/compat/opensolaris/sys/vnode.h#3 (text+ko) ====

@@ -175,7 +175,7 @@
 	if (error == 0) {
 		/* We just unlock so we hold a reference. */
 		VN_HOLD(nd.ni_vp);
-		VOP_UNLOCK(nd.ni_vp, 0);
+		VOP_UNLOCK(nd.ni_vp, 0, td);
 		*vpp = nd.ni_vp;
 	}
 	return (error);
@@ -213,6 +213,7 @@
 static __inline int
 zfs_vop_fsync(vnode_t *vp, int flag, cred_t *cr)
 {
+	struct thread *td = curthread;
 	struct mount *mp;
 	int error, vfslocked;
 
@@ -221,9 +222,9 @@
 	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
 		goto drop;
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-	error = VOP_FSYNC(vp, MNT_WAIT, curthread);
-	VOP_UNLOCK(vp, 0);
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+	error = VOP_FSYNC(vp, MNT_WAIT, td);
+	VOP_UNLOCK(vp, 0, td);
 	vn_finished_write(mp);
 drop:
 	VFS_UNLOCK_GIANT(vfslocked);

==== //depot/projects/dtrace7/src/sys/contrib/opensolaris/uts/common/fs/gfs.c#4 (text+ko) ====

@@ -321,7 +321,7 @@
 			VN_HOLD(pvp);
 			*vpp = pvp;
 		}
-		vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
+		vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, curthread);
 		return (0);
 	}
 

==== //depot/projects/dtrace7/src/sys/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c#4 (text+ko) ====

@@ -207,7 +207,7 @@
 				ctx->gc_state = 2;
 				wakeup_one(&ctx->gc_state);
 				mtx_unlock(&ctx->gc_queue_mtx);
-				kproc_exit(0);
+				kthread_exit(0);
 			}
 			msleep(&ctx->gc_queue, &ctx->gc_queue_mtx,
 			    PRIBIO | PDROP, "vgeom:io", 0);
@@ -440,7 +440,7 @@
 
 	vd->vdev_tsd = ctx;
 
-	kproc_create(vdev_geom_worker, ctx, NULL, 0, 0, "vdev:worker %s",
+	kthread_create(vdev_geom_worker, ctx, NULL, 0, 0, "vdev:worker %s",
 	    pp->name);
 
 	return (0);

==== //depot/projects/dtrace7/src/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c#4 (text+ko) ====

@@ -391,7 +391,7 @@
 	if (strcmp(nm, "..") == 0) {
 		err = VFS_ROOT(dvp->v_vfsp, LK_EXCLUSIVE, vpp, curthread);
 		if (err == 0)
-			VOP_UNLOCK(*vpp, 0);
+			VOP_UNLOCK(*vpp, 0, curthread);
 	} else {
 		err = gfs_dir_lookup(dvp, nm, vpp);
 	}
@@ -429,7 +429,7 @@
 
 	err = zfsctl_root_lookup(dvp, nm, vpp, NULL, 0, NULL, cr);
 	if (err == 0 && (nm[0] != '.' || nm[1] != '\0'))
-		vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
+		vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, curthread);
 
 	return (err);
 }
@@ -692,7 +692,7 @@
 			 */
 			goto domount;
 		}
-		vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
+		vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, curthread);
 		mutex_exit(&sdp->sd_lock);
 		ZFS_EXIT(zfsvfs);
 		return (0);
@@ -732,7 +732,7 @@
 	kmem_free(mountpoint, mountpoint_len);
 	/* FreeBSD: This line was moved from below to avoid a lock recursion. */
 	if (err == 0)
-		vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
+		vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, curthread);
 	mutex_exit(&sdp->sd_lock);
 
 	/*
@@ -882,7 +882,7 @@
 
 	VERIFY(gfs_dir_lookup(vp, "..", &dvp) == 0);
 	sdp = dvp->v_data;
-	VOP_UNLOCK(dvp, 0);
+	VOP_UNLOCK(dvp, 0, curthread);
 
 	if (!(locked = MUTEX_HELD(&sdp->sd_lock)))
 		mutex_enter(&sdp->sd_lock);

==== //depot/projects/dtrace7/src/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c#4 (text+ko) ====

@@ -109,7 +109,7 @@
 	cn.cn_thread = curthread;
 	cn.cn_flags = SAVENAME;
 
-	vn_lock(ZTOV(dzp), LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(ZTOV(dzp), LK_EXCLUSIVE | LK_RETRY, curthread);
 	switch ((int)lr->lr_common.lrc_txtype) {
 	case TX_CREATE:
 		error = VOP_CREATE(ZTOV(dzp), &vp, &cn, &va);
@@ -127,10 +127,10 @@
 	default:
 		error = ENOTSUP;
 	}
-	VOP_UNLOCK(ZTOV(dzp), 0);
+	VOP_UNLOCK(ZTOV(dzp), 0, curthread);
 
 	if (error == 0 && vp != NULL) {
-		VOP_UNLOCK(vp, 0);
+		VOP_UNLOCK(vp, 0, curthread);
 		VN_RELE(vp);
 	}
 
@@ -162,10 +162,10 @@
 	cn.cn_lkflags = LK_EXCLUSIVE | LK_RETRY;
 	cn.cn_cred = kcred;
 	cn.cn_thread = curthread;
-	vn_lock(ZTOV(dzp), LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(ZTOV(dzp), LK_EXCLUSIVE | LK_RETRY, curthread);
 	error = VOP_LOOKUP(ZTOV(dzp), &vp, &cn);
 	if (error != 0) {
-		VOP_UNLOCK(ZTOV(dzp), 0);
+		VOP_UNLOCK(ZTOV(dzp), 0, curthread);
 		goto fail;
 	}
 
@@ -180,7 +180,7 @@
 		error = ENOTSUP;
 	}
 	vput(vp);
-	VOP_UNLOCK(ZTOV(dzp), 0);
+	VOP_UNLOCK(ZTOV(dzp), 0, curthread);
 fail:
 	VN_RELE(ZTOV(dzp));
 
@@ -211,11 +211,11 @@
 	cn.cn_thread = curthread;
 	cn.cn_flags = SAVENAME;
 
-	vn_lock(ZTOV(dzp), LK_EXCLUSIVE | LK_RETRY);
-	vn_lock(ZTOV(zp), LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(ZTOV(dzp), LK_EXCLUSIVE | LK_RETRY, curthread);
+	vn_lock(ZTOV(zp), LK_EXCLUSIVE | LK_RETRY, curthread);
 	error = VOP_LINK(ZTOV(dzp), ZTOV(zp), &cn);
-	VOP_UNLOCK(ZTOV(zp), 0);
-	VOP_UNLOCK(ZTOV(dzp), 0);
+	VOP_UNLOCK(ZTOV(zp), 0, curthread);
+	VOP_UNLOCK(ZTOV(dzp), 0, curthread);
 
 	VN_RELE(ZTOV(zp));
 	VN_RELE(ZTOV(dzp));
@@ -255,12 +255,12 @@
 	scn.cn_lkflags = LK_EXCLUSIVE | LK_RETRY;
 	scn.cn_cred = kcred;
 	scn.cn_thread = td;
-	vn_lock(ZTOV(sdzp), LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(ZTOV(sdzp), LK_EXCLUSIVE | LK_RETRY, curthread);
 	error = VOP_LOOKUP(ZTOV(sdzp), &svp, &scn);
-	VOP_UNLOCK(ZTOV(sdzp), 0);
+	VOP_UNLOCK(ZTOV(sdzp), 0, curthread);
 	if (error != 0)
 		goto fail;
-	VOP_UNLOCK(svp, 0);
+	VOP_UNLOCK(svp, 0, curthread);
 
 	bzero(&tcn, sizeof(tcn));
 	tcn.cn_nameptr = tname;
@@ -270,12 +270,12 @@
 	tcn.cn_lkflags = LK_EXCLUSIVE | LK_RETRY;
 	tcn.cn_cred = kcred;
 	tcn.cn_thread = td;
-	vn_lock(ZTOV(tdzp), LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(ZTOV(tdzp), LK_EXCLUSIVE | LK_RETRY, curthread);
 	error = VOP_LOOKUP(ZTOV(tdzp), &tvp, &tcn);
 	if (error == EJUSTRETURN)
 		tvp = NULL;
 	else if (error != 0) {
-		VOP_UNLOCK(ZTOV(tdzp), 0);
+		VOP_UNLOCK(ZTOV(tdzp), 0, curthread);
 		goto fail;
 	}
 
@@ -360,9 +360,9 @@
 	ZFS_TIME_DECODE(&va.va_mtime, lr->lr_mtime);
 
 	vp = ZTOV(zp);
-	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread);
 	error = VOP_SETATTR(vp, &va, kcred, curthread);
-	VOP_UNLOCK(vp, 0);
+	VOP_UNLOCK(vp, 0, curthread);
 	VN_RELE(vp);
 
 	return (error);

==== //depot/projects/dtrace7/src/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c#4 (text+ko) ====

@@ -663,7 +663,7 @@
 	error = zfs_zget(zfsvfs, zfsvfs->z_root, &rootzp);
 	if (error == 0) {
 		*vpp = ZTOV(rootzp);
-		error = vn_lock(*vpp, flags);
+		error = vn_lock(*vpp, flags, td);
 		(*vpp)->v_vflag |= VV_ROOT;
 	}
 
@@ -763,7 +763,7 @@
 		*vpp = NULL;
 	else {
 		*vpp = ZTOV(zp);
-		vn_lock(*vpp, flags);
+		vn_lock(*vpp, flags, curthread);
 	}
 	ZFS_EXIT(zfsvfs);
 	return (err);
@@ -830,7 +830,7 @@
 		}
 		ZFS_EXIT(zfsvfs);
 		/* XXX: LK_RETRY? */
-		vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
+		vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, td);
 		return (0);
 	}
 
@@ -853,7 +853,7 @@
 
 	*vpp = ZTOV(zp);
 	/* XXX: LK_RETRY? */
-	vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, td);
 	vnode_create_vobject(*vpp, zp->z_phys->zp_size, td);
 	ZFS_EXIT(zfsvfs);
 	return (0);

==== //depot/projects/dtrace7/src/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c#4 (text+ko) ====

@@ -1114,11 +1114,11 @@
 
 		if (cnp->cn_flags & ISDOTDOT) {
 			ltype = VOP_ISLOCKED(dvp, td);
-			VOP_UNLOCK(dvp, 0);
+			VOP_UNLOCK(dvp, 0, td);
 		}
-		error = vn_lock(*vpp, cnp->cn_lkflags);
+		error = vn_lock(*vpp, cnp->cn_lkflags, td);
 		if (cnp->cn_flags & ISDOTDOT)
-			vn_lock(dvp, ltype | LK_RETRY);
+			vn_lock(dvp, ltype | LK_RETRY, td);
 		if (error != 0) {
 			VN_RELE(*vpp);
 			*vpp = NULL;
@@ -1302,7 +1302,7 @@
 
 	if (error == 0) {
 		*vpp = ZTOV(zp);
-		vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
+		vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, td);
 	}
 
 	if (dl)
@@ -1584,7 +1584,7 @@
 	zfs_log_create(zilog, tx, TX_MKDIR, dzp, zp, dirname);
 	dmu_tx_commit(tx);
 
-	vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, curthread);
 
 	zfs_dirent_unlock(dl);
 
@@ -2769,7 +2769,7 @@
 	if (error == 0) {
 		zfs_log_symlink(zilog, tx, TX_SYMLINK, dzp, zp, name, link);
 		*vpp = ZTOV(zp);
-		vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
+		vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, td);
 	}
 
 	dmu_tx_commit(tx);

==== //depot/projects/dtrace7/src/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c#4 (text+ko) ====

@@ -85,9 +85,9 @@
 		ZTOV(zp) = NULL;
 		vhold(vp);
 		mutex_exit(&zp->z_lock);
-		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread);
 		vrecycle(vp, curthread);
-		VOP_UNLOCK(vp, 0);
+		VOP_UNLOCK(vp, 0, curthread);
 		vdrop(vp);
 		zfs_znode_free(zp);
 	} else {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801292213.m0TMDVwv031674>