From owner-p4-projects@FreeBSD.ORG Thu Jun 24 03:47:02 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 86E2516A4CF; Thu, 24 Jun 2004 03:47:02 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 599EE16A4D4 for ; Thu, 24 Jun 2004 03:47:02 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4F2A143D49 for ; Thu, 24 Jun 2004 03:47:02 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i5O3l26G041387 for ; Thu, 24 Jun 2004 03:47:02 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i5O3l1ZS041383 for perforce@freebsd.org; Thu, 24 Jun 2004 03:47:01 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Thu, 24 Jun 2004 03:47:01 GMT Message-Id: <200406240347.i5O3l1ZS041383@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Subject: PERFORCE change 55679 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jun 2004 03:47:03 -0000 http://perforce.freebsd.org/chv.cgi?CH=55679 Change 55679 by rwatson@rwatson_tislabs on 2004/06/24 03:46:34 Integrate netperf_socket to loop back a variety of changes associated with rwatson_netperf, including: - portalfs locking - expand sockbuf locking in sopoll() to include selrecord() - add sbreserve_locked(), expand and coallesce locking in soreserve() - ng_base locking fixes - when asserting various network locks, also conditionally assert giant - lock some accesses to inpcb fields in ip_ctloutput() - clean up socket buffer locking in tcp_input, covering oobmark, sbdrop() for ACK processing, tcp_mss(), etc - netnatm const merge - sb_flags locking in nfs_socket - mac_ifnet_mtx, mpo_copy_label, don't externalize holding mutex Affected files ... .. //depot/projects/netperf_socket/sys/compat/svr4/imgact_svr4.c#3 integrate .. //depot/projects/netperf_socket/sys/conf/options.sparc64#4 integrate .. //depot/projects/netperf_socket/sys/dev/acpica/acpi.c#27 integrate .. //depot/projects/netperf_socket/sys/dev/acpica/acpi_cpu.c#11 integrate .. //depot/projects/netperf_socket/sys/dev/acpica/acpi_pci.c#12 integrate .. //depot/projects/netperf_socket/sys/dev/ofw/ofw_console.c#7 integrate .. //depot/projects/netperf_socket/sys/fs/portalfs/portal_vnops.c#7 integrate .. //depot/projects/netperf_socket/sys/fs/udf/udf_vnops.c#5 integrate .. //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum.c#3 integrate .. //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum_plex.c#4 integrate .. //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum_raid5.c#4 integrate .. //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum_raid5.h#2 integrate .. //depot/projects/netperf_socket/sys/i386/linux/imgact_linux.c#3 integrate .. //depot/projects/netperf_socket/sys/kern/uipc_socket.c#23 integrate .. //depot/projects/netperf_socket/sys/kern/uipc_socket2.c#20 integrate .. //depot/projects/netperf_socket/sys/kern/uipc_syscalls.c#21 integrate .. //depot/projects/netperf_socket/sys/netgraph/ng_base.c#4 integrate .. //depot/projects/netperf_socket/sys/netinet/in_pcb.h#4 integrate .. //depot/projects/netperf_socket/sys/netinet/ip_dummynet.c#5 integrate .. //depot/projects/netperf_socket/sys/netinet/ip_fw2.c#8 integrate .. //depot/projects/netperf_socket/sys/netinet/ip_mroute.c#7 integrate .. //depot/projects/netperf_socket/sys/netinet/ip_output.c#12 integrate .. //depot/projects/netperf_socket/sys/netinet/tcp_input.c#13 integrate .. //depot/projects/netperf_socket/sys/netinet/tcp_subr.c#11 integrate .. //depot/projects/netperf_socket/sys/netnatm/natm.c#5 integrate .. //depot/projects/netperf_socket/sys/nfsclient/nfs_socket.c#8 integrate .. //depot/projects/netperf_socket/sys/security/mac/mac_net.c#5 integrate .. //depot/projects/netperf_socket/sys/security/mac_biba/mac_biba.c#4 integrate .. //depot/projects/netperf_socket/sys/security/mac_lomac/mac_lomac.c#4 integrate .. //depot/projects/netperf_socket/sys/security/mac_mls/mac_mls.c#4 integrate .. //depot/projects/netperf_socket/sys/security/mac_stub/mac_stub.c#4 integrate .. //depot/projects/netperf_socket/sys/security/mac_test/mac_test.c#5 integrate .. //depot/projects/netperf_socket/sys/sparc64/conf/NOTES#4 integrate .. //depot/projects/netperf_socket/sys/sys/mac_policy.h#5 integrate .. //depot/projects/netperf_socket/sys/sys/socketvar.h#18 integrate .. //depot/projects/netperf_socket/sys/vm/uma_core.c#7 integrate .. //depot/projects/netperf_socket/sys/vm/vm_pageout.c#6 integrate Differences ... ==== //depot/projects/netperf_socket/sys/compat/svr4/imgact_svr4.c#3 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/compat/svr4/imgact_svr4.c,v 1.22 2004/02/04 21:52:53 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/svr4/imgact_svr4.c,v 1.23 2004/06/24 02:21:17 obrien Exp $"); #include #include @@ -90,7 +90,7 @@ } bss_size = round_page(a_out->a_bss); #ifdef DEBUG - printf("imgact: text: %08lx, data: %08lx, bss: %08lx\n", a_out->a_text, a_out->a_data, bss_size); + printf("imgact: text: %08lx, data: %08lx, bss: %08lx\n", (u_long)a_out->a_text, (u_long)a_out->a_data, bss_size); #endif /* @@ -193,7 +193,7 @@ #ifdef DEBUG printf("imgact: startaddr=%08lx, length=%08lx\n", (u_long)vmaddr, - a_out->a_text + a_out->a_data); + (u_long)a_out->a_text + a_out->a_data); #endif /* * allow read/write of data ==== //depot/projects/netperf_socket/sys/conf/options.sparc64#4 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/options.sparc64,v 1.10 2004/05/08 13:53:46 marius Exp $ +# $FreeBSD: src/sys/conf/options.sparc64,v 1.11 2004/06/24 02:57:10 obrien Exp $ SUN4U opt_global.h @@ -9,6 +9,7 @@ PSYCHO_DEBUG opt_psycho.h DEBUGGER_ON_POWERFAIL opt_psycho.h OFW_PCI_DEBUG opt_ofw_pci.h +OFWCONS_POLL_HZ opt_ofw.h # Debug IOMMU inserts/removes using diagnostic accesses. Very loud. IOMMU_DIAG opt_iommu.h PMAP_STATS opt_pmap.h ==== //depot/projects/netperf_socket/sys/dev/acpica/acpi.c#27 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/acpica/acpi.c,v 1.164 2004/06/23 17:21:02 jhb Exp $ + * $FreeBSD: src/sys/dev/acpica/acpi.c,v 1.165 2004/06/24 00:48:45 njl Exp $ */ #include "opt_acpi.h" @@ -129,7 +129,6 @@ static ACPI_STATUS acpi_probe_child(ACPI_HANDLE handle, UINT32 level, void *context, void **status); static void acpi_shutdown_final(void *arg, int howto); -static void acpi_shutdown_poweroff(void *arg); static void acpi_enable_fixed_events(struct acpi_softc *sc); static int acpi_parse_prw(ACPI_HANDLE h, struct acpi_prw_data *prw); static ACPI_STATUS acpi_wake_limit(ACPI_HANDLE h, UINT32 level, void *context, @@ -1282,9 +1281,9 @@ ACPI_STATUS status; /* - * If powering off, run the actual shutdown code on each processor. - * It will only perform the shutdown on the BSP. Some chipsets do - * not power off the system correctly if called from an AP. + * XXX Shutdown code should only run on the BSP (cpuid 0). + * Some chipsets do not power off the system correctly if called from + * an AP. */ if ((howto & RB_POWEROFF) != 0) { status = AcpiEnterSleepStatePrep(ACPI_STATE_S5); @@ -1294,36 +1293,20 @@ return; } printf("Powering system off using ACPI\n"); - smp_rendezvous(NULL, acpi_shutdown_poweroff, NULL, NULL); + ACPI_DISABLE_IRQS(); + status = AcpiEnterSleepState(ACPI_STATE_S5); + if (ACPI_FAILURE(status)) { + printf("ACPI power-off failed - %s\n", AcpiFormatException(status)); + } else { + DELAY(1000000); + printf("ACPI power-off failed - timeout\n"); + } } else { printf("Shutting down ACPI\n"); AcpiTerminate(); } } -/* - * Since this function may be called with locks held or in an unknown - * context, it cannot allocate memory, acquire locks, sleep, etc. - */ -static void -acpi_shutdown_poweroff(void *arg) -{ - ACPI_STATUS status; - - /* Only attempt to power off if this is the BSP (cpuid 0). */ - if (PCPU_GET(cpuid) != 0) - return; - - ACPI_DISABLE_IRQS(); - status = AcpiEnterSleepState(ACPI_STATE_S5); - if (ACPI_FAILURE(status)) { - printf("ACPI power-off failed - %s\n", AcpiFormatException(status)); - } else { - DELAY(1000000); - printf("ACPI power-off failed - timeout\n"); - } -} - static void acpi_enable_fixed_events(struct acpi_softc *sc) { ==== //depot/projects/netperf_socket/sys/dev/acpica/acpi_cpu.c#11 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.40 2004/06/19 02:27:23 njl Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.41 2004/06/24 00:38:51 njl Exp $"); #include "opt_acpi.h" #include @@ -1046,7 +1046,7 @@ struct sbuf sb; char buf[128]; int i; - uint64_t fract, sum, whole; + uintmax_t fract, sum, whole; sum = 0; for (i = 0; i < cpu_cx_count; i++) @@ -1054,7 +1054,7 @@ sbuf_new(&sb, buf, sizeof(buf), SBUF_FIXEDLEN); for (i = 0; i < cpu_cx_count; i++) { if (sum > 0) { - whole = cpu_cx_stats[i] * 100; + whole = (uintmax_t)cpu_cx_stats[i] * 100; fract = (whole % sum) * 100; sbuf_printf(&sb, "%u.%02u%% ", (u_int)(whole / sum), (u_int)(fract / sum)); ==== //depot/projects/netperf_socket/sys/dev/acpica/acpi_pci.c#12 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pci.c,v 1.19 2004/06/23 15:08:40 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pci.c,v 1.20 2004/06/24 01:57:31 njl Exp $"); #include #include @@ -232,7 +232,7 @@ if (ACPI_FAILURE(status)) printf("WARNING: Unable to detach object data from %s - %s\n", acpi_name(handle), AcpiFormatException(status)); - status = AcpiAttachData(handle, acpi_fake_objhandler, child); + status = AcpiAttachData(handle, acpi_fake_objhandler, pci_child); if (ACPI_FAILURE(status)) printf("WARNING: Unable to attach object data to %s - %s\n", acpi_name(handle), AcpiFormatException(status)); @@ -261,8 +261,7 @@ dinfo->ap_dinfo.cfg.slot == slot) { dinfo->ap_handle = handle; acpi_pci_update_device(handle, devlist[i]); - free(devlist, M_TEMP); - return_ACPI_STATUS (AE_OK); + break; } } free(devlist, M_TEMP); ==== //depot/projects/netperf_socket/sys/dev/ofw/ofw_console.c#7 (text+ko) ==== @@ -24,10 +24,11 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/ofw/ofw_console.c,v 1.24 2004/06/16 09:46:52 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ofw/ofw_console.c,v 1.25 2004/06/24 02:57:11 obrien Exp $"); #include "opt_ddb.h" #include "opt_comconsole.h" +#include "opt_ofw.h" #include #include @@ -42,7 +43,10 @@ #include -#define OFW_POLL_HZ 4 +#ifndef OFWCONS_POLL_HZ +#define OFWCONS_POLL_HZ 4 /* 50-100 works best on Ultra2 */ +#endif +#define OFBURSTLEN 128 /* max number of bytes to write in one chunk */ static d_open_t ofw_dev_open; static d_close_t ofw_dev_close; @@ -125,7 +129,7 @@ ttychars(tp); tp->t_iflag = TTYDEF_IFLAG; tp->t_oflag = TTYDEF_OFLAG; - tp->t_cflag = TTYDEF_CFLAG|CLOCAL; + tp->t_cflag = TTYDEF_CFLAG; tp->t_lflag = TTYDEF_LFLAG; tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; ttsetwater(tp); @@ -138,7 +142,7 @@ error = ttyld_open(tp, dev); if (error == 0 && setuptimeout) { - polltime = hz / OFW_POLL_HZ; + polltime = hz / OFWCONS_POLL_HZ; if (polltime < 1) { polltime = 1; } @@ -162,6 +166,8 @@ return (ENXIO); } + /* XXX Should be replaced with callout_stop(9) */ + untimeout(ofw_timeout, tp, ofw_timeouthandle); ttyld_close(tp, flag); ttyclose(tp); @@ -179,16 +185,18 @@ static void ofw_tty_start(struct tty *tp) { + struct clist *cl; + int len; + u_char buf[OFBURSTLEN]; + - if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) { - ttwwakeup(tp); + if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP)) return; - } tp->t_state |= TS_BUSY; - while (tp->t_outq.c_cc != 0) { - ofw_cons_putc(NULL, getc(&tp->t_outq)); - } + cl = &tp->t_outq; + len = q_to_b(cl, buf, OFBURSTLEN); + OF_write(stdout, buf, len); tp->t_state &= ~TS_BUSY; ttwwakeup(tp); ==== //depot/projects/netperf_socket/sys/fs/portalfs/portal_vnops.c#7 (text+ko) ==== @@ -31,7 +31,7 @@ * * @(#)portal_vnops.c 8.14 (Berkeley) 5/21/95 * - * $FreeBSD: src/sys/fs/portalfs/portal_vnops.c,v 1.64 2004/06/23 06:47:49 bde Exp $ + * $FreeBSD: src/sys/fs/portalfs/portal_vnops.c,v 1.65 2004/06/24 00:47:23 rwatson Exp $ */ /* @@ -216,7 +216,6 @@ struct portalnode *pt; struct thread *td = ap->a_td; struct vnode *vp = ap->a_vp; - int s; struct uio auio; struct iovec aiov[2]; int res; @@ -284,16 +283,18 @@ * will happen if the server dies. Sleep for 5 second intervals * and keep polling the reference count. XXX. */ - s = splnet(); + /* XXXRW: Locking? */ + SOCK_LOCK(so); while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) { if (fmp->pm_server->f_count == 1) { + SOCK_UNLOCK(so); error = ECONNREFUSED; - splx(s); goto bad; } - (void) tsleep((caddr_t) &so->so_timeo, PSOCK, "portalcon", 5 * hz); + (void) msleep((caddr_t) &so->so_timeo, SOCK_MTX(so), PSOCK, + "portalcon", 5 * hz); } - splx(s); + SOCK_UNLOCK(so); if (so->so_error) { error = so->so_error; @@ -303,12 +304,12 @@ /* * Set miscellaneous flags */ + SOCKBUF_LOCK(&so->so_rcv); so->so_rcv.sb_timeo = 0; - so->so_snd.sb_timeo = 0; - SOCKBUF_LOCK(&so->so_rcv); so->so_rcv.sb_flags |= SB_NOINTR; SOCKBUF_UNLOCK(&so->so_rcv); SOCKBUF_LOCK(&so->so_snd); + so->so_snd.sb_timeo = 0; so->so_snd.sb_flags |= SB_NOINTR; SOCKBUF_UNLOCK(&so->so_snd); ==== //depot/projects/netperf_socket/sys/fs/udf/udf_vnops.c#5 (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/fs/udf/udf_vnops.c,v 1.36 2004/06/23 19:36:09 scottl Exp $ + * $FreeBSD: src/sys/fs/udf/udf_vnops.c,v 1.37 2004/06/23 21:49:03 scottl Exp $ */ /* udf_vnops.c */ @@ -186,11 +186,11 @@ udf_permtomode(struct udf_node *node) { uint32_t perm; - uint32_t flags; + uint16_t flags; mode_t mode; - perm = node->fentry->perm; - flags = node->fentry->icbtag.flags; + perm = le32toh(node->fentry->perm); + flags = le16toh(node->fentry->icbtag.flags); mode = perm & UDF_FENTRY_PERM_USER_MASK; mode |= ((perm & UDF_FENTRY_PERM_GRP_MASK) >> 2); @@ -256,7 +256,7 @@ static void udf_timetotimespec(struct timestamp *time, struct timespec *t) { - int i, lpyear, daysinyear; + int i, lpyear, daysinyear, year; union { uint16_t u_tz_offset; int16_t s_tz_offset; @@ -265,7 +265,8 @@ t->tv_nsec = 0; /* DirectCD seems to like using bogus year values */ - if (time->year < 1970) { + year = le16toh(time->year); + if (year < 1970) { t->tv_sec = 0; return; } @@ -277,18 +278,18 @@ t->tv_sec += time->day * 3600 * 24; /* Calclulate the month */ - lpyear = udf_isaleapyear(time->year); + lpyear = udf_isaleapyear(year); for (i = 1; i < time->month; i++) t->tv_sec += mon_lens[lpyear][i] * 3600 * 24; /* Speed up the calculation */ - if (time->year > 1979) + if (year > 1979) t->tv_sec += 315532800; - if (time->year > 1989) + if (year > 1989) t->tv_sec += 315619200; - if (time->year > 1999) + if (year > 1999) t->tv_sec += 315532800; - for (i = 2000; i < time->year; i++) { + for (i = 2000; i < year; i++) { daysinyear = udf_isaleapyear(i) + 365 ; t->tv_sec += daysinyear * 3600 * 24; } @@ -297,7 +298,7 @@ * Calculate the time zone. The timezone is 12 bit signed 2's * compliment, so we gotta do some extra magic to handle it right. */ - tz.u_tz_offset = time->type_tz; + tz.u_tz_offset = le16toh(time->type_tz); tz.u_tz_offset &= 0x0fff; if (tz.u_tz_offset & 0x0800) tz.u_tz_offset |= 0xf000; /* extend the sign to 16 bits */ @@ -326,13 +327,13 @@ vap->va_fsid = dev2udev(node->i_dev); vap->va_fileid = node->hash_id; vap->va_mode = udf_permtomode(node); - vap->va_nlink = fentry->link_cnt; + vap->va_nlink = le16toh(fentry->link_cnt); /* * XXX The spec says that -1 is valid for uid/gid and indicates an * invalid uid/gid. How should this be represented? */ - vap->va_uid = (fentry->uid == -1) ? 0 : fentry->uid; - vap->va_gid = (fentry->gid == -1) ? 0 : fentry->gid; + vap->va_uid = (le32toh(fentry->uid) == -1) ? 0 : le32toh(fentry->uid); + vap->va_gid = (le32toh(fentry->gid) == -1) ? 0 : le32toh(fentry->gid); udf_timetotimespec(&fentry->atime, &vap->va_atime); udf_timetotimespec(&fentry->mtime, &vap->va_mtime); vap->va_ctime = vap->va_mtime; /* XXX Stored as an Extended Attribute */ @@ -345,24 +346,25 @@ * make it appear so. */ if (fentry->logblks_rec != 0) { - vap->va_size = fentry->logblks_rec * node->udfmp->bsize; + vap->va_size = + le64toh(fentry->logblks_rec) * node->udfmp->bsize; } else { vap->va_size = node->udfmp->bsize; } } else { - vap->va_size = fentry->inf_len; + vap->va_size = le64toh(fentry->inf_len); } vap->va_flags = 0; vap->va_gen = 1; vap->va_blocksize = node->udfmp->bsize; - vap->va_bytes = fentry->inf_len; + vap->va_bytes = le64toh(fentry->inf_len); vap->va_type = vp->v_type; vap->va_filerev = 0; /* XXX */ return (0); } /* - * File specific ioctls. DeCSS candidate? + * File specific ioctls. */ static int udf_ioctl(struct vop_ioctl_args *a) @@ -411,7 +413,7 @@ if (uio->uio_offset < 0) return (EINVAL); - fsize = node->fentry->inf_len; + fsize = le64toh(node->fentry->inf_len); while (uio->uio_offset < fsize && uio->uio_resid > 0) { offset = uio->uio_offset; @@ -602,7 +604,7 @@ * looking for the l_iu and l_fi fields. */ if (ds->off + UDF_FID_SIZE > ds->size || - ds->off + fid->l_iu + fid->l_fi + UDF_FID_SIZE > ds->size) { + ds->off + le16toh(fid->l_iu) + fid->l_fi + UDF_FID_SIZE > ds->size){ /* Copy what we have of the fid into a buffer */ frag_size = ds->size - ds->off; @@ -649,7 +651,7 @@ * copy in the rest of the fid from the new * allocation. */ - total_fid_size = UDF_FID_SIZE + fid->l_iu + fid->l_fi; + total_fid_size = UDF_FID_SIZE + le16toh(fid->l_iu) + fid->l_fi; if (total_fid_size > ds->udfmp->bsize) { printf("udf: invalid FID\n"); ds->error = EIO; @@ -660,7 +662,7 @@ ds->fid_fragment = 1; } else { - total_fid_size = fid->l_iu + fid->l_fi + UDF_FID_SIZE; + total_fid_size = le16toh(fid->l_iu) + fid->l_fi + UDF_FID_SIZE; } /* @@ -733,7 +735,7 @@ * Iterate through the file id descriptors. Give the parent dir * entry special attention. */ - ds = udf_opendir(node, uio->uio_offset, node->fentry->inf_len, + ds = udf_opendir(node, uio->uio_offset, le64toh(node->fentry->inf_len), node->udfmp); while ((fid = udf_getfid(ds)) != NULL) { @@ -918,7 +920,7 @@ flags = a->a_cnp->cn_flags; nameptr = a->a_cnp->cn_nameptr; namelen = a->a_cnp->cn_namelen; - fsize = node->fentry->inf_len; + fsize = le64toh(node->fentry->inf_len); td = a->a_cnp->cn_thread; /* @@ -1077,8 +1079,8 @@ * allocation descriptor field of the file entry. */ fentry = node->fentry; - *data = &fentry->data[fentry->l_ea]; - *size = fentry->l_ad; + *data = &fentry->data[le32toh(fentry->l_ea)]; + *size = le32toh(fentry->l_ad); return (0); } else if (error != 0) { return (error); @@ -1120,7 +1122,7 @@ fentry = node->fentry; tag = &fentry->icbtag; - switch (tag->strat_type) { + switch (le16toh(tag->strat_type)) { case 4: break; @@ -1133,7 +1135,7 @@ return (ENODEV); } - switch (tag->flags & 0x7) { + switch (le16toh(tag->flags) & 0x7) { case 0: /* * The allocation descriptor field is filled with short_ad's. @@ -1143,11 +1145,12 @@ do { offset -= icblen; ad_offset = sizeof(struct short_ad) * ad_num; - if (ad_offset > fentry->l_ad) { + if (ad_offset > le32toh(fentry->l_ad)) { printf("File offset out of bounds\n"); return (EINVAL); } - icb = GETICB(long_ad, fentry, fentry->l_ea + ad_offset); + icb = GETICB(long_ad, fentry, + le32toh(fentry->l_ea) + ad_offset); icblen = GETICBLEN(short_ad, icb); ad_num++; } while(offset >= icblen); @@ -1167,17 +1170,18 @@ do { offset -= icblen; ad_offset = sizeof(struct long_ad) * ad_num; - if (ad_offset > fentry->l_ad) { + if (ad_offset > le32toh(fentry->l_ad)) { printf("File offset out of bounds\n"); return (EINVAL); } - icb = GETICB(long_ad, fentry, fentry->l_ea + ad_offset); + icb = GETICB(long_ad, fentry, + le32toh(fentry->l_ea) + ad_offset); icblen = GETICBLEN(long_ad, icb); ad_num++; } while(offset >= icblen); lsector = (offset >> udfmp->bshift) + - ((struct long_ad *)(icb))->loc.lb_num; + le32toh(((struct long_ad *)(icb))->loc.lb_num); *max_size = GETICBLEN(long_ad, icb); @@ -1207,9 +1211,11 @@ */ if (udfmp->s_table != NULL) { for (i = 0; i< udfmp->s_table_entries; i++) { - p_offset = lsector - udfmp->s_table->entries[i].org; + p_offset = + lsector - le32toh(udfmp->s_table->entries[i].org); if ((p_offset < udfmp->p_sectors) && (p_offset >= 0)) { - *sector = udfmp->s_table->entries[i].map + + *sector = + le32toh(udfmp->s_table->entries[i].map) + p_offset; break; } ==== //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum.c#3 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum.c,v 1.2 2004/06/18 19:53:33 le Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum.c,v 1.3 2004/06/24 02:40:34 csjp Exp $"); #include #include @@ -319,8 +319,16 @@ d = g_malloc(sizeof(*d), M_WAITOK | M_ZERO); bcopy(d2, d, sizeof(*d)); - /* XXX */ + /* + * Make sure that the provider specified in the drive + * specification is an active GEOM provider. + */ pp = g_provider_by_name(d->device); + if (pp == NULL) { + gctl_error(req, "%s: drive not found", d->device); + g_free(d); + return (-1); + } d->size = pp->mediasize - GV_DATA_START; d->avail = d->size; @@ -456,8 +464,17 @@ */ LIST_FOREACH(d, &sc->drives, drive) { if (d->geom == NULL) { - /* XXX */ + /* + * XXX if the provider disapears before we get a chance + * to write the config out to the drive, should this + * be handled any differently? + */ pp = g_provider_by_name(d->device); + if (pp == NULL) { + printf("geom_vinum: %s: drive disapeared?\n", + d->device); + continue; + } cp = g_new_consumer(gp); g_attach(cp, pp); gv_save_config(cp, d, sc); ==== //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum_plex.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_plex.c,v 1.3 2004/06/18 19:53:33 le Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_plex.c,v 1.4 2004/06/23 23:52:55 le Exp $"); #include #include @@ -275,6 +275,8 @@ boff); if (err) { + if (p->org == GV_PLEX_RAID5) + gv_free_raid5_packet(wp); bp->bio_completed += bcount; if (bp->bio_error == 0) bp->bio_error = err; ==== //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum_raid5.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_raid5.c,v 1.3 2004/06/22 14:54:31 le Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/vinum/geom_vinum_raid5.c,v 1.5 2004/06/23 23:52:55 le Exp $"); #include #include @@ -70,6 +70,26 @@ return (wp); } +void +gv_free_raid5_packet(struct gv_raid5_packet *wp) +{ + struct gv_raid5_bit *r, *r2; + + /* Remove all the bits from this work packet. */ + TAILQ_FOREACH_SAFE(r, &wp->bits, list, r2) { + TAILQ_REMOVE(&wp->bits, r, list); + if (r->malloc) + g_free(r->buf); + if (r->bio != NULL) + g_destroy_bio(r->bio); + g_free(r); + } + + if (wp->bufmalloc == 1) + g_free(wp->buf); + g_free(wp); +} + /* * Check if the stripe that the work packet wants is already being used by * some other work packet. @@ -109,7 +129,6 @@ mtx_lock(&p->worklist_mtx); for (;;) { restart = 0; - g_trace(G_T_TOPOLOGY, "gv_raid5_worker scan"); TAILQ_FOREACH_SAFE(wp, &p->worklist, list, wpt) { /* This request packet is already being processed. */ if (wp->state == IO) @@ -141,9 +160,7 @@ mtx_lock(&p->worklist_mtx); } TAILQ_REMOVE(&p->worklist, wp, list); - if (wp->bufmalloc == 1) - g_free(wp->buf); - g_free(wp); + gv_free_raid5_packet(wp); restart++; /*break;*/ } @@ -152,7 +169,6 @@ /* Self-destruct. */ if (p->flags & GV_PLEX_THREAD_DIE) break; - g_trace(G_T_TOPOLOGY, "gv_raid5_worker sleep"); error = msleep(p, &p->worklist_mtx, PRIBIO, "-", hz/100); } @@ -240,15 +256,6 @@ break; } - g_destroy_bio(bp); - - if (rbp != NULL) { - if (rbp->malloc == 1) - g_free(rbp->buf); - TAILQ_REMOVE(&wp->bits, rbp, list); - g_free(rbp); - } - /* This request group is done. */ if (wp->active == 0) wp->state = FINISH; ==== //depot/projects/netperf_socket/sys/geom/vinum/geom_vinum_raid5.h#2 (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/geom/vinum/geom_vinum_raid5.h,v 1.1 2004/06/12 21:16:10 le Exp $ + * $FreeBSD: src/sys/geom/vinum/geom_vinum_raid5.h,v 1.2 2004/06/23 23:52:55 le Exp $ */ #ifndef _GEOM_VINUM_RAID5_H_ @@ -85,6 +85,7 @@ int gv_build_raid5_req(struct gv_raid5_packet *, struct bio *, caddr_t, long, off_t); +void gv_free_raid5_packet(struct gv_raid5_packet *); void gv_raid5_done(struct bio *); void gv_raid5_worker(void *); struct gv_raid5_packet *gv_new_raid5_packet(void); ==== //depot/projects/netperf_socket/sys/i386/linux/imgact_linux.c#3 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/i386/linux/imgact_linux.c,v 1.51 2004/02/04 21:52:54 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/linux/imgact_linux.c,v 1.52 2004/06/24 02:24:39 obrien Exp $"); #include #include @@ -192,7 +192,7 @@ #ifdef DEBUG printf("imgact: startaddr=%08lx, length=%08lx\n", - (u_long)vmaddr, a_out->a_text + a_out->a_data); + (u_long)vmaddr, (u_long)a_out->a_text + (u_long)a_out->a_data); #endif /* * allow read/write of data ==== //depot/projects/netperf_socket/sys/kern/uipc_socket.c#23 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/uipc_socket.c,v 1.187 2004/06/22 03:49:22 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/uipc_socket.c,v 1.188 2004/06/24 00:54:26 rwatson Exp $"); #include "opt_inet.h" #include "opt_mac.h" @@ -1915,15 +1915,15 @@ if (events & (POLLIN | POLLINIGNEOF | POLLPRI | POLLRDNORM | POLLRDBAND)) { + SOCKBUF_LOCK(&so->so_rcv); selrecord(td, &so->so_rcv.sb_sel); - SOCKBUF_LOCK(&so->so_rcv); so->so_rcv.sb_flags |= SB_SEL; SOCKBUF_UNLOCK(&so->so_rcv); } if (events & (POLLOUT | POLLWRNORM)) { + SOCKBUF_LOCK(&so->so_snd); selrecord(td, &so->so_snd.sb_sel); - SOCKBUF_LOCK(&so->so_snd); so->so_snd.sb_flags |= SB_SEL; SOCKBUF_UNLOCK(&so->so_snd); } ==== //depot/projects/netperf_socket/sys/kern/uipc_socket2.c#20 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/uipc_socket2.c,v 1.134 2004/06/21 00:20:42 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/uipc_socket2.c,v 1.135 2004/06/24 01:37:03 rwatson Exp $"); #include "opt_mac.h" #include "opt_param.h" @@ -506,24 +506,26 @@ { struct thread *td = curthread; - if (sbreserve(&so->so_snd, sndcc, so, td) == 0) + SOCKBUF_LOCK(&so->so_snd); + SOCKBUF_LOCK(&so->so_rcv); + if (sbreserve_locked(&so->so_snd, sndcc, so, td) == 0) goto bad; - if (sbreserve(&so->so_rcv, rcvcc, so, td) == 0) + if (sbreserve_locked(&so->so_rcv, rcvcc, so, td) == 0) goto bad2; - SOCKBUF_LOCK(&so->so_rcv); if (so->so_rcv.sb_lowat == 0) so->so_rcv.sb_lowat = 1; - SOCKBUF_UNLOCK(&so->so_rcv); - SOCKBUF_LOCK(&so->so_snd); if (so->so_snd.sb_lowat == 0) so->so_snd.sb_lowat = MCLBYTES; if (so->so_snd.sb_lowat > so->so_snd.sb_hiwat) so->so_snd.sb_lowat = so->so_snd.sb_hiwat; + SOCKBUF_UNLOCK(&so->so_rcv); SOCKBUF_UNLOCK(&so->so_snd); return (0); bad2: - sbrelease(&so->so_snd, so); + sbrelease_locked(&so->so_snd, so); bad: + SOCKBUF_UNLOCK(&so->so_rcv); + SOCKBUF_UNLOCK(&so->so_snd); return (ENOBUFS); } @@ -553,7 +555,7 @@ * if buffering efficiency is near the normal case. */ int -sbreserve(sb, cc, so, td) +sbreserve_locked(sb, cc, so, td) struct sockbuf *sb; u_long cc; struct socket *so; @@ -561,6 +563,8 @@ { rlim_t sbsize_limit; + SOCKBUF_LOCK_ASSERT(sb); + /* * td will only be NULL when we're in an interrupt * (e.g. in tcp_input()) @@ -582,6 +586,21 @@ return (1); } +int +sbreserve(sb, cc, so, td) + struct sockbuf *sb; + u_long cc; + struct socket *so; + struct thread *td; +{ + int error; + + SOCKBUF_LOCK(sb); + error = sbreserve_locked(sb, cc, so, td); + SOCKBUF_UNLOCK(sb); + return (error); +} + /* * Free mbufs held by a socket, and reserved mbuf space. */ ==== //depot/projects/netperf_socket/sys/kern/uipc_syscalls.c#21 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/uipc_syscalls.c,v 1.195 2004/06/22 23:58:09 bms Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/uipc_syscalls.c,v 1.196 2004/06/24 01:43:23 rwatson Exp $"); #include "opt_compat.h" #include "opt_ktrace.h" ==== //depot/projects/netperf_socket/sys/netgraph/ng_base.c#4 (text+ko) ==== @@ -36,7 +36,7 @@ * Authors: Julian Elischer * Archie Cobbs * - * $FreeBSD: src/sys/netgraph/ng_base.c,v 1.75 2004/05/29 07:21:46 julian Exp $ + * $FreeBSD: src/sys/netgraph/ng_base.c,v 1.76 2004/06/24 01:47:31 rwatson Exp $ * $Whistle: ng_base.c,v 1.39 1999/01/28 23:54:53 julian Exp $ */ @@ -170,6 +170,7 @@ #define NG_IDHASH_FN(ID) ((ID) % (NG_ID_HASH_SIZE)) #define NG_IDHASH_FIND(ID, node) \ do { \ + mtx_assert(&ng_idhash_mtx, MA_OWNED); \ LIST_FOREACH(node, &ng_ID_hash[NG_IDHASH_FN(ID)], \ nd_idnodes) { \ if (NG_NODE_IS_VALID(node) \ @@ -3231,10 +3232,12 @@ { node_p node; int i = 1; + mtx_lock(&ng_nodelist_mtx); SLIST_FOREACH(node, &ng_allnodes, nd_all) { printf("[%d] ", i++); dumpnode(node, NULL, 0); } + mtx_unlock(&ng_nodelist_mtx); } static void @@ -3242,10 +3245,12 @@ { >>> TRUNCATED FOR MAIL (1000 lines) <<<