PERFORCE change 161775 for review
Marko Zec
zec at FreeBSD.org
Fri May 8 14:47:08 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=161775
Change 161775 by zec at zec_tpx32 on 2009/05/08 14:46:23
IFC @ 161774
Affected files ...
.. //depot/projects/vimage-commit/src/sys/amd64/linux32/linux.h#6 integrate
.. //depot/projects/vimage-commit/src/sys/amd64/linux32/linux32_sysvec.c#8 integrate
.. //depot/projects/vimage-commit/src/sys/arm/arm/pmap.c#5 integrate
.. //depot/projects/vimage-commit/src/sys/arm/conf/NSLU.hints#3 integrate
.. //depot/projects/vimage-commit/src/sys/arm/include/pmap.h#4 integrate
.. //depot/projects/vimage-commit/src/sys/cddl/compat/opensolaris/kern/opensolaris.c#4 integrate
.. //depot/projects/vimage-commit/src/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c#7 integrate
.. //depot/projects/vimage-commit/src/sys/cddl/compat/opensolaris/sys/vnode.h#6 integrate
.. //depot/projects/vimage-commit/src/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c#2 integrate
.. //depot/projects/vimage-commit/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c#4 integrate
.. //depot/projects/vimage-commit/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c#4 integrate
.. //depot/projects/vimage-commit/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c#6 integrate
.. //depot/projects/vimage-commit/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c#4 integrate
.. //depot/projects/vimage-commit/src/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h#2 integrate
.. //depot/projects/vimage-commit/src/sys/compat/linux/linux_futex.c#8 integrate
.. //depot/projects/vimage-commit/src/sys/compat/linux/linux_ioctl.c#11 integrate
.. //depot/projects/vimage-commit/src/sys/compat/linux/linux_mib.c#5 integrate
.. //depot/projects/vimage-commit/src/sys/compat/linux/linux_mib.h#3 integrate
.. //depot/projects/vimage-commit/src/sys/compat/linux/linux_misc.c#13 integrate
.. //depot/projects/vimage-commit/src/sys/compat/linux/linux_socket.c#11 integrate
.. //depot/projects/vimage-commit/src/sys/compat/linux/linux_socket.h#4 integrate
.. //depot/projects/vimage-commit/src/sys/compat/linux/linux_stats.c#5 integrate
.. //depot/projects/vimage-commit/src/sys/compat/linux/linux_util.h#3 integrate
.. //depot/projects/vimage-commit/src/sys/compat/svr4/svr4_stat.c#9 integrate
.. //depot/projects/vimage-commit/src/sys/dev/ata/ata-pci.h#8 integrate
.. //depot/projects/vimage-commit/src/sys/dev/ata/chipsets/ata-siliconimage.c#4 integrate
.. //depot/projects/vimage-commit/src/sys/dev/ath/ah_osdep.c#6 integrate
.. //depot/projects/vimage-commit/src/sys/dev/ath/ah_osdep.h#4 integrate
.. //depot/projects/vimage-commit/src/sys/dev/ath/ath_hal/ar5211/ar5211_interrupts.c#2 integrate
.. //depot/projects/vimage-commit/src/sys/dev/ath/ath_hal/ar5212/ar5212_interrupts.c#2 integrate
.. //depot/projects/vimage-commit/src/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c#2 integrate
.. //depot/projects/vimage-commit/src/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c#2 integrate
.. //depot/projects/vimage-commit/src/sys/dev/ath/if_ath.c#9 integrate
.. //depot/projects/vimage-commit/src/sys/dev/ipw/if_ipw.c#7 integrate
.. //depot/projects/vimage-commit/src/sys/dev/iwi/if_iwi.c#6 integrate
.. //depot/projects/vimage-commit/src/sys/dev/sound/pci/ich.c#3 integrate
.. //depot/projects/vimage-commit/src/sys/dev/ubsec/ubsec.c#3 integrate
.. //depot/projects/vimage-commit/src/sys/dev/ubsec/ubsecreg.h#3 integrate
.. //depot/projects/vimage-commit/src/sys/dev/usb/serial/u3g.c#4 integrate
.. //depot/projects/vimage-commit/src/sys/geom/vinum/geom_vinum.c#7 integrate
.. //depot/projects/vimage-commit/src/sys/geom/vinum/geom_vinum.h#6 integrate
.. //depot/projects/vimage-commit/src/sys/geom/vinum/geom_vinum_plex.c#7 integrate
.. //depot/projects/vimage-commit/src/sys/geom/vinum/geom_vinum_raid5.c#6 integrate
.. //depot/projects/vimage-commit/src/sys/geom/vinum/geom_vinum_var.h#7 integrate
.. //depot/projects/vimage-commit/src/sys/i386/ibcs2/ibcs2_socksys.c#8 integrate
.. //depot/projects/vimage-commit/src/sys/i386/linux/linux.h#5 integrate
.. //depot/projects/vimage-commit/src/sys/i386/linux/linux_sysvec.c#8 integrate
.. //depot/projects/vimage-commit/src/sys/kern/init_main.c#12 integrate
.. //depot/projects/vimage-commit/src/sys/kern/kern_exit.c#10 integrate
.. //depot/projects/vimage-commit/src/sys/kern/kern_fork.c#11 integrate
.. //depot/projects/vimage-commit/src/sys/kern/kern_jail.c#14 integrate
.. //depot/projects/vimage-commit/src/sys/kern/kern_linker.c#10 integrate
.. //depot/projects/vimage-commit/src/sys/kern/kern_mib.c#13 integrate
.. //depot/projects/vimage-commit/src/sys/kern/kern_prot.c#10 integrate
.. //depot/projects/vimage-commit/src/sys/kern/kern_vimage.c#17 integrate
.. //depot/projects/vimage-commit/src/sys/kern/tty_ttydisc.c#5 integrate
.. //depot/projects/vimage-commit/src/sys/kern/uipc_socket.c#12 integrate
.. //depot/projects/vimage-commit/src/sys/kern/uipc_syscalls.c#8 integrate
.. //depot/projects/vimage-commit/src/sys/kern/vfs_vnops.c#8 integrate
.. //depot/projects/vimage-commit/src/sys/modules/linux/Makefile#4 integrate
.. //depot/projects/vimage-commit/src/sys/netinet/igmp.c#23 integrate
.. //depot/projects/vimage-commit/src/sys/netinet/sctp_crc32.c#6 integrate
.. //depot/projects/vimage-commit/src/sys/netinet/sctp_uio.h#9 integrate
.. //depot/projects/vimage-commit/src/sys/netinet/tcp_hostcache.c#13 integrate
.. //depot/projects/vimage-commit/src/sys/nlm/nlm_advlock.c#7 integrate
.. //depot/projects/vimage-commit/src/sys/sys/buf_ring.h#3 integrate
.. //depot/projects/vimage-commit/src/sys/sys/jail.h#9 integrate
.. //depot/projects/vimage-commit/src/sys/sys/kernel.h#10 integrate
.. //depot/projects/vimage-commit/src/sys/sys/param.h#20 integrate
.. //depot/projects/vimage-commit/src/sys/sys/proc.h#11 integrate
.. //depot/projects/vimage-commit/src/sys/sys/sysctl.h#12 integrate
.. //depot/projects/vimage-commit/src/sys/sys/termios.h#7 integrate
.. //depot/projects/vimage-commit/src/sys/sys/ucred.h#6 integrate
.. //depot/projects/vimage-commit/src/sys/sys/vimage.h#25 integrate
.. //depot/projects/vimage-commit/src/sys/vm/vm_fault.c#6 integrate
Differences ...
==== //depot/projects/vimage-commit/src/sys/amd64/linux32/linux.h#6 (text+ko) ====
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/amd64/linux32/linux.h,v 1.25 2009/03/27 17:00:49 ambrisko Exp $
+ * $FreeBSD: src/sys/amd64/linux32/linux.h,v 1.26 2009/05/07 09:39:20 dchagin Exp $
*/
#ifndef _AMD64_LINUX_H_
@@ -669,14 +669,6 @@
#define LINUX_SENDMSG 16
#define LINUX_RECVMSG 17
-#define LINUX_AF_UNSPEC 0
-#define LINUX_AF_UNIX 1
-#define LINUX_AF_INET 2
-#define LINUX_AF_AX25 3
-#define LINUX_AF_IPX 4
-#define LINUX_AF_APPLETALK 5
-#define LINUX_AF_INET6 10
-
#define LINUX_SOL_SOCKET 1
#define LINUX_SOL_IP 0
#define LINUX_SOL_IPX 256
==== //depot/projects/vimage-commit/src/sys/amd64/linux32/linux32_sysvec.c#8 (text+ko) ====
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_sysvec.c,v 1.48 2009/05/02 10:06:49 dchagin Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_sysvec.c,v 1.49 2009/05/07 18:36:47 jamie Exp $");
#include "opt_compat.h"
#ifndef COMPAT_IA32
@@ -1124,6 +1124,7 @@
linux_proc_exec, NULL, 1000);
linux_szplatform = roundup(strlen(linux_platform) + 1,
sizeof(char *));
+ linux_osd_jail_register();
if (bootverbose)
printf("Linux ELF exec handler installed\n");
} else
@@ -1151,6 +1152,7 @@
EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
EVENTHANDLER_DEREGISTER(schedtail, linux_schedtail_tag);
EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);
+ linux_osd_jail_deregister();
if (bootverbose)
printf("Linux ELF exec handler removed\n");
} else
==== //depot/projects/vimage-commit/src/sys/arm/arm/pmap.c#5 (text+ko) ====
@@ -147,7 +147,7 @@
#include "opt_vm.h"
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/arm/pmap.c,v 1.107 2009/02/02 20:09:14 cognet Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/arm/pmap.c,v 1.108 2009/05/07 05:42:13 alc Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@@ -224,7 +224,6 @@
vm_offset_t kernel_vm_end = 0;
struct pmap kernel_pmap_store;
-pmap_t kernel_pmap;
static pt_entry_t *csrc_pte, *cdst_pte;
static vm_offset_t csrcp, cdstp;
@@ -2337,7 +2336,6 @@
firstaddr, loadaddr));
virtual_avail = firstaddr;
- kernel_pmap = &kernel_pmap_store;
kernel_pmap->pm_l1 = l1;
kernel_l1pa = l1pt->pv_pa;
==== //depot/projects/vimage-commit/src/sys/arm/conf/NSLU.hints#3 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/arm/conf/NSLU.hints,v 1.1 2008/08/03 07:10:25 imp Exp $
+# $FreeBSD: src/sys/arm/conf/NSLU.hints,v 1.2 2009/05/06 20:24:17 cognet Exp $
#
# Device wiring for the Linksys NSLU2
@@ -17,17 +17,17 @@
# NPE Hardware Queue Manager
hint.ixpqmgr.0.at="ixp0"
-# NPE wireless NIC's, requires ixpqmgr
+# NPE wired NICs, requires ixpqmgr
hint.npe.0.at="ixp0"
-hint.npe.0.mac="A"
-hint.npe.0.mii="A"
+hint.npe.0.mac="B"
+hint.npe.0.mii="B"
hint.npe.0.phy=1
# The second MAC isn't used on the NSLU, but it needs to be configured or
# we timeout on dhcp packets
hint.npe.1.at="ixp0"
-hint.npe.1.mac="B"
-hint.npe.1.mii="A"
-hint.npe.1.phy=0
+#hint.npe.1.mac="B"
+#hint.npe.1.mii="A"
+#hint.npe.1.phy=0
#not yet
# RTC
==== //depot/projects/vimage-commit/src/sys/arm/include/pmap.h#4 (text+ko) ====
@@ -44,7 +44,7 @@
* from: @(#)pmap.h 7.4 (Berkeley) 5/12/91
* from: FreeBSD: src/sys/i386/include/pmap.h,v 1.70 2000/11/30
*
- * $FreeBSD: src/sys/arm/include/pmap.h,v 1.30 2008/11/06 16:20:27 raj Exp $
+ * $FreeBSD: src/sys/arm/include/pmap.h,v 1.31 2009/05/07 05:42:13 alc Exp $
*/
#ifndef _MACHINE_PMAP_H_
@@ -138,7 +138,8 @@
typedef struct pmap *pmap_t;
#ifdef _KERNEL
-extern pmap_t kernel_pmap;
+extern struct pmap kernel_pmap_store;
+#define kernel_pmap (&kernel_pmap_store)
#define pmap_kernel() kernel_pmap
#define PMAP_ASSERT_LOCKED(pmap) \
@@ -166,8 +167,6 @@
int pv_flags; /* flags (wired, etc...) */
} *pv_entry_t;
-#define PV_ENTRY_NULL ((pv_entry_t) 0)
-
#ifdef _KERNEL
boolean_t pmap_get_pde_pte(pmap_t, vm_offset_t, pd_entry_t **, pt_entry_t **);
==== //depot/projects/vimage-commit/src/sys/cddl/compat/opensolaris/kern/opensolaris.c#4 (text+ko) ====
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/cddl/compat/opensolaris/kern/opensolaris.c,v 1.1 2008/05/23 22:39:28 jb Exp $
+ * $FreeBSD: src/sys/cddl/compat/opensolaris/kern/opensolaris.c,v 1.2 2009/05/08 14:11:06 zec Exp $
*
*/
==== //depot/projects/vimage-commit/src/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c#7 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c,v 1.4 2008/11/17 20:49:29 pjd Exp $");
+__FBSDID("$FreeBSD: src/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c,v 1.5 2009/05/08 14:11:06 zec Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
==== //depot/projects/vimage-commit/src/sys/cddl/compat/opensolaris/sys/vnode.h#6 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/cddl/compat/opensolaris/sys/vnode.h,v 1.10 2009/04/10 10:52:19 rwatson Exp $
+ * $FreeBSD: src/sys/cddl/compat/opensolaris/sys/vnode.h,v 1.11 2009/05/07 23:02:15 kmacy Exp $
*/
#ifndef _OPENSOLARIS_SYS_VNODE_H_
@@ -75,6 +75,7 @@
#define VN_HOLD(v) vref(v)
#define VN_RELE(v) vrele(v)
#define VN_URELE(v) vput(v)
+#define VN_RELE_ASYNC(v, tq) vn_rele_async(v, tq);
#define VOP_REALVP(vp, vpp, ct) (*(vpp) = (vp), 0)
==== //depot/projects/vimage-commit/src/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c#2 (text+ko) ====
@@ -41,6 +41,7 @@
#include <sys/types.h>
#include <sys/param.h>
+#include <sys/proc.h>
#include <sys/vnode.h>
/* Extensible attribute (xva) routines. */
@@ -72,3 +73,139 @@
xoap = &xvap->xva_xoptattrs;
return (xoap);
}
+
+static STAILQ_HEAD(, vnode) vn_rele_async_list;
+static struct mtx vn_rele_async_lock;
+static struct cv vn_rele_async_cv;
+static int vn_rele_list_length;
+static int vn_rele_async_thread_exit;
+
+typedef struct {
+ struct vnode *stqe_next;
+} vnode_link_t;
+
+/*
+ * Like vn_rele() except if we are going to call VOP_INACTIVE() then do it
+ * asynchronously using a taskq. This can avoid deadlocks caused by re-entering
+ * the file system as a result of releasing the vnode. Note, file systems
+ * already have to handle the race where the vnode is incremented before the
+ * inactive routine is called and does its locking.
+ *
+ * Warning: Excessive use of this routine can lead to performance problems.
+ * This is because taskqs throttle back allocation if too many are created.
+ */
+void
+vn_rele_async(vnode_t *vp, taskq_t *taskq /* unused */)
+{
+
+ KASSERT(vp != NULL, ("vrele: null vp"));
+ VFS_ASSERT_GIANT(vp->v_mount);
+ VI_LOCK(vp);
+
+ if (vp->v_usecount > 1 || ((vp->v_iflag & VI_DOINGINACT) &&
+ vp->v_usecount == 1)) {
+ vp->v_usecount--;
+ vdropl(vp);
+ return;
+ }
+ if (vp->v_usecount != 1) {
+#ifdef DIAGNOSTIC
+ vprint("vrele: negative ref count", vp);
+#endif
+ VI_UNLOCK(vp);
+ panic("vrele: negative ref cnt");
+ }
+ /*
+ * We are exiting
+ */
+ if (vn_rele_async_thread_exit != 0) {
+ vrele(vp);
+ return;
+ }
+
+ mtx_lock(&vn_rele_async_lock);
+
+ /* STAILQ_INSERT_TAIL */
+ (*(vnode_link_t *)&vp->v_cstart).stqe_next = NULL;
+ *vn_rele_async_list.stqh_last = vp;
+ vn_rele_async_list.stqh_last =
+ &((vnode_link_t *)&vp->v_cstart)->stqe_next;
+
+ /****************************************/
+ vn_rele_list_length++;
+ if ((vn_rele_list_length % 100) == 0)
+ cv_signal(&vn_rele_async_cv);
+ mtx_unlock(&vn_rele_async_lock);
+ VI_UNLOCK(vp);
+}
+
+static void
+vn_rele_async_init(void *arg)
+{
+
+ mtx_init(&vn_rele_async_lock, "valock", NULL, MTX_DEF);
+ STAILQ_INIT(&vn_rele_async_list);
+
+ /* cv_init(&vn_rele_async_cv, "vacv"); */
+ vn_rele_async_cv.cv_description = "vacv";
+ vn_rele_async_cv.cv_waiters = 0;
+}
+
+void
+vn_rele_async_fini(void)
+{
+
+ mtx_lock(&vn_rele_async_lock);
+ vn_rele_async_thread_exit = 1;
+ cv_signal(&vn_rele_async_cv);
+ while (vn_rele_async_thread_exit != 0)
+ cv_wait(&vn_rele_async_cv, &vn_rele_async_lock);
+ mtx_unlock(&vn_rele_async_lock);
+ mtx_destroy(&vn_rele_async_lock);
+}
+
+
+static void
+vn_rele_async_cleaner(void)
+{
+ STAILQ_HEAD(, vnode) vn_tmp_list;
+ struct vnode *curvnode;
+
+ STAILQ_INIT(&vn_tmp_list);
+ mtx_lock(&vn_rele_async_lock);
+ while (vn_rele_async_thread_exit == 0) {
+ STAILQ_CONCAT(&vn_tmp_list, &vn_rele_async_list);
+ vn_rele_list_length = 0;
+ mtx_unlock(&vn_rele_async_lock);
+
+ while (!STAILQ_EMPTY(&vn_tmp_list)) {
+ curvnode = STAILQ_FIRST(&vn_tmp_list);
+
+ /* STAILQ_REMOVE_HEAD */
+ STAILQ_FIRST(&vn_tmp_list) =
+ ((vnode_link_t *)&curvnode->v_cstart)->stqe_next;
+ if (STAILQ_FIRST(&vn_tmp_list) == NULL)
+ vn_tmp_list.stqh_last = &STAILQ_FIRST(&vn_tmp_list);
+ /***********************/
+ vrele(curvnode);
+ }
+ mtx_lock(&vn_rele_async_lock);
+ if (vn_rele_list_length == 0)
+ cv_timedwait(&vn_rele_async_cv, &vn_rele_async_lock,
+ hz/10);
+ }
+
+ vn_rele_async_thread_exit = 0;
+ cv_broadcast(&vn_rele_async_cv);
+ mtx_unlock(&vn_rele_async_lock);
+ thread_exit();
+}
+
+static struct proc *vn_rele_async_proc;
+static struct kproc_desc up_kp = {
+ "vaclean",
+ vn_rele_async_cleaner,
+ &vn_rele_async_proc
+};
+SYSINIT(vaclean, SI_SUB_KTHREAD_UPDATE, SI_ORDER_FIRST, kproc_start, &up_kp);
+SYSINIT(vn_rele_async_setup, SI_SUB_VFS, SI_ORDER_FIRST, vn_rele_async_init, NULL);
==== //depot/projects/vimage-commit/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c#4 (text+ko) ====
@@ -131,6 +131,8 @@
#include <sys/kstat.h>
#include <sys/sdt.h>
+#include <vm/vm_pageout.h>
+
static kmutex_t arc_reclaim_thr_lock;
static kcondvar_t arc_reclaim_thr_cv; /* used to signal reclaim thr */
static uint8_t arc_thread_exit;
@@ -1710,14 +1712,23 @@
static void
arc_do_user_evicts(void)
{
+ static arc_buf_t *tmp_arc_eviction_list;
+
+ /*
+ * Move list over to avoid LOR
+ */
+restart:
mutex_enter(&arc_eviction_mtx);
- while (arc_eviction_list != NULL) {
- arc_buf_t *buf = arc_eviction_list;
- arc_eviction_list = buf->b_next;
+ tmp_arc_eviction_list = arc_eviction_list;
+ arc_eviction_list = NULL;
+ mutex_exit(&arc_eviction_mtx);
+
+ while (tmp_arc_eviction_list != NULL) {
+ arc_buf_t *buf = tmp_arc_eviction_list;
+ tmp_arc_eviction_list = buf->b_next;
rw_enter(&buf->b_lock, RW_WRITER);
buf->b_hdr = NULL;
rw_exit(&buf->b_lock);
- mutex_exit(&arc_eviction_mtx);
if (buf->b_efunc != NULL)
VERIFY(buf->b_efunc(buf) == 0);
@@ -1725,9 +1736,10 @@
buf->b_efunc = NULL;
buf->b_private = NULL;
kmem_cache_free(buf_cache, buf);
- mutex_enter(&arc_eviction_mtx);
}
- mutex_exit(&arc_eviction_mtx);
+
+ if (arc_eviction_list != NULL)
+ goto restart;
}
/*
@@ -1809,6 +1821,13 @@
#ifdef _KERNEL
+ /*
+ * If pages are needed or we're within 2048 pages
+ * of needing to page need to reclaim
+ */
+ if (vm_pages_needed || (vm_paging_target() > -2048))
+ return (1);
+
if (needfree)
return (1);
==== //depot/projects/vimage-commit/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c#4 (text+ko) ====
@@ -1199,6 +1199,9 @@
void
dmu_fini(void)
{
+#ifdef _KERNEL
+ vn_rele_async_fini();
+#endif
arc_fini();
dnode_fini();
dbuf_fini();
==== //depot/projects/vimage-commit/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c#6 (text+ko) ====
@@ -93,6 +93,7 @@
* pushing cached pages (which acquires range locks) and syncing out
* cached atime changes. Third, zfs_zinactive() may require a new tx,
* which could deadlock the system if you were already holding one.
+ * If you must call VN_RELE() within a tx then use VN_RELE_ASYNC().
*
* (3) All range locks must be grabbed before calling dmu_tx_assign(),
* as they can span dmu_tx_assign() calls.
@@ -928,7 +929,11 @@
vfslocked = VFS_LOCK_GIANT(vp->v_vfsp);
dmu_buf_rele(db, vzgd);
zfs_range_unlock(rl);
- VN_RELE(vp);
+ /*
+ * Release the vnode asynchronously as we currently have the
+ * txg stopped from syncing.
+ */
+ VN_RELE_ASYNC(vp, NULL);
zil_add_block(zgd->zgd_zilog, zgd->zgd_bp);
kmem_free(zgd, sizeof (zgd_t));
VFS_UNLOCK_GIANT(vfslocked);
@@ -959,7 +964,12 @@
if (zfs_zget(zfsvfs, lr->lr_foid, &zp) != 0)
return (ENOENT);
if (zp->z_unlinked) {
- VN_RELE(ZTOV(zp));
+ /*
+ * Release the vnode asynchronously as we currently have the
+ * txg stopped from syncing.
+ */
+ VN_RELE_ASYNC(ZTOV(zp), NULL);
+
return (ENOENT);
}
@@ -1031,7 +1041,11 @@
}
out:
zfs_range_unlock(rl);
- VN_RELE(ZTOV(zp));
+ /*
+ * Release the vnode asynchronously as we currently have the
+ * txg stopped from syncing.
+ */
+ VN_RELE_ASYNC(ZTOV(zp), NULL);
return (error);
}
==== //depot/projects/vimage-commit/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c#4 (text+ko) ====
@@ -1041,7 +1041,7 @@
if ((itx != NULL) &&
(itx->itx_lr.lrc_txg <= spa_last_synced_txg(zilog->zl_spa))) {
(void) taskq_dispatch(zilog->zl_clean_taskq,
- (void (*)(void *))zil_itx_clean, zilog, TQ_NOSLEEP);
+ (task_func_t *)zil_itx_clean, zilog, TQ_SLEEP);
}
mutex_exit(&zilog->zl_lock);
}
==== //depot/projects/vimage-commit/src/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h#2 (text+ko) ====
@@ -377,6 +377,10 @@
void xva_init(xvattr_t *);
xoptattr_t *xva_getxoptattr(xvattr_t *); /* Get ptr to xoptattr_t */
+struct taskq;
+void vn_rele_async(struct vnode *vp, struct taskq *taskq);
+void vn_rele_async_fini(void);
+
/*
* Flags to VOP_SETATTR/VOP_GETATTR.
*/
==== //depot/projects/vimage-commit/src/sys/compat/linux/linux_futex.c#8 (text+ko) ====
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_futex.c,v 1.21 2009/05/02 10:06:49 dchagin Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_futex.c,v 1.22 2009/05/07 16:14:31 dchagin Exp $");
#if 0
__KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.7 2006/07/24 19:01:49 manu Exp $");
#endif
@@ -43,6 +43,7 @@
#include <sys/systm.h>
#include <sys/imgact.h>
#include <sys/kernel.h>
+#include <sys/ktr.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
@@ -61,6 +62,7 @@
#endif
#include <compat/linux/linux_futex.h>
#include <compat/linux/linux_emul.h>
+#include <compat/linux/linux_util.h>
MALLOC_DEFINE(M_FUTEX, "futex", "Linux futexes");
MALLOC_DEFINE(M_FUTEX_WP, "futex wp", "Linux futexes wp");
@@ -131,11 +133,15 @@
FUTEXES_UNLOCK;
FUTEX_UNLOCK(f);
+ LINUX_CTR2(sys_futex, "futex_put destroy uaddr %p ref %d",
+ f->f_uaddr, f->f_refcount);
FUTEX_DESTROY(f);
free(f, M_FUTEX);
return;
}
+ LINUX_CTR2(sys_futex, "futex_put uaddr %p ref %d",
+ f->f_uaddr, f->f_refcount);
FUTEXES_UNLOCK;
FUTEX_UNLOCK(f);
}
@@ -170,12 +176,15 @@
FUTEX_LOCK(f);
*newf = f;
+ LINUX_CTR2(sys_futex, "futex_get uaddr %p ref %d",
+ uaddr, f->f_refcount);
return (0);
}
}
if (flags & FUTEX_DONTCREATE) {
FUTEXES_UNLOCK;
+ LINUX_CTR1(sys_futex, "futex_get uaddr %p null", uaddr);
return (0);
}
@@ -198,6 +207,8 @@
LIST_INSERT_HEAD(&futex_list, tmpf, f_list);
FUTEXES_UNLOCK;
+ LINUX_CTR2(sys_futex, "futex_get uaddr %p ref %d new",
+ uaddr, tmpf->f_refcount);
*newf = tmpf;
return (0);
}
@@ -232,13 +243,21 @@
int error;
FUTEX_ASSERT_LOCKED(f);
+ LINUX_CTR4(sys_futex, "futex_sleep enter uaddr %p wp %p timo %ld ref %d",
+ f->f_uaddr, wp, timeout, f->f_refcount);
error = sx_sleep(wp, &f->f_lck, PCATCH, "futex", timeout);
if (wp->wp_flags & FUTEX_WP_REQUEUED) {
KASSERT(f != wp->wp_futex, ("futex != wp_futex"));
+ LINUX_CTR5(sys_futex, "futex_sleep out error %d uaddr %p w"
+ " %p requeued uaddr %p ref %d",
+ error, f->f_uaddr, wp, wp->wp_futex->f_uaddr,
+ wp->wp_futex->f_refcount);
futex_put(f, NULL);
f = wp->wp_futex;
FUTEX_LOCK(f);
- }
+ } else
+ LINUX_CTR3(sys_futex, "futex_sleep out error %d uaddr %p wp %p",
+ error, f->f_uaddr, wp);
futex_put(f, wp);
return (error);
@@ -252,6 +271,8 @@
FUTEX_ASSERT_LOCKED(f);
TAILQ_FOREACH_SAFE(wp, &f->f_waiting_proc, wp_list, wpt) {
+ LINUX_CTR3(sys_futex, "futex_wake uaddr %p wp %p ref %d",
+ f->f_uaddr, wp, f->f_refcount);
wp->wp_flags |= FUTEX_WP_REMOVED;
TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
wakeup_one(wp);
@@ -273,10 +294,14 @@
TAILQ_FOREACH_SAFE(wp, &f->f_waiting_proc, wp_list, wpt) {
if (++count <= n) {
+ LINUX_CTR2(sys_futex, "futex_req_wake uaddr %p wp %p",
+ f->f_uaddr, wp);
wp->wp_flags |= FUTEX_WP_REMOVED;
TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
wakeup_one(wp);
} else {
+ LINUX_CTR3(sys_futex, "futex_requeue uaddr %p wp %p to %p",
+ f->f_uaddr, wp, f2->f_uaddr);
wp->wp_flags |= FUTEX_WP_REQUEUED;
/* Move wp to wp_list of f2 futex */
TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
@@ -421,6 +446,8 @@
switch (args->op) {
case LINUX_FUTEX_WAIT:
+ LINUX_CTR2(sys_futex, "WAIT val %d uaddr %p",
+ args->val, args->uaddr);
#ifdef DEBUG
if (ldebug(sys_futex))
printf(ARGS(sys_futex, "futex_wait val %d uaddr %p"),
@@ -431,15 +458,14 @@
return (error);
error = copyin(args->uaddr, &val, sizeof(val));
if (error) {
+ LINUX_CTR1(sys_futex, "WAIT copyin failed %d",
+ error);
futex_put(f, wp);
return (error);
}
if (val != args->val) {
-#ifdef DEBUG
- if (ldebug(sys_futex))
- printf(ARGS(sys_futex, "futex_wait uaddr %p WHOOPS %d != %d"),
- args->uaddr, args->val, val);
-#endif
+ LINUX_CTR3(sys_futex, "WAIT uaddr %p val %d != uval %d",
+ args->uaddr, args->val, val);
futex_put(f, wp);
return (EWOULDBLOCK);
}
@@ -449,6 +475,9 @@
case LINUX_FUTEX_WAKE:
+ LINUX_CTR2(sys_futex, "WAKE val %d uaddr %p",
+ args->val, args->uaddr);
+
/*
* XXX: Linux is able to cope with different addresses
* corresponding to the same mapped memory in the sleeping
@@ -472,6 +501,11 @@
case LINUX_FUTEX_CMP_REQUEUE:
+ LINUX_CTR5(sys_futex, "CMP_REQUEUE uaddr %p "
+ "val %d val3 %d uaddr2 %p val2 %d",
+ args->uaddr, args->val, args->val3, args->uaddr2,
+ (int)(unsigned long)args->timeout);
+
#ifdef DEBUG
if (ldebug(sys_futex))
printf(ARGS(sys_futex, "futex_cmp_requeue uaddr %p "
@@ -505,16 +539,15 @@
}
error = copyin(args->uaddr, &val, sizeof(val));
if (error) {
+ LINUX_CTR1(sys_futex, "CMP_REQUEUE copyin failed %d",
+ error);
futex_put(f2, NULL);
futex_put(f, NULL);
return (error);
}
if (val != args->val3) {
-#ifdef DEBUG
- if (ldebug(sys_futex))
- printf(ARGS(sys_futex, "futex_cmp_requeue WHOOPS"
- " VAL %d != UVAL %d"), args->val, val);
-#endif
+ LINUX_CTR2(sys_futex, "CMP_REQUEUE val %d != uval %d",
+ args->val, val);
futex_put(f2, NULL);
futex_put(f, NULL);
return (EAGAIN);
@@ -528,6 +561,11 @@
case LINUX_FUTEX_WAKE_OP:
+ LINUX_CTR5(sys_futex, "WAKE_OP "
+ "uaddr %p op %d val %x uaddr2 %p val3 %x",
+ args->uaddr, args->op, args->val,
+ args->uaddr2, args->val3);
+
#ifdef DEBUG
if (ldebug(sys_futex))
printf(ARGS(sys_futex, "futex_wake_op "
==== //depot/projects/vimage-commit/src/sys/compat/linux/linux_ioctl.c#11 (text+ko) ====
@@ -30,7 +30,7 @@
#include "opt_compat.h"
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_ioctl.c,v 1.147 2009/02/27 14:12:05 bz Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_ioctl.c,v 1.148 2009/05/07 09:39:20 dchagin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -77,6 +77,7 @@
#include <compat/linux/linux_ioctl.h>
#include <compat/linux/linux_mib.h>
+#include <compat/linux/linux_socket.h>
#include <compat/linux/linux_util.h>
CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ);
==== //depot/projects/vimage-commit/src/sys/compat/linux/linux_mib.c#5 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_mib.c,v 1.31 2009/05/04 19:06:05 jamie Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_mib.c,v 1.34 2009/05/07 19:46:29 jamie Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -35,9 +35,11 @@
#include <sys/sysctl.h>
#include <sys/proc.h>
#include <sys/malloc.h>
+#include <sys/mount.h>
#include <sys/jail.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/sx.h>
#include "opt_compat.h"
@@ -55,6 +57,8 @@
int pr_use_linux26; /* flag to determine whether to use 2.6 emulation */
};
+static unsigned linux_osd_jail_slot;
+
SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW, 0,
"Linux mode");
@@ -128,58 +132,306 @@
/*
* Returns holding the prison mutex if return non-NULL.
*/
-static struct prison *
-linux_get_prison(struct thread *td)
+static struct linux_prison *
+linux_get_prison(struct thread *td, struct prison **prp)
{
- register struct prison *pr;
- register struct linux_prison *lpr;
+ struct prison *pr;
+ struct linux_prison *lpr;
KASSERT(td == curthread, ("linux_get_prison() called on !curthread"));
- if (!jailed(td->td_ucred))
+ *prp = pr = td->td_ucred->cr_prison;
+ if (pr == NULL || !linux_osd_jail_slot)
return (NULL);
- pr = td->td_ucred->cr_prison;
+ mtx_lock(&pr->pr_mtx);
+ lpr = osd_jail_get(pr, linux_osd_jail_slot);
+ if (lpr == NULL)
+ mtx_unlock(&pr->pr_mtx);
+ return (lpr);
+}
+
+/*
+ * Ensure a prison has its own Linux info. The prison should be locked on
+ * entrance and will be locked on exit (though it may get unlocked in the
+ * interrim).
+ */
+static int
+linux_alloc_prison(struct prison *pr, struct linux_prison **lprp)
+{
+ struct linux_prison *lpr, *nlpr;
+ int error;
+
+ /* If this prison already has Linux info, return that. */
+ error = 0;
+ mtx_assert(&pr->pr_mtx, MA_OWNED);
+ lpr = osd_jail_get(pr, linux_osd_jail_slot);
+ if (lpr != NULL)
+ goto done;
+ /*
+ * Allocate a new info record. Then check again, in case something
+ * changed during the allocation.
+ */
+ mtx_unlock(&pr->pr_mtx);
+ nlpr = malloc(sizeof(struct linux_prison), M_PRISON, M_WAITOK);
+ mtx_lock(&pr->pr_mtx);
+ lpr = osd_jail_get(pr, linux_osd_jail_slot);
+ if (lpr != NULL) {
+ free(nlpr, M_PRISON);
+ goto done;
+ }
+ error = osd_jail_set(pr, linux_osd_jail_slot, nlpr);
+ if (error)
+ free(nlpr, M_PRISON);
+ else {
+ lpr = nlpr;
+ mtx_lock(&osname_lock);
+ strncpy(lpr->pr_osname, linux_osname, LINUX_MAX_UTSNAME);
+ strncpy(lpr->pr_osrelease, linux_osrelease, LINUX_MAX_UTSNAME);
+ lpr->pr_oss_version = linux_oss_version;
+ lpr->pr_use_linux26 = linux_use_linux26;
+ mtx_unlock(&osname_lock);
+ }
+done:
+ if (lprp != NULL)
+ *lprp = lpr;
+ return (error);
+}
+
+/*
+ * Jail OSD methods for Linux prison data.
+ */
+static int
+linux_prison_create(void *obj, void *data)
+{
+ int error;
+ struct prison *pr = obj;
+ struct vfsoptlist *opts = data;
+
+ if (vfs_flagopt(opts, "nolinux", NULL, 0))
+ return (0);
+ /*
+ * Inherit a prison's initial values from its parent
+ * (different from NULL which also inherits changes).
+ */
mtx_lock(&pr->pr_mtx);
- if (pr->pr_linux == NULL) {
+ error = linux_alloc_prison(pr, NULL);
+ mtx_unlock(&pr->pr_mtx);
+ return (error);
+}
+
+static int
+linux_prison_check(void *obj __unused, void *data)
+{
+ struct vfsoptlist *opts = data;
+ char *osname, *osrelease;
+ int error, len, oss_version;
+
+ /* Check that the parameters are correct. */
+ (void)vfs_flagopt(opts, "linux", NULL, 0);
+ (void)vfs_flagopt(opts, "nolinux", NULL, 0);
+ error = vfs_getopt(opts, "linux.osname", (void **)&osname, &len);
+ if (error != ENOENT) {
+ if (error != 0)
+ return (error);
+ if (len == 0 || osname[len - 1] != '\0')
+ return (EINVAL);
+ if (len > LINUX_MAX_UTSNAME) {
+ vfs_opterror(opts, "linux.osname too long");
+ return (ENAMETOOLONG);
+ }
+ }
+ error = vfs_getopt(opts, "linux.osrelease", (void **)&osrelease, &len);
+ if (error != ENOENT) {
+ if (error != 0)
+ return (error);
+ if (len == 0 || osrelease[len - 1] != '\0')
+ return (EINVAL);
+ if (len > LINUX_MAX_UTSNAME) {
+ vfs_opterror(opts, "linux.osrelease too long");
+ return (ENAMETOOLONG);
+ }
+ }
+ error = vfs_copyopt(opts, "linux.oss_version", &oss_version,
+ sizeof(oss_version));
+ return (error == ENOENT ? 0 : error);
+}
+
+static int
+linux_prison_set(void *obj, void *data)
+{
+ struct linux_prison *lpr;
+ struct prison *pr = obj;
+ struct vfsoptlist *opts = data;
+ char *osname, *osrelease;
+ int error, gotversion, len, nolinux, oss_version, yeslinux;
+
+ /* Set the parameters, which should be correct. */
+ yeslinux = vfs_flagopt(opts, "linux", NULL, 0);
+ nolinux = vfs_flagopt(opts, "nolinux", NULL, 0);
+ error = vfs_getopt(opts, "linux.osname", (void **)&osname, &len);
+ if (error == ENOENT)
+ osname = NULL;
+ else
+ yeslinux = 1;
+ error = vfs_getopt(opts, "linux.osrelease", (void **)&osrelease, &len);
+ if (error == ENOENT)
+ osrelease = NULL;
+ else
+ yeslinux = 1;
+ error = vfs_copyopt(opts, "linux.oss_version", &oss_version,
+ sizeof(oss_version));
+ gotversion = error == 0;
+ yeslinux |= gotversion;
+ if (nolinux) {
+ /* "nolinux": inherit the parent's Linux info. */
+ mtx_lock(&pr->pr_mtx);
+ osd_jail_del(pr, linux_osd_jail_slot);
+ mtx_unlock(&pr->pr_mtx);
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list