Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix_VOP_VPTOCNP_bypass_for_nullfs.diff: Fix /proc/self/exe in nullfs.…

… (Closes: #682291, #681594)
  • Loading branch information...
commit 07d3d9d4812a508fafd1853ffc7e04a24b9e7040 1 parent 3636cc9
rmh authored
4 kfreebsd-9/debian/changelog
View
@@ -1,8 +1,10 @@
kfreebsd-9 (9.0-5) UNRELEASED; urgency=low
* Remove /boot symlink kludge. (Closes: #672255)
+ * fix_VOP_VPTOCNP_bypass_for_nullfs.diff: Fix /proc/self/exe in
+ nullfs. (Closes: #682291, #681594)
- -- Robert Millan <rmh@debian.org> Fri, 15 Jun 2012 22:14:47 +0200
+ -- Robert Millan <rmh@debian.org> Sat, 21 Jul 2012 16:07:17 +0200
kfreebsd-9 (9.0-4) unstable; urgency=high
259 kfreebsd-9/debian/patches/fix_VOP_VPTOCNP_bypass_for_nullfs.diff
View
@@ -0,0 +1,259 @@
+--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
++++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
+@@ -1592,7 +1592,7 @@
+ *ap->a_buflen -= len;
+ bcopy(sep->se_name, ap->a_buf + *ap->a_buflen, len);
+ mutex_exit(&sdp->sd_lock);
+- vhold(dvp);
++ vref(dvp);
+ *ap->a_vpp = dvp;
+ }
+ VN_RELE(dvp);
+--- a/sys/fs/devfs/devfs_vnops.c
++++ b/sys/fs/devfs/devfs_vnops.c
+@@ -261,7 +261,7 @@
+ } else if (vp->v_type == VDIR) {
+ if (dd == dmp->dm_rootdir) {
+ *dvp = vp;
+- vhold(*dvp);
++ vref(*dvp);
+ goto finished;
+ }
+ i -= dd->de_dirent->d_namlen;
+@@ -289,6 +289,8 @@
+ mtx_unlock(&devfs_de_interlock);
+ vholdl(*dvp);
+ VI_UNLOCK(*dvp);
++ vref(*dvp);
++ vdrop(*dvp);
+ } else {
+ mtx_unlock(&devfs_de_interlock);
+ error = ENOENT;
+--- a/sys/fs/nullfs/null_vnops.c
++++ b/sys/fs/nullfs/null_vnops.c
+@@ -784,6 +784,7 @@
+ vhold(lvp);
+ VOP_UNLOCK(vp, 0); /* vp is held by vn_vptocnp_locked that called us */
+ ldvp = lvp;
++ vref(lvp);
+ error = vn_vptocnp(&ldvp, cred, ap->a_buf, ap->a_buflen);
+ vdrop(lvp);
+ if (error != 0) {
+@@ -797,19 +798,17 @@
+ */
+ error = vn_lock(ldvp, LK_EXCLUSIVE);
+ if (error != 0) {
++ vrele(ldvp);
+ vn_lock(vp, locked | LK_RETRY);
+- vdrop(ldvp);
+ return (ENOENT);
+ }
+ vref(ldvp);
+- vdrop(ldvp);
+ error = null_nodeget(vp->v_mount, ldvp, dvp);
+ if (error == 0) {
+ #ifdef DIAGNOSTIC
+ NULLVPTOLOWERVP(*dvp);
+ #endif
+- vhold(*dvp);
+- vput(*dvp);
++ VOP_UNLOCK(*dvp, 0); /* keep reference on *dvp */
+ } else
+ vput(ldvp);
+
+--- a/sys/fs/pseudofs/pseudofs_vnops.c
++++ b/sys/fs/pseudofs/pseudofs_vnops.c
+@@ -410,8 +410,7 @@
+ }
+
+ *buflen = i;
+- vhold(*dvp);
+- vput(*dvp);
++ VOP_UNLOCK(*dvp, 0);
+ vn_lock(vp, locked | LK_RETRY);
+ vfs_unbusy(mp);
+
+--- a/sys/kern/vfs_cache.c
++++ b/sys/kern/vfs_cache.c
+@@ -1067,16 +1067,8 @@
+
+ CACHE_RLOCK();
+ error = vn_vptocnp_locked(vp, cred, buf, buflen);
+- if (error == 0) {
+- /*
+- * vn_vptocnp_locked() dropped hold acquired by
+- * VOP_VPTOCNP immediately after locking the
+- * cache. Since we are going to drop the cache rlock,
+- * re-hold the result.
+- */
+- vhold(*vp);
++ if (error == 0)
+ CACHE_RUNLOCK();
+- }
+ return (error);
+ }
+
+@@ -1095,6 +1087,9 @@
+ if (ncp != NULL) {
+ if (*buflen < ncp->nc_nlen) {
+ CACHE_RUNLOCK();
++ vfslocked = VFS_LOCK_GIANT((*vp)->v_mount);
++ vrele(*vp);
++ VFS_UNLOCK_GIANT(vfslocked);
+ numfullpathfail4++;
+ error = ENOMEM;
+ SDT_PROBE(vfs, namecache, fullpath, return, error,
+@@ -1105,18 +1100,23 @@
+ memcpy(buf + *buflen, ncp->nc_name, ncp->nc_nlen);
+ SDT_PROBE(vfs, namecache, fullpath, hit, ncp->nc_dvp,
+ ncp->nc_name, vp, 0, 0);
++ dvp = *vp;
+ *vp = ncp->nc_dvp;
++ vref(*vp);
++ CACHE_RUNLOCK();
++ vfslocked = VFS_LOCK_GIANT(dvp->v_mount);
++ vrele(dvp);
++ VFS_UNLOCK_GIANT(vfslocked);
++ CACHE_RLOCK();
+ return (0);
+ }
+ SDT_PROBE(vfs, namecache, fullpath, miss, vp, 0, 0, 0, 0);
+
+- vhold(*vp);
+ CACHE_RUNLOCK();
+ vfslocked = VFS_LOCK_GIANT((*vp)->v_mount);
+ vn_lock(*vp, LK_SHARED | LK_RETRY);
+ error = VOP_VPTOCNP(*vp, &dvp, cred, buf, buflen);
+- VOP_UNLOCK(*vp, 0);
+- vdrop(*vp);
++ vput(*vp);
+ VFS_UNLOCK_GIANT(vfslocked);
+ if (error) {
+ numfullpathfail2++;
+@@ -1127,16 +1127,20 @@
+
+ *vp = dvp;
+ CACHE_RLOCK();
+- if ((*vp)->v_iflag & VI_DOOMED) {
++ if (dvp->v_iflag & VI_DOOMED) {
+ /* forced unmount */
+ CACHE_RUNLOCK();
+- vdrop(*vp);
++ vfslocked = VFS_LOCK_GIANT(dvp->v_mount);
++ vrele(dvp);
++ VFS_UNLOCK_GIANT(vfslocked);
+ error = ENOENT;
+ SDT_PROBE(vfs, namecache, fullpath, return, error, vp,
+ NULL, 0, 0);
+ return (error);
+ }
+- vdrop(*vp);
++ /*
++ * *vp has its use count incremented still.
++ */
+
+ return (0);
+ }
+@@ -1148,10 +1152,11 @@
+ vn_fullpath1(struct thread *td, struct vnode *vp, struct vnode *rdir,
+ char *buf, char **retbuf, u_int buflen)
+ {
+- int error, slash_prefixed;
++ int error, slash_prefixed, vfslocked;
+ #ifdef KDTRACE_HOOKS
+ struct vnode *startvp = vp;
+ #endif
++ struct vnode *vp1;
+
+ buflen--;
+ buf[buflen] = '\0';
+@@ -1160,6 +1165,7 @@
+
+ SDT_PROBE(vfs, namecache, fullpath, entry, vp, 0, 0, 0, 0);
+ numfullpathcalls++;
++ vref(vp);
+ CACHE_RLOCK();
+ if (vp->v_type != VDIR) {
+ error = vn_vptocnp_locked(&vp, td->td_ucred, buf, &buflen);
+@@ -1167,6 +1173,9 @@
+ return (error);
+ if (buflen == 0) {
+ CACHE_RUNLOCK();
++ vfslocked = VFS_LOCK_GIANT(vp->v_mount);
++ vrele(vp);
++ VFS_UNLOCK_GIANT(vfslocked);
+ return (ENOMEM);
+ }
+ buf[--buflen] = '/';
+@@ -1176,16 +1185,29 @@
+ if (vp->v_vflag & VV_ROOT) {
+ if (vp->v_iflag & VI_DOOMED) { /* forced unmount */
+ CACHE_RUNLOCK();
++ vfslocked = VFS_LOCK_GIANT(vp->v_mount);
++ vrele(vp);
++ VFS_UNLOCK_GIANT(vfslocked);
+ error = ENOENT;
+ SDT_PROBE(vfs, namecache, fullpath, return,
+ error, vp, NULL, 0, 0);
+ break;
+ }
+- vp = vp->v_mount->mnt_vnodecovered;
++ vp1 = vp->v_mount->mnt_vnodecovered;
++ vref(vp1);
++ CACHE_RUNLOCK();
++ vfslocked = VFS_LOCK_GIANT(vp->v_mount);
++ vrele(vp);
++ VFS_UNLOCK_GIANT(vfslocked);
++ vp = vp1;
++ CACHE_RLOCK();
+ continue;
+ }
+ if (vp->v_type != VDIR) {
+ CACHE_RUNLOCK();
++ vfslocked = VFS_LOCK_GIANT(vp->v_mount);
++ vrele(vp);
++ VFS_UNLOCK_GIANT(vfslocked);
+ numfullpathfail1++;
+ error = ENOTDIR;
+ SDT_PROBE(vfs, namecache, fullpath, return,
+@@ -1197,6 +1219,9 @@
+ break;
+ if (buflen == 0) {
+ CACHE_RUNLOCK();
++ vfslocked = VFS_LOCK_GIANT(vp->v_mount);
++ vrele(vp);
++ VFS_UNLOCK_GIANT(vfslocked);
+ error = ENOMEM;
+ SDT_PROBE(vfs, namecache, fullpath, return, error,
+ startvp, NULL, 0, 0);
+@@ -1210,6 +1235,9 @@
+ if (!slash_prefixed) {
+ if (buflen == 0) {
+ CACHE_RUNLOCK();
++ vfslocked = VFS_LOCK_GIANT(vp->v_mount);
++ vrele(vp);
++ VFS_UNLOCK_GIANT(vfslocked);
+ numfullpathfail4++;
+ SDT_PROBE(vfs, namecache, fullpath, return, ENOMEM,
+ startvp, NULL, 0, 0);
+@@ -1219,6 +1247,9 @@
+ }
+ numfullpathfound++;
+ CACHE_RUNLOCK();
++ vfslocked = VFS_LOCK_GIANT(vp->v_mount);
++ vrele(vp);
++ VFS_UNLOCK_GIANT(vfslocked);
+
+ SDT_PROBE(vfs, namecache, fullpath, return, 0, startvp, buf + buflen,
+ 0, 0);
+--- a/sys/kern/vfs_default.c
++++ b/sys/kern/vfs_default.c
+@@ -843,7 +843,7 @@
+ free(dirbuf, M_TEMP);
+ if (!error) {
+ *buflen = i;
+- vhold(*dvp);
++ vref(*dvp);
+ }
+ if (covered) {
+ vput(*dvp);
1  kfreebsd-9/debian/patches/series
View
@@ -4,6 +4,7 @@ remove_tmpfs_warning.diff
amd64_increase_DFLDSIZ.diff
SA-12_04.sysret.patch
EN-12_02.ipv6refcount.patch
+fix_VOP_VPTOCNP_bypass_for_nullfs.diff
# Other patches that might or might not be mergeable
001_misc.diff
2  kfreebsd-9/debian/rules
View
@@ -20,7 +20,7 @@ cpu := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
config_files := $(wildcard debian/arch/$(cpu)/*.config)
flavours := $(config_files:debian/arch/$(cpu)/%.config=%)
configfile := DEBCUSTOM
-abiname := 1
+abiname := 2
ld_target := $(shell ld --help | sed -ne "s/[^ :]*: supported targets: \([^ ]*\) .*/\1/p")
gcc_version := 4.6
Please sign in to comment.
Something went wrong with that request. Please try again.