From owner-svn-src-stable-8@FreeBSD.ORG Sun Aug 7 17:18:22 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AEEC6106566C; Sun, 7 Aug 2011 17:18:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DBD58FC13; Sun, 7 Aug 2011 17:18:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p77HIM9x009200; Sun, 7 Aug 2011 17:18:22 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p77HIMUh009197; Sun, 7 Aug 2011 17:18:22 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108071718.p77HIMUh009197@svn.freebsd.org> From: Alexander Motin Date: Sun, 7 Aug 2011 17:18:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224694 - stable/8/sys/dev/ahci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 17:18:22 -0000 Author: mav Date: Sun Aug 7 17:18:22 2011 New Revision: 224694 URL: http://svn.freebsd.org/changeset/base/224694 Log: MFC r224498: In some cases, at least on Marvell 88SE912x controllers, Current Command Slot field of the PxCMD register may point to an empty command slot. That breaks command timeout detection logic, making impossible to find what command actually caused timeout, and leading to infinite wait. Workaround that by checking whether pointed command slot is really used and can timeout in its time. And if not, fallback to the dumb algorithm used with FBS -- let all commands to time out and then fail all of them. Modified: stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ahci/ahci.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Sun Aug 7 15:52:13 2011 (r224693) +++ stable/8/sys/dev/ahci/ahci.c Sun Aug 7 17:18:22 2011 (r224694) @@ -1873,12 +1873,13 @@ ahci_execute_transaction(struct ahci_slo device_printf(dev, "Poll timeout on slot %d port %d\n", slot->slot, port); device_printf(dev, "is %08x cs %08x ss %08x " - "rs %08x tfd %02x serr %08x\n", + "rs %08x tfd %02x serr %08x cmd %08x\n", ATA_INL(ch->r_mem, AHCI_P_IS), ATA_INL(ch->r_mem, AHCI_P_CI), ATA_INL(ch->r_mem, AHCI_P_SACT), ch->rslots, ATA_INL(ch->r_mem, AHCI_P_TFD), - ATA_INL(ch->r_mem, AHCI_P_SERR)); + ATA_INL(ch->r_mem, AHCI_P_SERR), + ATA_INL(ch->r_mem, AHCI_P_CMD)); et = AHCI_ERR_TIMEOUT; } @@ -1954,8 +1955,12 @@ ahci_timeout(struct ahci_slot *slot) ccs = (ATA_INL(ch->r_mem, AHCI_P_CMD) & AHCI_P_CMD_CCS_MASK) >> AHCI_P_CMD_CCS_SHIFT; if ((sstatus & (1 << slot->slot)) != 0 || ccs == slot->slot || - ch->fbs_enabled) + ch->fbs_enabled || ch->wrongccs) slot->state = AHCI_SLOT_EXECUTING; + else if ((ch->rslots & (1 << ccs)) == 0) { + ch->wrongccs = 1; + slot->state = AHCI_SLOT_EXECUTING; + } callout_reset(&slot->timeout, (int)slot->ccb->ccb_h.timeout * hz / 2000, @@ -1965,10 +1970,12 @@ ahci_timeout(struct ahci_slot *slot) device_printf(dev, "Timeout on slot %d port %d\n", slot->slot, slot->ccb->ccb_h.target_id & 0x0f); - device_printf(dev, "is %08x cs %08x ss %08x rs %08x tfd %02x serr %08x\n", + device_printf(dev, "is %08x cs %08x ss %08x rs %08x tfd %02x " + "serr %08x cmd %08x\n", ATA_INL(ch->r_mem, AHCI_P_IS), ATA_INL(ch->r_mem, AHCI_P_CI), ATA_INL(ch->r_mem, AHCI_P_SACT), ch->rslots, - ATA_INL(ch->r_mem, AHCI_P_TFD), ATA_INL(ch->r_mem, AHCI_P_SERR)); + ATA_INL(ch->r_mem, AHCI_P_TFD), ATA_INL(ch->r_mem, AHCI_P_SERR), + ATA_INL(ch->r_mem, AHCI_P_CMD)); /* Handle frozen command. */ if (ch->frozen) { @@ -1981,7 +1988,7 @@ ahci_timeout(struct ahci_slot *slot) } xpt_done(fccb); } - if (!ch->fbs_enabled) { + if (!ch->fbs_enabled && !ch->wrongccs) { /* Without FBS we know real timeout source. */ ch->fatalerr = 1; /* Handle command with timeout. */ @@ -2579,6 +2586,7 @@ ahci_reset(device_t dev) xpt_release_simq(ch->sim, TRUE); ch->eslots = 0; ch->toslots = 0; + ch->wrongccs = 0; ch->fatalerr = 0; /* Tell the XPT about the event */ xpt_async(AC_BUS_RESET, ch->path, NULL); Modified: stable/8/sys/dev/ahci/ahci.h ============================================================================== --- stable/8/sys/dev/ahci/ahci.h Sun Aug 7 15:52:13 2011 (r224693) +++ stable/8/sys/dev/ahci/ahci.h Sun Aug 7 17:18:22 2011 (r224694) @@ -426,6 +426,7 @@ struct ahci_channel { int resetting; /* Hard-reset in progress. */ int resetpolldiv; /* Hard-reset poll divider. */ int listening; /* SUD bit is cleared. */ + int wrongccs; /* CCS field in CMD was wrong */ union ccb *frozen; /* Frozen command */ struct callout pm_timer; /* Power management events */ struct callout reset_timer; /* Hard-reset timeout */ From owner-svn-src-stable-8@FreeBSD.ORG Sun Aug 7 17:19:59 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8720106566B; Sun, 7 Aug 2011 17:19:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D7BE28FC0C; Sun, 7 Aug 2011 17:19:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p77HJxRl009292; Sun, 7 Aug 2011 17:19:59 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p77HJxnp009290; Sun, 7 Aug 2011 17:19:59 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108071719.p77HJxnp009290@svn.freebsd.org> From: Alexander Motin Date: Sun, 7 Aug 2011 17:19:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224695 - stable/8/sys/cam/ata X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 17:20:00 -0000 Author: mav Date: Sun Aug 7 17:19:59 2011 New Revision: 224695 URL: http://svn.freebsd.org/changeset/base/224695 Log: MFC r224531: Higher-priority initialization request can eat request scheduling done from adaclose(). Add immediate_priority check into adaschedule() to restore it. Modified: stable/8/sys/cam/ata/ata_da.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Sun Aug 7 17:18:22 2011 (r224694) +++ stable/8/sys/cam/ata/ata_da.c Sun Aug 7 17:19:59 2011 (r224695) @@ -444,12 +444,20 @@ static void adaschedule(struct cam_periph *periph) { struct ada_softc *softc = (struct ada_softc *)periph->softc; + uint32_t prio; + /* Check if cam_periph_getccb() was called. */ + prio = periph->immediate_priority; + + /* Check if we have more work to do. */ if (bioq_first(&softc->bio_queue) || (!softc->trim_running && bioq_first(&softc->trim_queue))) { - /* Have more work to do, so ensure we stay scheduled */ - xpt_schedule(periph, CAM_PRIORITY_NORMAL); + prio = CAM_PRIORITY_NORMAL; } + + /* Schedule CCB if any of above is true. */ + if (prio != CAM_PRIORITY_NONE) + xpt_schedule(periph, prio); } /* From owner-svn-src-stable-8@FreeBSD.ORG Sun Aug 7 17:28:08 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C7AC1065670; Sun, 7 Aug 2011 17:28:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 827C28FC08; Sun, 7 Aug 2011 17:28:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p77HS8LC009647; Sun, 7 Aug 2011 17:28:08 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p77HS8QD009645; Sun, 7 Aug 2011 17:28:08 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108071728.p77HS8QD009645@svn.freebsd.org> From: Alexander Motin Date: Sun, 7 Aug 2011 17:28:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224696 - stable/8/sys/cam X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 17:28:08 -0000 Author: mav Date: Sun Aug 7 17:28:08 2011 New Revision: 224696 URL: http://svn.freebsd.org/changeset/base/224696 Log: MFC r224496: In some cases failed SATA disks may report their presence, but don't respond to any commands. I've found, that because of multiple command retries, each of which cause 30s timeout, bus reset and another retry or requeue for many commands, it may take ages to eventually drop the failed device. The odd thing is that those retries continue even after XPT considered device as dead and invalidated it. This patch makes cam_periph_error() to block any command retries after periph was marked as invalid. With that patch all activity completes in 1-2 minutes, just after several timeouts, required to consider device death. This should make ZFS, gmirror, graid, etc. operation more robust. Modified: stable/8/sys/cam/cam_periph.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cam/cam_periph.c ============================================================================== --- stable/8/sys/cam/cam_periph.c Sun Aug 7 17:19:59 2011 (r224695) +++ stable/8/sys/cam/cam_periph.c Sun Aug 7 17:28:08 2011 (r224696) @@ -1484,7 +1484,8 @@ camperiphscsisenseerror(union ccb *ccb, * make sure we actually have retries available. */ if ((err_action & SSQ_DECREMENT_COUNT) != 0) { - if (ccb->ccb_h.retry_count > 0) + if (ccb->ccb_h.retry_count > 0 && + (periph->flags & CAM_PERIPH_INVALID) == 0) ccb->ccb_h.retry_count--; else { *action_string = "Retries exhausted"; @@ -1643,6 +1644,7 @@ int cam_periph_error(union ccb *ccb, cam_flags camflags, u_int32_t sense_flags, union ccb *save_ccb) { + struct cam_periph *periph; const char *action_string; cam_status status; int frozen; @@ -1650,7 +1652,8 @@ cam_periph_error(union ccb *ccb, cam_fla int openings; u_int32_t relsim_flags; u_int32_t timeout = 0; - + + periph = xpt_path_periph(ccb->ccb_h.path); action_string = NULL; status = ccb->ccb_h.status; frozen = (status & CAM_DEV_QFRZN) != 0; @@ -1712,9 +1715,9 @@ cam_periph_error(union ccb *ccb, cam_fla xpt_print(ccb->ccb_h.path, "Data overrun\n"); printed++; } - error = EIO; /* we have to kill the command */ /* decrement the number of retries */ - if (ccb->ccb_h.retry_count > 0) { + if (ccb->ccb_h.retry_count > 0 && + (periph->flags & CAM_PERIPH_INVALID) == 0) { ccb->ccb_h.retry_count--; error = ERESTART; } else { @@ -1733,7 +1736,8 @@ cam_periph_error(union ccb *ccb, cam_fla struct cam_path *newpath; if ((camflags & CAM_RETRY_SELTO) != 0) { - if (ccb->ccb_h.retry_count > 0) { + if (ccb->ccb_h.retry_count > 0 && + (periph->flags & CAM_PERIPH_INVALID) == 0) { ccb->ccb_h.retry_count--; error = ERESTART; @@ -1751,10 +1755,11 @@ cam_periph_error(union ccb *ccb, cam_fla timeout = periph_selto_delay; break; } + action_string = "Retries exhausted"; } error = ENXIO; /* Should we do more if we can't create the path?? */ - if (xpt_create_path(&newpath, xpt_path_periph(ccb->ccb_h.path), + if (xpt_create_path(&newpath, periph, xpt_path_path_id(ccb->ccb_h.path), xpt_path_target_id(ccb->ccb_h.path), CAM_LUN_WILDCARD) != CAM_REQ_CMP) @@ -1799,11 +1804,16 @@ cam_periph_error(union ccb *ccb, cam_fla /* FALLTHROUGH */ case CAM_REQUEUE_REQ: /* Unconditional requeue */ - error = ERESTART; if (bootverbose && printed == 0) { xpt_print(ccb->ccb_h.path, "Request requeued\n"); printed++; } + if ((periph->flags & CAM_PERIPH_INVALID) == 0) + error = ERESTART; + else { + action_string = "Retries exhausted"; + error = EIO; + } break; case CAM_RESRC_UNAVAIL: /* Wait a bit for the resource shortage to abate. */ @@ -1818,7 +1828,8 @@ cam_periph_error(union ccb *ccb, cam_fla /* FALLTHROUGH */ default: /* decrement the number of retries */ - if (ccb->ccb_h.retry_count > 0) { + if (ccb->ccb_h.retry_count > 0 && + (periph->flags & CAM_PERIPH_INVALID) == 0) { ccb->ccb_h.retry_count--; error = ERESTART; if (bootverbose && printed == 0) { From owner-svn-src-stable-8@FreeBSD.ORG Sun Aug 7 17:30:04 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E77281065673; Sun, 7 Aug 2011 17:30:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCD258FC21; Sun, 7 Aug 2011 17:30:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p77HU3TM009755; Sun, 7 Aug 2011 17:30:03 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p77HU3XB009754; Sun, 7 Aug 2011 17:30:03 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108071730.p77HU3XB009754@svn.freebsd.org> From: Alexander Motin Date: Sun, 7 Aug 2011 17:30:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224697 - stable/8/sys/cam/ata X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2011 17:30:04 -0000 Author: mav Date: Sun Aug 7 17:30:03 2011 New Revision: 224697 URL: http://svn.freebsd.org/changeset/base/224697 Log: MFC r224497: Add control for ATA disk read-ahead, alike to the previously added write cache control. Some controller BIOS'es tend to disable read-ahead, that dramatically reduces read performance. Previously ata(4) always enabled read-ahead unconditionally. Modified: stable/8/sys/cam/ata/ata_da.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Sun Aug 7 17:28:08 2011 (r224696) +++ stable/8/sys/cam/ata/ata_da.c Sun Aug 7 17:30:03 2011 (r224697) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #define ATA_MAX_28BIT_LBA 268435455UL typedef enum { + ADA_STATE_RAHEAD, ADA_STATE_WCACHE, ADA_STATE_NORMAL } ada_state; @@ -93,7 +94,8 @@ typedef enum { } ada_quirks; typedef enum { - ADA_CCB_WCACHE = 0x01, + ADA_CCB_RAHEAD = 0x01, + ADA_CCB_WCACHE = 0x02, ADA_CCB_BUFFER_IO = 0x03, ADA_CCB_WAITING = 0x04, ADA_CCB_DUMP = 0x05, @@ -130,6 +132,7 @@ struct ada_softc { int outstanding_cmds; int trim_max_ranges; int trim_running; + int read_ahead; int write_cache; #ifdef ADA_TEST_FAILURE int force_read_error; @@ -278,10 +281,19 @@ static void adashutdown(void *arg, int #define ADA_DEFAULT_SPINDOWN_SHUTDOWN 1 #endif +#ifndef ADA_DEFAULT_READ_AHEAD +#define ADA_DEFAULT_READ_AHEAD 1 +#endif + #ifndef ADA_DEFAULT_WRITE_CACHE #define ADA_DEFAULT_WRITE_CACHE 1 #endif +#define ADA_RA (softc->read_ahead >= 0 ? \ + softc->read_ahead : ada_read_ahead) +#define ADA_WC (softc->write_cache >= 0 ? \ + softc->write_cache : ada_write_cache) + /* * Most platforms map firmware geometry to actual, but some don't. If * not overridden, default to nothing. @@ -294,6 +306,7 @@ static int ada_retry_count = ADA_DEFAULT static int ada_default_timeout = ADA_DEFAULT_TIMEOUT; static int ada_send_ordered = ADA_DEFAULT_SEND_ORDERED; static int ada_spindown_shutdown = ADA_DEFAULT_SPINDOWN_SHUTDOWN; +static int ada_read_ahead = ADA_DEFAULT_READ_AHEAD; static int ada_write_cache = ADA_DEFAULT_WRITE_CACHE; SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD, 0, @@ -310,6 +323,9 @@ TUNABLE_INT("kern.cam.ada.ada_send_order SYSCTL_INT(_kern_cam_ada, OID_AUTO, spindown_shutdown, CTLFLAG_RW, &ada_spindown_shutdown, 0, "Spin down upon shutdown"); TUNABLE_INT("kern.cam.ada.spindown_shutdown", &ada_spindown_shutdown); +SYSCTL_INT(_kern_cam_ada, OID_AUTO, read_ahead, CTLFLAG_RW, + &ada_read_ahead, 0, "Enable disk read-ahead"); +TUNABLE_INT("kern.cam.ada.read_ahead", &ada_read_ahead); SYSCTL_INT(_kern_cam_ada, OID_AUTO, write_cache, CTLFLAG_RW, &ada_write_cache, 0, "Enable disk write cache"); TUNABLE_INT("kern.cam.ada.write_cache", &ada_write_cache); @@ -715,16 +731,19 @@ adaasync(void *callback_arg, u_int32_t c softc = (struct ada_softc *)periph->softc; cam_periph_async(periph, code, path, arg); - if (ada_write_cache < 0 && softc->write_cache < 0) - break; if (softc->state != ADA_STATE_NORMAL) break; xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); - if ((cgd.ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) == 0) - break; - softc->state = ADA_STATE_WCACHE; + if (ADA_RA >= 0 && + cgd.ident_data.support.command1 & ATA_SUPPORT_LOOKAHEAD) + softc->state = ADA_STATE_RAHEAD; + else if (ADA_WC >= 0 && + cgd.ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) + softc->state = ADA_STATE_WCACHE; + else + break; cam_periph_acquire(periph); cam_freeze_devq_arg(periph->path, RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); @@ -767,6 +786,9 @@ adasysctlinit(void *context, int pending } SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "read_ahead", CTLFLAG_RW | CTLFLAG_MPSAFE, + &softc->read_ahead, 0, "Enable disk read ahead."); + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "write_cache", CTLFLAG_RW | CTLFLAG_MPSAFE, &softc->write_cache, 0, "Enable disk write cache."); #ifdef ADA_TEST_FAILURE @@ -881,6 +903,10 @@ adaregister(struct cam_periph *periph, v quirks = softc->quirks; TUNABLE_INT_FETCH(announce_buf, &quirks); softc->quirks = quirks; + softc->read_ahead = -1; + snprintf(announce_buf, sizeof(announce_buf), + "kern.cam.ada.%d.read_ahead", periph->unit_number); + TUNABLE_INT_FETCH(announce_buf, &softc->read_ahead); softc->write_cache = -1; snprintf(announce_buf, sizeof(announce_buf), "kern.cam.ada.%d.write_cache", periph->unit_number); @@ -979,7 +1005,14 @@ adaregister(struct cam_periph *periph, v (ADA_DEFAULT_TIMEOUT * hz) / ADA_ORDEREDTAG_INTERVAL, adasendorderedtag, softc); - if ((ada_write_cache >= 0 || softc->write_cache >= 0) && + if (ADA_RA >= 0 && + cgd->ident_data.support.command1 & ATA_SUPPORT_LOOKAHEAD) { + softc->state = ADA_STATE_RAHEAD; + cam_periph_acquire(periph); + cam_freeze_devq_arg(periph->path, + RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); + xpt_schedule(periph, CAM_PRIORITY_DEV); + } else if (ADA_WC >= 0 && cgd->ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) { softc->state = ADA_STATE_WCACHE; cam_periph_acquire(periph); @@ -1236,8 +1269,19 @@ out: adaschedule(periph); break; } + case ADA_STATE_RAHEAD: case ADA_STATE_WCACHE: { + if (softc->flags & ADA_FLAG_PACK_INVALID) { + softc->state = ADA_STATE_NORMAL; + xpt_release_ccb(start_ccb); + cam_release_devq(periph->path, + RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_DEV + 1, FALSE); + adaschedule(periph); + cam_periph_release_locked(periph); + return; + } + cam_fill_ataio(ataio, 1, adadone, @@ -1247,10 +1291,15 @@ out: 0, ada_default_timeout*1000); - ata_28bit_cmd(ataio, ATA_SETFEATURES, (softc->write_cache > 0 || - (softc->write_cache < 0 && ada_write_cache)) ? - ATA_SF_ENAB_WCACHE : ATA_SF_DIS_WCACHE, 0, 0); - start_ccb->ccb_h.ccb_state = ADA_CCB_WCACHE; + if (softc->state == ADA_STATE_RAHEAD) { + ata_28bit_cmd(ataio, ATA_SETFEATURES, ADA_RA ? + ATA_SF_ENAB_RCACHE : ATA_SF_DIS_RCACHE, 0, 0); + start_ccb->ccb_h.ccb_state = ADA_CCB_RAHEAD; + } else { + ata_28bit_cmd(ataio, ATA_SETFEATURES, ADA_WC ? + ATA_SF_ENAB_WCACHE : ATA_SF_DIS_WCACHE, 0, 0); + start_ccb->ccb_h.ccb_state = ADA_CCB_WCACHE; + } xpt_action(start_ccb); break; } @@ -1262,6 +1311,7 @@ adadone(struct cam_periph *periph, union { struct ada_softc *softc; struct ccb_ataio *ataio; + struct ccb_getdev *cgd; softc = (struct ada_softc *)periph->softc; ataio = &done_ccb->ataio; @@ -1343,6 +1393,47 @@ adadone(struct cam_periph *periph, union biodone(bp); break; } + case ADA_CCB_RAHEAD: + { + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (adaerror(done_ccb, 0, 0) == ERESTART) { + return; + } else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + } + } + + /* + * Since our peripheral may be invalidated by an error + * above or an external event, we must release our CCB + * before releasing the reference on the peripheral. + * The peripheral will only go away once the last reference + * is removed, and we need it around for the CCB release + * operation. + */ + cgd = (struct ccb_getdev *)done_ccb; + xpt_setup_ccb(&cgd->ccb_h, periph->path, CAM_PRIORITY_NORMAL); + cgd->ccb_h.func_code = XPT_GDEV_TYPE; + xpt_action((union ccb *)cgd); + if (ADA_WC >= 0 && + cgd->ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) { + softc->state = ADA_STATE_WCACHE; + xpt_release_ccb(done_ccb); + xpt_schedule(periph, CAM_PRIORITY_DEV); + return; + } + softc->state = ADA_STATE_NORMAL; + xpt_release_ccb(done_ccb); + cam_release_devq(periph->path, + RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_DEV + 1, FALSE); + adaschedule(periph); + cam_periph_release_locked(periph); + return; + } case ADA_CCB_WCACHE: { if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 8 08:22:16 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49747106566B; Mon, 8 Aug 2011 08:22:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 38D678FC12; Mon, 8 Aug 2011 08:22:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p788MGCX037593; Mon, 8 Aug 2011 08:22:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p788MG0s037591; Mon, 8 Aug 2011 08:22:16 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201108080822.p788MG0s037591@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 8 Aug 2011 08:22:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224704 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 08:22:16 -0000 Author: kib Date: Mon Aug 8 08:22:15 2011 New Revision: 224704 URL: http://svn.freebsd.org/changeset/base/224704 Log: MFC r224581: Fix the LK_NOSHARE lockmgr flag interaction with LK_UPGRADE and LK_DOWNGRADE lock ops. Namely, the ops should be NOP since LK_NOSHARE locks are always exclusive. Modified: stable/8/sys/kern/kern_lock.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/kern_lock.c ============================================================================== --- stable/8/sys/kern/kern_lock.c Mon Aug 8 05:25:51 2011 (r224703) +++ stable/8/sys/kern/kern_lock.c Mon Aug 8 08:22:15 2011 (r224704) @@ -451,8 +451,18 @@ __lockmgr_args(struct lock *lk, u_int fl return (0); } - if (op == LK_SHARED && (lk->lock_object.lo_flags & LK_NOSHARE)) - op = LK_EXCLUSIVE; + if (lk->lock_object.lo_flags & LK_NOSHARE) { + switch (op) { + case LK_SHARED: + op = LK_EXCLUSIVE; + break; + case LK_UPGRADE: + case LK_DOWNGRADE: + _lockmgr_assert(lk, KA_XLOCKED | KA_NOTRECURSED, + file, line); + return (0); + } + } wakeup_swapper = 0; switch (op) { From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 8 12:16:42 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86C80106564A; Mon, 8 Aug 2011 12:16:42 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 757D98FC13; Mon, 8 Aug 2011 12:16:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p78CGgDi046871; Mon, 8 Aug 2011 12:16:42 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p78CGgNu046869; Mon, 8 Aug 2011 12:16:42 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201108081216.p78CGgNu046869@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 8 Aug 2011 12:16:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224706 - stable/8/sys/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 12:16:42 -0000 Author: pluknet Date: Mon Aug 8 12:16:42 2011 New Revision: 224706 URL: http://svn.freebsd.org/changeset/base/224706 Log: MFC r224571: Add missing MODULE_VERSION() definition. PR: kern/159345 Modified: stable/8/sys/net/if_lagg.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/net/if_lagg.c ============================================================================== --- stable/8/sys/net/if_lagg.c Mon Aug 8 11:33:07 2011 (r224705) +++ stable/8/sys/net/if_lagg.c Mon Aug 8 12:16:42 2011 (r224706) @@ -204,6 +204,7 @@ static moduledata_t lagg_mod = { }; DECLARE_MODULE(if_lagg, lagg_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); +MODULE_VERSION(if_lagg, 1); #if __FreeBSD_version >= 800000 /* From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 8 13:56:28 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23D361065673; Mon, 8 Aug 2011 13:56:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 126878FC18; Mon, 8 Aug 2011 13:56:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p78DuR0A050012; Mon, 8 Aug 2011 13:56:27 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p78DuRLW050010; Mon, 8 Aug 2011 13:56:27 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201108081356.p78DuRLW050010@svn.freebsd.org> From: Ed Maste Date: Mon, 8 Aug 2011 13:56:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224710 - stable/8/share/man/man3 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 13:56:28 -0000 Author: emaste Date: Mon Aug 8 13:56:27 2011 New Revision: 224710 URL: http://svn.freebsd.org/changeset/base/224710 Log: MFC r224047: Remove note that claims pthread_set_name_np is for debugging only. As Garrett points out, It is no more a debugging interface than setproctitle(3), and has not been since the name started getting stuffed into the kernel. This statement may have made sense when the name was only visible in thread state dumps and the debugger. PR: threads/158815 Modified: stable/8/share/man/man3/pthread_set_name_np.3 Directory Properties: stable/8/share/man/man3/ (props changed) Modified: stable/8/share/man/man3/pthread_set_name_np.3 ============================================================================== --- stable/8/share/man/man3/pthread_set_name_np.3 Mon Aug 8 13:15:39 2011 (r224709) +++ stable/8/share/man/man3/pthread_set_name_np.3 Mon Aug 8 13:56:27 2011 (r224710) @@ -44,9 +44,6 @@ function sets internal name for thread s argument to string value specified by .Fa name argument. -.Pp -This is a debugging interface and using it on a day-by-day basis makes -no sense. .Sh ERRORS Because of the debugging nature of this function, all errors that may appear inside are silently ignored. From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 9 07:35:57 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B82B106564A; Tue, 9 Aug 2011 07:35:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3088C8FC19; Tue, 9 Aug 2011 07:35:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p797ZvjL082242; Tue, 9 Aug 2011 07:35:57 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p797ZvVk082239; Tue, 9 Aug 2011 07:35:57 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108090735.p797ZvVk082239@svn.freebsd.org> From: Alexander Motin Date: Tue, 9 Aug 2011 07:35:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224725 - in stable/8/sys/dev: ahci ata/chipsets X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 07:35:57 -0000 Author: mav Date: Tue Aug 9 07:35:56 2011 New Revision: 224725 URL: http://svn.freebsd.org/changeset/base/224725 Log: MFC r224603: Do not force AHCI mode on NVIDIA MCP89 SATA controllers. Recent Apple Mac with this chipset does not initialize AHCI mode unless it is started from EFI loader. However, legacy ATA mode works. Modified: stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ata/chipsets/ata-nvidia.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Tue Aug 9 04:24:56 2011 (r224724) +++ stable/8/sys/dev/ahci/ahci.c Tue Aug 9 07:35:56 2011 (r224725) @@ -264,7 +264,7 @@ static struct { {0x0abe10de, 0x00, "NVIDIA MCP79", AHCI_Q_NOAA}, {0x0abf10de, 0x00, "NVIDIA MCP79", AHCI_Q_NOAA}, {0x0d8410de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, - {0x0d8510de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, + {0x0d8510de, 0x00, "NVIDIA MCP89", AHCI_Q_NOFORCE|AHCI_Q_NOAA}, {0x0d8610de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, {0x0d8710de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, {0x0d8810de, 0x00, "NVIDIA MCP89", AHCI_Q_NOAA}, Modified: stable/8/sys/dev/ata/chipsets/ata-nvidia.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-nvidia.c Tue Aug 9 04:24:56 2011 (r224724) +++ stable/8/sys/dev/ata/chipsets/ata-nvidia.c Tue Aug 9 07:35:56 2011 (r224725) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); /* local prototypes */ static int ata_nvidia_chipinit(device_t dev); static int ata_nvidia_ch_attach(device_t dev); +static int ata_nvidia_ch_attach_dumb(device_t dev); static int ata_nvidia_status(device_t dev); static void ata_nvidia_reset(device_t dev); static int ata_nvidia_setmode(device_t dev, int target, int mode); @@ -62,6 +63,7 @@ static int ata_nvidia_setmode(device_t d #define NV4 0x01 #define NVQ 0x02 #define NVAHCI 0x04 +#define NVNOFORCE 0x08 /* @@ -158,7 +160,7 @@ ata_nvidia_probe(device_t dev) { ATA_NFORCE_MCP79_AA, 0, NVAHCI, 0, ATA_SA300, "nForce MCP79" }, { ATA_NFORCE_MCP79_AB, 0, NVAHCI, 0, ATA_SA300, "nForce MCP79" }, { ATA_NFORCE_MCP89_A0, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, - { ATA_NFORCE_MCP89_A1, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, + { ATA_NFORCE_MCP89_A1, 0, NVAHCI|NVNOFORCE, 0, ATA_SA300, "nForce MCP89" }, { ATA_NFORCE_MCP89_A2, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, { ATA_NFORCE_MCP89_A3, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, { ATA_NFORCE_MCP89_A4, 0, NVAHCI, 0, ATA_SA300, "nForce MCP89" }, @@ -178,7 +180,9 @@ ata_nvidia_probe(device_t dev) return ENXIO; ata_set_desc(dev); - if (ctlr->chip->cfg1 & NVAHCI) + if ((ctlr->chip->cfg1 & NVAHCI) && + ((ctlr->chip->cfg1 & NVNOFORCE) == 0 || + pci_get_subclass(dev) != PCIS_STORAGE_IDE)) ctlr->chipinit = ata_ahci_chipinit; else ctlr->chipinit = ata_nvidia_chipinit; @@ -193,7 +197,10 @@ ata_nvidia_chipinit(device_t dev) if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; - if (ctlr->chip->max_dma >= ATA_SA150) { + if (ctlr->chip->cfg1 & NVAHCI) { + ctlr->ch_attach = ata_nvidia_ch_attach_dumb; + ctlr->setmode = ata_sata_setmode; + } else if (ctlr->chip->max_dma >= ATA_SA150) { if (pci_read_config(dev, PCIR_BAR(5), 1) & 1) ctlr->r_type2 = SYS_RES_IOPORT; else @@ -264,6 +271,17 @@ ata_nvidia_ch_attach(device_t dev) return 0; } +static int +ata_nvidia_ch_attach_dumb(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (ata_pci_ch_attach(dev)) + return ENXIO; + ch->flags |= ATA_SATA; + return 0; +} + static int ata_nvidia_status(device_t dev) { From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 9 08:09:32 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 657EA1065673; Tue, 9 Aug 2011 08:09:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 539088FC0A; Tue, 9 Aug 2011 08:09:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7989WpN083347; Tue, 9 Aug 2011 08:09:32 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7989WtV083345; Tue, 9 Aug 2011 08:09:32 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201108090809.p7989WtV083345@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 9 Aug 2011 08:09:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224727 - stable/8/sys/i386/ibcs2 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 08:09:32 -0000 Author: kib Date: Tue Aug 9 08:09:32 2011 New Revision: 224727 URL: http://svn.freebsd.org/changeset/base/224727 Log: MFC r224613: Corrections for the iBCS2 support. Modified: stable/8/sys/i386/ibcs2/imgact_coff.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/i386/ibcs2/imgact_coff.c ============================================================================== --- stable/8/sys/i386/ibcs2/imgact_coff.c Tue Aug 9 07:42:19 2011 (r224726) +++ stable/8/sys/i386/ibcs2/imgact_coff.c Tue Aug 9 08:09:32 2011 (r224727) @@ -91,9 +91,10 @@ load_coff_section(struct vmspace *vmspac map_len = round_page(offset + filsz) - trunc_page(map_offset); } - DPRINTF(("%s(%d): vm_mmap(&vmspace->vm_map, &0x%08lx, 0x%x, 0x%x, " + DPRINTF(("%s(%d): vm_mmap(&vmspace->vm_map, &0x%08jx, 0x%x, 0x%x, " "VM_PROT_ALL, MAP_PRIVATE | MAP_FIXED, OBJT_VNODE, vp, 0x%x)\n", - __FILE__, __LINE__, map_addr, map_len, prot, map_offset)); + __FILE__, __LINE__, (uintmax_t)map_addr, map_len, prot, + map_offset)); if ((error = vm_mmap(&vmspace->vm_map, &map_addr, @@ -123,16 +124,16 @@ load_coff_section(struct vmspace *vmspac map_addr = trunc_page((vm_offset_t)vmaddr + filsz); map_len = round_page((vm_offset_t)vmaddr + memsz) - map_addr; - DPRINTF(("%s(%d): vm_map_find(&vmspace->vm_map, NULL, 0, &0x%08lx,0x%x, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0)\n", __FILE__, __LINE__, map_addr, map_len)); + DPRINTF(("%s(%d): vm_map_find(&vmspace->vm_map, NULL, 0, &0x%08jx,0x%x, VMFS_NO_SPACE, VM_PROT_ALL, VM_PROT_ALL, 0)\n", __FILE__, __LINE__, (uintmax_t)map_addr, map_len)); if (map_len != 0) { error = vm_map_find(&vmspace->vm_map, NULL, 0, &map_addr, - map_len, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0); + map_len, VMFS_NO_SPACE, VM_PROT_ALL, VM_PROT_ALL, 0); if (error) - return error; + return (vm_mmap_to_errno(error)); } - if ((error = vm_mmap(kernel_map, + if ((error = vm_mmap(exec_map, (vm_offset_t *) &data_buf, PAGE_SIZE, VM_PROT_READ, @@ -145,7 +146,7 @@ load_coff_section(struct vmspace *vmspac error = copyout(data_buf, (caddr_t) map_addr, copy_len); - if (vm_map_remove(kernel_map, + if (vm_map_remove(exec_map, (vm_offset_t) data_buf, (vm_offset_t) data_buf + PAGE_SIZE)) panic("load_coff_section vm_map_remove failed"); @@ -213,7 +214,7 @@ coff_load_file(struct thread *td, char * */ VOP_UNLOCK(vp, 0); - if ((error = vm_mmap(kernel_map, + if ((error = vm_mmap(exec_map, (vm_offset_t *) &ptr, PAGE_SIZE, VM_PROT_READ, @@ -279,7 +280,7 @@ coff_load_file(struct thread *td, char * error = 0; dealloc_and_fail: - if (vm_map_remove(kernel_map, + if (vm_map_remove(exec_map, (vm_offset_t) ptr, (vm_offset_t) ptr + PAGE_SIZE)) panic("%s vm_map_remove failed", __func__); @@ -306,7 +307,7 @@ exec_coff_imgact(imgp) unsigned long text_offset = 0, text_address = 0, text_size = 0; unsigned long data_offset = 0, data_address = 0, data_size = 0; unsigned long bss_size = 0; - caddr_t hole; + vm_offset_t hole; if (fhdr->f_magic != I386_COFF || !(fhdr->f_flags & F_EXEC)) { @@ -343,9 +344,9 @@ exec_coff_imgact(imgp) for (i = 0; i < nscns; i++) { - DPRINTF(("i = %d, scns[i].s_name = %s, scns[i].s_vaddr = %08lx, " - "scns[i].s_scnptr = %d\n", i, scns[i].s_name, - scns[i].s_vaddr, scns[i].s_scnptr)); + DPRINTF(("i = %d, s_name = %s, s_vaddr = %08lx, " + "s_scnptr = %ld s_size = %lx\n", i, scns[i].s_name, + scns[i].s_vaddr, scns[i].s_scnptr, scns[i].s_size)); if (scns[i].s_flags & STYP_NOLOAD) { /* * A section that is not loaded, for whatever @@ -372,12 +373,12 @@ exec_coff_imgact(imgp) int len = round_page(scns[i].s_size + PAGE_SIZE); int j; - if ((error = vm_mmap(kernel_map, + if ((error = vm_mmap(exec_map, (vm_offset_t *) &buf, len, VM_PROT_READ, VM_PROT_READ, - 0, + MAP_SHARED, OBJT_VNODE, imgp->vp, foff)) != 0) { @@ -411,12 +412,16 @@ exec_coff_imgact(imgp) error = coff_load_file( FIRST_THREAD_IN_PROC(imgp->proc), libname); - if (error) + if (error) { + printf( + "error %d loading coff shared library %s\n", + error, libname); break; + } } free(libbuf, M_TEMP); } - if (vm_map_remove(kernel_map, + if (vm_map_remove(exec_map, (vm_offset_t) buf, (vm_offset_t) buf + len)) panic("exec_coff_imgact vm_map_remove failed"); @@ -429,7 +434,7 @@ exec_coff_imgact(imgp) */ DPRINTF(("%s(%d): load_coff_section(vmspace, " - "imgp->vp, %08lx, %08lx, 0x%x, 0x%x, 0x%x)\n", + "imgp->vp, %08lx, %08lx, 0x%lx, 0x%lx, 0x%x)\n", __FILE__, __LINE__, text_offset, text_address, text_size, text_size, VM_PROT_READ | VM_PROT_EXECUTE)); if ((error = load_coff_section(vmspace, imgp->vp, @@ -446,7 +451,7 @@ exec_coff_imgact(imgp) DPRINTF(("%s(%d): load_coff_section(vmspace, " - "imgp->vp, 0x%08lx, 0x%08lx, 0x%x, 0x%x, 0x%x)\n", + "imgp->vp, 0x%08lx, 0x%08lx, 0x%lx, 0x%lx, 0x%x)\n", __FILE__, __LINE__, data_offset, data_address, data_size + bss_size, data_size, VM_PROT_ALL)); if ((error = load_coff_section(vmspace, imgp->vp, @@ -467,26 +472,25 @@ exec_coff_imgact(imgp) vmspace->vm_taddr = (caddr_t)(void *)(uintptr_t)text_address; vmspace->vm_daddr = (caddr_t)(void *)(uintptr_t)data_address; - hole = (caddr_t)trunc_page((vm_offset_t)vmspace->vm_daddr) + ctob(vmspace->vm_dsize); - + hole = trunc_page((vm_offset_t)vmspace->vm_daddr + + ctob(vmspace->vm_dsize)); - DPRINTF(("%s(%d): vm_map_find(&vmspace->vm_map, NULL, 0, &0x%08lx, PAGE_SIZE, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0)\n", - __FILE__, __LINE__, hole)); + DPRINTF(("%s(%d): vm_map_find(&vmspace->vm_map, NULL, 0, &0x%jx, PAGE_SIZE, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0)\n", + __FILE__, __LINE__, (uintmax_t)hole)); DPRINTF(("imgact: error = %d\n", error)); - error = vm_map_find(&vmspace->vm_map, NULL, 0, - (vm_offset_t *) &hole, PAGE_SIZE, FALSE, - VM_PROT_ALL, VM_PROT_ALL, 0); - - DPRINTF(("IBCS2: start vm_dsize = 0x%x, vm_daddr = 0x%x end = 0x%x\n", + vm_map_find(&vmspace->vm_map, NULL, 0, + (vm_offset_t *)&hole, PAGE_SIZE, VMFS_NO_SPACE, + VM_PROT_ALL, VM_PROT_ALL, 0); + DPRINTF(("IBCS2: start vm_dsize = 0x%x, vm_daddr = 0x%p end = 0x%p\n", ctob(vmspace->vm_dsize), vmspace->vm_daddr, ctob(vmspace->vm_dsize) + vmspace->vm_daddr )); - DPRINTF(("%s(%d): returning successfully!\n", __FILE__, __LINE__)); + DPRINTF(("%s(%d): returning %d!\n", __FILE__, __LINE__, error)); fail: vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); - return error; + return (error); } /* From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 9 19:59:23 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00C44106566B; Tue, 9 Aug 2011 19:59:23 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E48118FC14; Tue, 9 Aug 2011 19:59:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p79JxMuh009504; Tue, 9 Aug 2011 19:59:22 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p79JxMqJ009502; Tue, 9 Aug 2011 19:59:22 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201108091959.p79JxMqJ009502@svn.freebsd.org> From: Doug Barton Date: Tue, 9 Aug 2011 19:59:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224737 - stable/8/usr.sbin/service X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 19:59:23 -0000 Author: dougb Date: Tue Aug 9 19:59:22 2011 New Revision: 224737 URL: http://svn.freebsd.org/changeset/base/224737 Log: MFC r224672: Fix a silly typo on my part. Modified: stable/8/usr.sbin/service/service.8 Directory Properties: stable/8/usr.sbin/service/ (props changed) Modified: stable/8/usr.sbin/service/service.8 ============================================================================== --- stable/8/usr.sbin/service/service.8 Tue Aug 9 16:42:31 2011 (r224736) +++ stable/8/usr.sbin/service/service.8 Tue Aug 9 19:59:22 2011 (r224737) @@ -123,7 +123,7 @@ for the names of the rc.d scripts: .Sh HISTORY The .Nm -manual page service first appeared in +utility first appeared in .Fx 7.3 . .Sh AUTHORS This From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 9 20:38:22 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29C86106564A; Tue, 9 Aug 2011 20:38:22 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE1028FC14; Tue, 9 Aug 2011 20:38:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p79KcLKI010940; Tue, 9 Aug 2011 20:38:21 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p79KcLEx010938; Tue, 9 Aug 2011 20:38:21 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201108092038.p79KcLEx010938@svn.freebsd.org> From: Doug Barton Date: Tue, 9 Aug 2011 20:38:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224740 - stable/8/sbin/rcorder X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 20:38:22 -0000 Author: dougb Date: Tue Aug 9 20:38:21 2011 New Revision: 224740 URL: http://svn.freebsd.org/changeset/base/224740 Log: MFC r208027: mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to the bottom of the manpages and order them consistently. Modified: stable/8/sbin/rcorder/rcorder.8 Directory Properties: stable/8/sbin/rcorder/ (props changed) Modified: stable/8/sbin/rcorder/rcorder.8 ============================================================================== --- stable/8/sbin/rcorder/rcorder.8 Tue Aug 9 20:07:16 2011 (r224739) +++ stable/8/sbin/rcorder/rcorder.8 Tue Aug 9 20:38:21 2011 (r224740) @@ -152,6 +152,19 @@ processing the stated condition. A set of files has a circular dependency which was detected while processing the stated file. .El +.Sh SEE ALSO +.Xr rc 8 +.Sh HISTORY +The +.Nm +utility first appeared in +.Nx 1.5 . +.Sh AUTHORS +.An -nosplit +Written by +.An Perry E. Metzger Aq perry@piermont.com +and +.An Matthew R. Green Aq mrg@eterna.com.au . .Sh BUGS The .Dq Li REQUIRE @@ -171,16 +184,3 @@ script in the dependency ordering, not necessarily that it requires .Xr named 8 to be started or enabled. -.Sh SEE ALSO -.Xr rc 8 -.Sh HISTORY -The -.Nm -utility first appeared in -.Nx 1.5 . -.Sh AUTHORS -.An -nosplit -Written by -.An Perry E. Metzger Aq perry@piermont.com -and -.An Matthew R. Green Aq mrg@eterna.com.au . From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 9 20:41:44 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 285FD106567A; Tue, 9 Aug 2011 20:41:44 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1814F8FC12; Tue, 9 Aug 2011 20:41:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p79KfhJa011088; Tue, 9 Aug 2011 20:41:43 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p79KfhAE011086; Tue, 9 Aug 2011 20:41:43 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201108092041.p79KfhAE011086@svn.freebsd.org> From: Doug Barton Date: Tue, 9 Aug 2011 20:41:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224741 - stable/8/sbin/rcorder X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2011 20:41:44 -0000 Author: dougb Date: Tue Aug 9 20:41:43 2011 New Revision: 224741 URL: http://svn.freebsd.org/changeset/base/224741 Log: MFC r224673: Put information about supported-but-deprecated headers in comments Modified: stable/8/sbin/rcorder/rcorder.8 Directory Properties: stable/8/sbin/rcorder/ (props changed) Modified: stable/8/sbin/rcorder/rcorder.8 ============================================================================== --- stable/8/sbin/rcorder/rcorder.8 Tue Aug 9 20:38:21 2011 (r224740) +++ stable/8/sbin/rcorder/rcorder.8 Tue Aug 9 20:41:43 2011 (r224741) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 9, 2008 +.Dd August 5, 2011 .Dt RCORDER 8 .Os .Sh NAME @@ -89,6 +89,9 @@ and lines may appear, but all such lines must appear in a sequence without any intervening lines, as once a line that does not follow the format is reached, parsing stops. +.\" Note that for historical reasons REQUIRES, PROVIDES, and KEYWORDS +.\" are also accepted in addition to the above, but not documented so +.\" that they can be deprecated at some point in the future. .Pp The options are as follows: .Bl -tag -width indent From owner-svn-src-stable-8@FreeBSD.ORG Wed Aug 10 08:21:39 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F53D1065675; Wed, 10 Aug 2011 08:21:39 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6ECC78FC17; Wed, 10 Aug 2011 08:21:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7A8LdQH032071; Wed, 10 Aug 2011 08:21:39 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7A8LdJo032069; Wed, 10 Aug 2011 08:21:39 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201108100821.p7A8LdJo032069@svn.freebsd.org> From: Martin Matuska Date: Wed, 10 Aug 2011 08:21:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224748 - in stable/8/usr.sbin/makefs: . ffs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 08:21:39 -0000 Author: mm Date: Wed Aug 10 08:21:39 2011 New Revision: 224748 URL: http://svn.freebsd.org/changeset/base/224748 Log: MFC r224690: Fix NetBSD PR bin/44114: makefs with -t cd9660 -o rockridge against directories with deep structure creates a corrupted cd9660 image. http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=44114 Fix NetBSD PR bin/45217: makefs creates ISO9660 images that violate the ECMA-119 (ISO9660) specification. This is caused by erroneously writing 32 bytes with value 0x20 to the volume_set_id field and 128 bytes with value 0x20 to the the following 37-byte fields in the PVD: copyright_file_id, abstract_file_id, bibliographic_file_id This causes, among other unwanted results the reserved4 field to be overwritten with the value 0x20. To comply with the specification, this field muse be zero. As a result, all FreeBSD distribution ISO images created with makefs have not been 100% valid ISO9660 files. http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=45217 Reviewed by: kientzle Obtained from: NetBSD Modified: stable/8/usr.sbin/makefs/cd9660.c Directory Properties: stable/8/usr.sbin/makefs/ (props changed) stable/8/usr.sbin/makefs/ffs/ffs_bswap.c (props changed) stable/8/usr.sbin/makefs/ffs/ffs_subr.c (props changed) stable/8/usr.sbin/makefs/ffs/ufs_bswap.h (props changed) stable/8/usr.sbin/makefs/getid.c (props changed) Modified: stable/8/usr.sbin/makefs/cd9660.c ============================================================================== --- stable/8/usr.sbin/makefs/cd9660.c Wed Aug 10 06:17:06 2011 (r224747) +++ stable/8/usr.sbin/makefs/cd9660.c Wed Aug 10 08:21:39 2011 (r224748) @@ -223,13 +223,12 @@ cd9660_set_defaults(void) /* Make sure the PVD is clear */ memset(&diskStructure.primaryDescriptor, 0, 2048); - memset(diskStructure.primaryDescriptor.volume_set_id, 0x20,32); memset(diskStructure.primaryDescriptor.publisher_id, 0x20,128); memset(diskStructure.primaryDescriptor.preparer_id, 0x20,128); memset(diskStructure.primaryDescriptor.application_id, 0x20,128); - memset(diskStructure.primaryDescriptor.copyright_file_id, 0x20,128); - memset(diskStructure.primaryDescriptor.abstract_file_id, 0x20,128); - memset(diskStructure.primaryDescriptor.bibliographic_file_id, 0x20,128); + memset(diskStructure.primaryDescriptor.copyright_file_id, 0x20,37); + memset(diskStructure.primaryDescriptor.abstract_file_id, 0x20,37); + memset(diskStructure.primaryDescriptor.bibliographic_file_id, 0x20,37); strcpy(diskStructure.primaryDescriptor.system_id,"NetBSD"); @@ -669,11 +668,11 @@ cd9660_finalize_PVD(void) cd9660_pad_string_spaces(diskStructure.primaryDescriptor.application_id, 128); cd9660_pad_string_spaces( - diskStructure.primaryDescriptor.copyright_file_id, 128); + diskStructure.primaryDescriptor.copyright_file_id, 37); cd9660_pad_string_spaces( - diskStructure.primaryDescriptor.abstract_file_id, 128); + diskStructure.primaryDescriptor.abstract_file_id, 37); cd9660_pad_string_spaces( - diskStructure.primaryDescriptor.bibliographic_file_id, 128); + diskStructure.primaryDescriptor.bibliographic_file_id, 37); /* Setup dates */ time(&tim); @@ -1307,6 +1306,8 @@ cd9660_rrip_move_directory(cd9660node *d /* Set the new name */ memset(dir->isoDirRecord->name, 0, ISO_FILENAME_MAXLENGTH_WITH_PADDING); strncpy(dir->isoDirRecord->name, newname, 8); + dir->isoDirRecord->length[0] = 34 + 8; + dir->isoDirRecord->name_len[0] = 8; return dir; } From owner-svn-src-stable-8@FreeBSD.ORG Wed Aug 10 08:33:46 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45A73106566C; Wed, 10 Aug 2011 08:33:46 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C5638FC15; Wed, 10 Aug 2011 08:33:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7A8XkCN032499; Wed, 10 Aug 2011 08:33:46 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7A8XjSu032498; Wed, 10 Aug 2011 08:33:45 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201108100833.p7A8XjSu032498@svn.freebsd.org> From: Martin Matuska Date: Wed, 10 Aug 2011 08:33:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224750 - in stable/8/usr.sbin/makefs: . ffs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 08:33:46 -0000 Author: mm Date: Wed Aug 10 08:33:45 2011 New Revision: 224750 URL: http://svn.freebsd.org/changeset/base/224750 Log: Remove svn:mergeinfo from files under usr.sbin/makefs This is a direct commit to stable/8 Modified: Directory Properties: stable/8/usr.sbin/makefs/ffs/ffs_bswap.c (props changed) stable/8/usr.sbin/makefs/ffs/ffs_subr.c (props changed) stable/8/usr.sbin/makefs/ffs/ufs_bswap.h (props changed) stable/8/usr.sbin/makefs/getid.c (props changed) From owner-svn-src-stable-8@FreeBSD.ORG Wed Aug 10 08:40:59 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75C2A1065676; Wed, 10 Aug 2011 08:40:59 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6426C8FC1C; Wed, 10 Aug 2011 08:40:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7A8exYU032805; Wed, 10 Aug 2011 08:40:59 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7A8exid032790; Wed, 10 Aug 2011 08:40:59 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201108100840.p7A8exid032790@svn.freebsd.org> From: Martin Matuska Date: Wed, 10 Aug 2011 08:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224752 - in stable/8/lib/libarchive: . test X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 08:40:59 -0000 Author: mm Date: Wed Aug 10 08:40:59 2011 New Revision: 224752 URL: http://svn.freebsd.org/changeset/base/224752 Log: MFC r224691, r224700 [1]: MFC r224961: Add compatibility for ISO images created with unfixed makefs that violated ECMA-119 (ISO9660): allow reserved4 to be 0x20 in PVD. This allows tar to read FreeBSD distribution ISO images created with makefs prior to NetBSD bin/45217 bugfix (up to 9.0-BETA1). In addition, merge following important bugfixes from libarchive's release/2.8 branch: Revision 2812: Merge 2811 from trunk: Don't try to verify that compression-level=0 produces larger results than the default compression, since this isn't true for all versions of liblzma. Revision 2817: Merge 2814 from trunk: Fix Issue 121 (mtree parser error) http://code.google.com/p/libarchive/issues/detail?id=121 Revision 2820: Fix issue 119. Change the file location check that a file location does not exceed volume block. New one is that a file content does not exceed volume block(end of an ISO image). It is better than previous check even if the issue did not happen. While reading an ISO image generated by an older version of mkisofs utility, a file location indicates the end the ISO image if its file size is zero and it is the last file of all files of the ISO image, so it is possible that the location value is the same as the number of the total block of the ISO image. http://code.google.com/p/libarchive/issues/detail?id=119 Revision 2955: Issue 134: Fix libarchive 2.8 crashing in archive_write_finish() when the open has failed and we're trying to write Zip format. http://code.google.com/p/libarchive/issues/detail?id=134 Revision 2958: Followup on Issue 134: 1) Port test_open_failure to libarchive 2.8 branch to test the problem reported in Issue 134. This test also shows that archive_read_open() sometimes fails to report open errors correctly. 2) Fix the bug in archive_read.c 3) Comment out the tests that close functions are invoked promptly when open fails; that's fully fixed in libarchive 3.0, but I don't think it's worth fixing here. Revision 3484: Use uintmax_t with %ju Revision 3487: Fix issue 163. Correctly allocate enough memory for a input buffer saved. http://code.google.com/p/libarchive/issues/detail?id=163 Revision 3542: Merge 2516, 2536 from trunk: Allow path table offset values of 0 and 18, which are used by some ISO writers. MFC r224700 [1]: Merge revision 3554 from libarchive's release/2.8 branch: Partial merge of 2431 from trunk: Retry writes on EINTR. This should fix the SIGINT handler in bsdtar. Note: The rest of r2431 can't be merged, since it interacts with a big write-side rearchitecture. PR: bin/149409 [1] Reviewed by: kientzle Added: stable/8/lib/libarchive/test/test_open_failure.c - copied unchanged from r224691, head/lib/libarchive/test/test_open_failure.c Modified: stable/8/lib/libarchive/archive_read.c stable/8/lib/libarchive/archive_read_support_compression_uu.c stable/8/lib/libarchive/archive_read_support_format_iso9660.c stable/8/lib/libarchive/archive_read_support_format_mtree.c stable/8/lib/libarchive/archive_write_open_fd.c stable/8/lib/libarchive/archive_write_open_file.c stable/8/lib/libarchive/archive_write_open_filename.c stable/8/lib/libarchive/archive_write_set_compression_xz.c stable/8/lib/libarchive/archive_write_set_format_zip.c stable/8/lib/libarchive/test/Makefile stable/8/lib/libarchive/test/test_read_format_mtree.c stable/8/lib/libarchive/test/test_write_compress_lzma.c stable/8/lib/libarchive/test/test_write_compress_xz.c Directory Properties: stable/8/lib/libarchive/ (props changed) Modified: stable/8/lib/libarchive/archive_read.c ============================================================================== --- stable/8/lib/libarchive/archive_read.c Wed Aug 10 08:34:00 2011 (r224751) +++ stable/8/lib/libarchive/archive_read.c Wed Aug 10 08:40:59 2011 (r224752) @@ -377,6 +377,12 @@ build_stream(struct archive_read *a) /* If no bidder, we're done. */ if (best_bidder == NULL) { + /* Verify the final pipelin by asking it for some data. */ + __archive_read_filter_ahead(a->filter, 1, &avail); + if (avail < 0) { + cleanup_filters(a); + return (ARCHIVE_FATAL); + } a->archive.compression_name = a->filter->name; a->archive.compression_code = a->filter->code; return (ARCHIVE_OK); @@ -389,17 +395,11 @@ build_stream(struct archive_read *a) filter->bidder = best_bidder; filter->archive = a; filter->upstream = a->filter; - r = (best_bidder->init)(filter); - if (r != ARCHIVE_OK) { - free(filter); - return (r); - } a->filter = filter; - /* Verify the filter by asking it for some data. */ - __archive_read_filter_ahead(filter, 1, &avail); - if (avail < 0) { + r = (best_bidder->init)(a->filter); + if (r != ARCHIVE_OK) { cleanup_filters(a); - return (ARCHIVE_FATAL); + return (r); } } } Modified: stable/8/lib/libarchive/archive_read_support_compression_uu.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_compression_uu.c Wed Aug 10 08:34:00 2011 (r224751) +++ stable/8/lib/libarchive/archive_read_support_compression_uu.c Wed Aug 10 08:40:59 2011 (r224752) @@ -381,7 +381,17 @@ ensure_in_buff_size(struct archive_read_ unsigned char *ptr; size_t newsize; - newsize = uudecode->in_allocated << 1; + /* + * Calculate a new buffer size for in_buff. + * Increase its value until it has enough size we need. + */ + newsize = uudecode->in_allocated; + do { + if (newsize < IN_BUFF_SIZE*32) + newsize <<= 1; + else + newsize += IN_BUFF_SIZE; + } while (size > newsize); ptr = malloc(newsize); if (ptr == NULL || newsize < uudecode->in_allocated) { Modified: stable/8/lib/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_format_iso9660.c Wed Aug 10 08:34:00 2011 (r224751) +++ stable/8/lib/libarchive/archive_read_support_format_iso9660.c Wed Aug 10 08:40:59 2011 (r224752) @@ -709,16 +709,18 @@ isSVD(struct iso9660 *iso9660, const uns /* Location of Occurrence of Type L Path Table must be * available location, - * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ + * >= SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ location = archive_le32dec(h+SVD_type_L_path_table_offset); - if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block) + if (location < SYSTEM_AREA_BLOCK+2 || location >= volume_block) return (0); - /* Location of Occurrence of Type M Path Table must be - * available location, - * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ + /* The Type M Path Table must be at a valid location (WinISO + * and probably other programs omit this, so we allow zero) + * + * >= SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ location = archive_be32dec(h+SVD_type_M_path_table_offset); - if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block) + if ((location > 0 && location < SYSTEM_AREA_BLOCK+2) + || location >= volume_block) return (0); /* Read Root Directory Record in Volume Descriptor. */ @@ -781,16 +783,17 @@ isEVD(struct iso9660 *iso9660, const uns /* Location of Occurrence of Type L Path Table must be * available location, - * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ + * >= SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ location = archive_le32dec(h+PVD_type_1_path_table_offset); - if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block) + if (location < SYSTEM_AREA_BLOCK+2 || location >= volume_block) return (0); /* Location of Occurrence of Type M Path Table must be * available location, - * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ + * >= SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ location = archive_be32dec(h+PVD_type_m_path_table_offset); - if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block) + if ((location > 0 && location < SYSTEM_AREA_BLOCK+2) + || location >= volume_block) return (0); /* Reserved field must be 0. */ @@ -862,19 +865,24 @@ isPVD(struct iso9660 *iso9660, const uns * available location, * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ location = archive_le32dec(h+PVD_type_1_path_table_offset); - if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block) + if (location < SYSTEM_AREA_BLOCK+2 || location >= volume_block) return (0); - /* Location of Occurrence of Type M Path Table must be - * available location, - * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ + /* The Type M Path Table must also be at a valid location + * (although ECMA 119 requires a Type M Path Table, WinISO and + * probably other programs omit it, so we permit a zero here) + * + * >= SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */ location = archive_be32dec(h+PVD_type_m_path_table_offset); - if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block) + if ((location > 0 && location < SYSTEM_AREA_BLOCK+2) + || location >= volume_block) return (0); /* Reserved field must be 0. */ + /* FreeBSD: makefs erroneously created images with 0x20 */ for (i = 0; i < PVD_reserved4_size; ++i) - if (h[PVD_reserved4_offset + i] != 0) + if (h[PVD_reserved4_offset + i] != 0 && + h[PVD_reserved4_offset + i] != 32) return (0); /* Reserved field must be 0. */ @@ -1677,6 +1685,7 @@ parse_file_info(struct archive_read *a, const unsigned char *rr_start, *rr_end; const unsigned char *p; size_t dr_len; + uint64_t fsize; int32_t location; int flags; @@ -1685,6 +1694,7 @@ parse_file_info(struct archive_read *a, dr_len = (size_t)isodirrec[DR_length_offset]; name_len = (size_t)isodirrec[DR_name_len_offset]; location = archive_le32dec(isodirrec + DR_extent_offset); + fsize = toi(isodirrec + DR_size_offset, DR_size_size); /* Sanity check that dr_len needs at least 34. */ if (dr_len < 34) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, @@ -1703,7 +1713,10 @@ parse_file_info(struct archive_read *a, * link or file size is zero. As far as I know latest mkisofs * do that. */ - if (location >= iso9660->volume_block) { + if (location > 0 && + (location + ((fsize + iso9660->logical_block_size -1) + / iso9660->logical_block_size)) > + (unsigned int)iso9660->volume_block) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Invalid location of extent of file"); return (NULL); @@ -1719,7 +1732,7 @@ parse_file_info(struct archive_read *a, memset(file, 0, sizeof(*file)); file->parent = parent; file->offset = iso9660->logical_block_size * (uint64_t)location; - file->size = toi(isodirrec + DR_size_offset, DR_size_size); + file->size = fsize; file->mtime = isodate7(isodirrec + DR_date_offset); file->ctime = file->atime = file->mtime; Modified: stable/8/lib/libarchive/archive_read_support_format_mtree.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_format_mtree.c Wed Aug 10 08:34:00 2011 (r224751) +++ stable/8/lib/libarchive/archive_read_support_format_mtree.c Wed Aug 10 08:40:59 2011 (r224752) @@ -525,6 +525,7 @@ parse_file(struct archive_read *a, struc /* Initialize reasonable defaults. */ mtree->filetype = AE_IFREG; archive_entry_set_size(entry, 0); + archive_string_empty(&mtree->contents_name); /* Parse options from this line. */ parsed_kws = 0; @@ -613,9 +614,8 @@ parse_file(struct archive_read *a, struc } /* - * If there is a contents file on disk, use that size; - * otherwise leave it as-is (it might have been set from - * the mtree size= keyword). + * Check for a mismatch between the type in the specification and + * the type of the contents object on disk. */ if (st != NULL) { mismatched_type = 0; @@ -660,6 +660,11 @@ parse_file(struct archive_read *a, struc } } + /* + * If there is a contents file on disk, pick some of the metadata + * from that file. For most of these, we only set it from the contents + * if it wasn't already parsed from the specification. + */ if (st != NULL) { if ((parsed_kws & MTREE_HAS_DEVICE) == 0 && (archive_entry_filetype(entry) == AE_IFCHR || Modified: stable/8/lib/libarchive/archive_write_open_fd.c ============================================================================== --- stable/8/lib/libarchive/archive_write_open_fd.c Wed Aug 10 08:34:00 2011 (r224751) +++ stable/8/lib/libarchive/archive_write_open_fd.c Wed Aug 10 08:40:59 2011 (r224752) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include "archive.h" struct write_fd_data { - off_t offset; int fd; }; @@ -122,12 +121,16 @@ file_write(struct archive *a, void *clie ssize_t bytesWritten; mine = (struct write_fd_data *)client_data; - bytesWritten = write(mine->fd, buff, length); - if (bytesWritten <= 0) { - archive_set_error(a, errno, "Write error"); - return (-1); + for (;;) { + bytesWritten = write(mine->fd, buff, length); + if (bytesWritten <= 0) { + if (errno == EINTR) + continue; + archive_set_error(a, errno, "Write error"); + return (-1); + } + return (bytesWritten); } - return (bytesWritten); } static int Modified: stable/8/lib/libarchive/archive_write_open_file.c ============================================================================== --- stable/8/lib/libarchive/archive_write_open_file.c Wed Aug 10 08:34:00 2011 (r224751) +++ stable/8/lib/libarchive/archive_write_open_file.c Wed Aug 10 08:40:59 2011 (r224752) @@ -86,12 +86,16 @@ file_write(struct archive *a, void *clie size_t bytesWritten; mine = client_data; - bytesWritten = fwrite(buff, 1, length, mine->f); - if (bytesWritten < length) { - archive_set_error(a, errno, "Write error"); - return (-1); + for (;;) { + bytesWritten = fwrite(buff, 1, length, mine->f); + if (bytesWritten <= 0) { + if (errno == EINTR) + continue; + archive_set_error(a, errno, "Write error"); + return (-1); + } + return (bytesWritten); } - return (bytesWritten); } static int Modified: stable/8/lib/libarchive/archive_write_open_filename.c ============================================================================== --- stable/8/lib/libarchive/archive_write_open_filename.c Wed Aug 10 08:34:00 2011 (r224751) +++ stable/8/lib/libarchive/archive_write_open_filename.c Wed Aug 10 08:40:59 2011 (r224752) @@ -142,12 +142,16 @@ file_write(struct archive *a, void *clie ssize_t bytesWritten; mine = (struct write_file_data *)client_data; - bytesWritten = write(mine->fd, buff, length); - if (bytesWritten <= 0) { - archive_set_error(a, errno, "Write error"); - return (-1); + for (;;) { + bytesWritten = write(mine->fd, buff, length); + if (bytesWritten <= 0) { + if (errno == EINTR) + continue; + archive_set_error(a, errno, "Write error"); + return (-1); + } + return (bytesWritten); } - return (bytesWritten); } static int Modified: stable/8/lib/libarchive/archive_write_set_compression_xz.c ============================================================================== --- stable/8/lib/libarchive/archive_write_set_compression_xz.c Wed Aug 10 08:34:00 2011 (r224751) +++ stable/8/lib/libarchive/archive_write_set_compression_xz.c Wed Aug 10 08:40:59 2011 (r224752) @@ -421,8 +421,8 @@ drive_compressor(struct archive_write *a archive_set_error(&a->archive, ENOMEM, "lzma compression error: " "%ju MiB would have been needed", - (lzma_memusage(&(state->stream)) + 1024 * 1024 -1) - / (1024 * 1024)); + (uintmax_t)((lzma_memusage(&(state->stream)) + 1024 * 1024 -1) + / (1024 * 1024))); return (ARCHIVE_FATAL); default: /* Any other return value indicates an error. */ Modified: stable/8/lib/libarchive/archive_write_set_format_zip.c ============================================================================== --- stable/8/lib/libarchive/archive_write_set_format_zip.c Wed Aug 10 08:34:00 2011 (r224751) +++ stable/8/lib/libarchive/archive_write_set_format_zip.c Wed Aug 10 08:40:59 2011 (r224752) @@ -502,6 +502,9 @@ archive_write_zip_finish(struct archive_ int entries; int ret; + if (a->compressor.write == NULL) + return (ARCHIVE_OK); + zip = a->format_data; l = zip->central_directory; Modified: stable/8/lib/libarchive/test/Makefile ============================================================================== --- stable/8/lib/libarchive/test/Makefile Wed Aug 10 08:34:00 2011 (r224751) +++ stable/8/lib/libarchive/test/Makefile Wed Aug 10 08:40:59 2011 (r224752) @@ -25,6 +25,7 @@ TESTS= \ test_fuzz.c \ test_link_resolver.c \ test_open_fd.c \ + test_open_failure.c \ test_open_file.c \ test_open_filename.c \ test_pax_filename_encoding.c \ Copied: stable/8/lib/libarchive/test/test_open_failure.c (from r224691, head/lib/libarchive/test/test_open_failure.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libarchive/test/test_open_failure.c Wed Aug 10 08:40:59 2011 (r224752, copy of r224691, head/lib/libarchive/test/test_open_failure.c) @@ -0,0 +1,198 @@ +/*- + * Copyright (c) 2003-2010 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +#define MAGIC 123456789 +struct my_data { + int magic; + int read_return; + int read_called; + int write_return; + int write_called; + int open_return; + int open_called; + int close_return; + int close_called; +}; + +static ssize_t +my_read(struct archive *a, void *_private, const void **buff) +{ + struct my_data *private = (struct my_data *)_private; + assertEqualInt(MAGIC, private->magic); + ++private->read_called; + return (private->read_return); +} + +static ssize_t +my_write(struct archive *a, void *_private, const void *buff, size_t s) +{ + struct my_data *private = (struct my_data *)_private; + assertEqualInt(MAGIC, private->magic); + ++private->write_called; + return (private->write_return); +} + +static int +my_open(struct archive *a, void *_private) +{ + struct my_data *private = (struct my_data *)_private; + assertEqualInt(MAGIC, private->magic); + ++private->open_called; + return (private->open_return); +} + +static int +my_close(struct archive *a, void *_private) +{ + struct my_data *private = (struct my_data *)_private; + assertEqualInt(MAGIC, private->magic); + ++private->close_called; + return (private->close_return); +} + + +DEFINE_TEST(test_open_failure) +{ + struct archive *a; + struct my_data private; + + memset(&private, 0, sizeof(private)); + private.magic = MAGIC; + private.open_return = ARCHIVE_FATAL; + a = archive_read_new(); + assert(a != NULL); + assertEqualInt(ARCHIVE_FATAL, + archive_read_open(a, &private, my_open, my_read, my_close)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.read_called); + assertEqualInt(1, private.close_called); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.read_called); + assertEqualInt(1, private.close_called); + + memset(&private, 0, sizeof(private)); + private.magic = MAGIC; + private.open_return = ARCHIVE_FAILED; + a = archive_read_new(); + assert(a != NULL); + assertEqualInt(ARCHIVE_FAILED, + archive_read_open(a, &private, my_open, my_read, my_close)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.read_called); + assertEqualInt(1, private.close_called); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.read_called); + assertEqualInt(1, private.close_called); + + memset(&private, 0, sizeof(private)); + private.magic = MAGIC; + private.open_return = ARCHIVE_WARN; + a = archive_read_new(); + assert(a != NULL); + assertEqualInt(ARCHIVE_WARN, + archive_read_open(a, &private, my_open, my_read, my_close)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.read_called); + assertEqualInt(1, private.close_called); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.read_called); + assertEqualInt(1, private.close_called); + + memset(&private, 0, sizeof(private)); + private.magic = MAGIC; + private.open_return = ARCHIVE_OK; + private.read_return = ARCHIVE_FATAL; + a = archive_read_new(); + assert(a != NULL); + assertEqualInt(ARCHIVE_OK, + archive_read_support_compression_compress(a)); + assertEqualInt(ARCHIVE_OK, archive_read_support_format_tar(a)); + assertEqualInt(ARCHIVE_FATAL, + archive_read_open(a, &private, my_open, my_read, my_close)); + assertEqualInt(1, private.open_called); + assertEqualInt(1, private.read_called); + assertEqualInt(1, private.close_called); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + assertEqualInt(1, private.open_called); + assertEqualInt(1, private.read_called); + assertEqualInt(1, private.close_called); + + memset(&private, 0, sizeof(private)); + private.magic = MAGIC; + private.open_return = ARCHIVE_FATAL; + a = archive_write_new(); + assert(a != NULL); + assertEqualInt(ARCHIVE_FATAL, + archive_write_open(a, &private, my_open, my_write, my_close)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.write_called); + // Broken in 2.8, fixed in 3.0 + //assertEqualInt(1, private.close_called); + assertEqualInt(ARCHIVE_OK, archive_write_finish(a)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.write_called); + assertEqualInt(1, private.close_called); + + memset(&private, 0, sizeof(private)); + private.magic = MAGIC; + private.open_return = ARCHIVE_FATAL; + a = archive_write_new(); + assert(a != NULL); + archive_write_set_compression_compress(a); + archive_write_set_format_zip(a); + assertEqualInt(ARCHIVE_FATAL, + archive_write_open(a, &private, my_open, my_write, my_close)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.write_called); + // Broken in 2.8, fixed in 3.0 + //assertEqualInt(1, private.close_called); + assertEqualInt(ARCHIVE_OK, archive_write_finish(a)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.write_called); + assertEqualInt(1, private.close_called); + + memset(&private, 0, sizeof(private)); + private.magic = MAGIC; + private.open_return = ARCHIVE_FATAL; + a = archive_write_new(); + assert(a != NULL); + archive_write_set_compression_gzip(a); + assertEqualInt(ARCHIVE_FATAL, + archive_write_open(a, &private, my_open, my_write, my_close)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.write_called); + // Broken in 2.8, fixed in 3.0 + //assertEqualInt(1, private.close_called); + assertEqualInt(ARCHIVE_OK, archive_write_finish(a)); + assertEqualInt(1, private.open_called); + assertEqualInt(0, private.write_called); + assertEqualInt(1, private.close_called); + +} Modified: stable/8/lib/libarchive/test/test_read_format_mtree.c ============================================================================== --- stable/8/lib/libarchive/test/test_read_format_mtree.c Wed Aug 10 08:34:00 2011 (r224751) +++ stable/8/lib/libarchive/test/test_read_format_mtree.c Wed Aug 10 08:40:59 2011 (r224752) @@ -134,10 +134,53 @@ test_read_format_mtree2(void) assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); } +/* + * Reported to libarchive.googlecode.com as Issue 121. + */ +static void +test_read_format_mtree3(void) +{ + static char archive[] = + "#mtree\n" + "a type=file contents=file\n" + "b type=link link=a\n" + "c type=file contents=file\n"; + struct archive_entry *ae; + struct archive *a; + + assertMakeDir("mtree3", 0777); + assertChdir("mtree3"); + assertMakeFile("file", 0644, "file contents"); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString(archive_entry_pathname(ae), "a"); + assertEqualInt(archive_entry_filetype(ae), AE_IFREG); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString(archive_entry_pathname(ae), "b"); + assertEqualInt(archive_entry_filetype(ae), AE_IFLNK); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString(archive_entry_pathname(ae), "c"); + assertEqualInt(archive_entry_filetype(ae), AE_IFREG); + + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + + assertChdir(".."); +} + DEFINE_TEST(test_read_format_mtree) { test_read_format_mtree1(); test_read_format_mtree2(); + test_read_format_mtree3(); } Modified: stable/8/lib/libarchive/test/test_write_compress_lzma.c ============================================================================== --- stable/8/lib/libarchive/test/test_write_compress_lzma.c Wed Aug 10 08:34:00 2011 (r224751) +++ stable/8/lib/libarchive/test/test_write_compress_lzma.c Wed Aug 10 08:40:59 2011 (r224752) @@ -185,10 +185,15 @@ DEFINE_TEST(test_write_compress_lzma) archive_write_close(a); assert(0 == archive_write_finish(a)); - /* Level 0 really does result in larger data. */ + /* It would be nice to assert that compression-level=0 produced + * consistently larger/smaller results than the default compression, + * but the results here vary a lot depending on the version of liblzma + * being used. */ + /* failure("Compression-level=0 wrote %d bytes; default wrote %d bytes", (int)used2, (int)used1); assert(used2 > used1); + */ assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_support_format_all(a)); Modified: stable/8/lib/libarchive/test/test_write_compress_xz.c ============================================================================== --- stable/8/lib/libarchive/test/test_write_compress_xz.c Wed Aug 10 08:34:00 2011 (r224751) +++ stable/8/lib/libarchive/test/test_write_compress_xz.c Wed Aug 10 08:40:59 2011 (r224752) @@ -193,10 +193,14 @@ DEFINE_TEST(test_write_compress_xz) archive_write_close(a); assert(0 == archive_write_finish(a)); - /* Level 0 really does result in larger data. */ + /* I would like to assert that compression-level=0 results in + * larger data than the default compression, but that's not true + * for all versions of liblzma. */ + /* failure("Compression-level=0 wrote %d bytes; default wrote %d bytes", (int)used2, (int)used1); assert(used2 > used1); + */ assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_support_format_all(a)); From owner-svn-src-stable-8@FreeBSD.ORG Wed Aug 10 08:52:27 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DECFC106566B; Wed, 10 Aug 2011 08:52:27 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CED798FC18; Wed, 10 Aug 2011 08:52:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7A8qRha033187; Wed, 10 Aug 2011 08:52:27 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7A8qRDt033185; Wed, 10 Aug 2011 08:52:27 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201108100852.p7A8qRDt033185@svn.freebsd.org> From: Xin LI Date: Wed, 10 Aug 2011 08:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224753 - stable/8/usr.bin/rpcgen X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 08:52:28 -0000 Author: delphij Date: Wed Aug 10 08:52:27 2011 New Revision: 224753 URL: http://svn.freebsd.org/changeset/base/224753 Log: MFC r223922: Use strlcpy(). Modified: stable/8/usr.bin/rpcgen/rpc_scan.c Directory Properties: stable/8/usr.bin/rpcgen/ (props changed) Modified: stable/8/usr.bin/rpcgen/rpc_scan.c ============================================================================== --- stable/8/usr.bin/rpcgen/rpc_scan.c Wed Aug 10 08:40:59 2011 (r224752) +++ stable/8/usr.bin/rpcgen/rpc_scan.c Wed Aug 10 08:52:27 2011 (r224753) @@ -329,10 +329,9 @@ findstrconst(char **str, const char **va error("unterminated string constant"); } p++; - size = p - *str; - tmp = xmalloc(size + 1); - (void) strncpy(tmp, *str, size); - tmp[size] = 0; + size = p - *str + 1; + tmp = xmalloc(size); + (void) strlcpy(tmp, *str, size); *val = tmp; *str = p; } @@ -352,13 +351,12 @@ findchrconst(char **str, const char **va error("unterminated string constant"); } p++; - size = p - *str; - if (size != 3) { + size = p - *str + 1; + if (size != 4) { error("empty char string"); } - tmp = xmalloc(size + 1); - (void) strncpy(tmp, *str, size); - tmp[size] = 0; + tmp = xmalloc(size); + (void) strlcpy(tmp, *str, size); *val = tmp; *str = p; } @@ -381,10 +379,9 @@ findconst(char **str, const char **val) p++; } while (isdigit(*p)); } - size = p - *str; - tmp = xmalloc(size + 1); - (void) strncpy(tmp, *str, size); - tmp[size] = 0; + size = p - *str + 1; + tmp = xmalloc(size); + (void) strlcpy(tmp, *str, size); *val = tmp; *str = p; } @@ -438,8 +435,7 @@ findkind(char **mark, token *tokp) tokp->kind = TOK_IDENT; for (len = 0; isalnum(str[len]) || str[len] == '_'; len++); tmp = xmalloc(len + 1); - (void) strncpy(tmp, str, len); - tmp[len] = 0; + (void) strlcpy(tmp, str, len + 1); tokp->str = tmp; *mark = str + len; } From owner-svn-src-stable-8@FreeBSD.ORG Wed Aug 10 08:53:34 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43C59106566B; Wed, 10 Aug 2011 08:53:34 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33C288FC18; Wed, 10 Aug 2011 08:53:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7A8rYPY033321; Wed, 10 Aug 2011 08:53:34 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7A8rYKN033319; Wed, 10 Aug 2011 08:53:34 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201108100853.p7A8rYKN033319@svn.freebsd.org> From: Xin LI Date: Wed, 10 Aug 2011 08:53:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224754 - stable/8/usr.bin/gcore X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 08:53:34 -0000 Author: delphij Date: Wed Aug 10 08:53:33 2011 New Revision: 224754 URL: http://svn.freebsd.org/changeset/base/224754 Log: MFC r223924: Match size_t and ssize_t by using %zu and %zd instead of %d. Modified: stable/8/usr.bin/gcore/elfcore.c Directory Properties: stable/8/usr.bin/gcore/ (props changed) Modified: stable/8/usr.bin/gcore/elfcore.c ============================================================================== --- stable/8/usr.bin/gcore/elfcore.c Wed Aug 10 08:52:27 2011 (r224753) +++ stable/8/usr.bin/gcore/elfcore.c Wed Aug 10 08:53:33 2011 (r224754) @@ -183,7 +183,7 @@ elf_coredump(int efd __unused, int fd, p ptrace(PT_IO, pid, (caddr_t)&iorequest, 0); ngot = iorequest.piod_len; if ((size_t)ngot < nwant) - errx(1, "short read wanted %d, got %d", + errx(1, "short read wanted %zu, got %zd", nwant, ngot); ngot = write(fd, buf, nwant); if (ngot == -1) From owner-svn-src-stable-8@FreeBSD.ORG Wed Aug 10 08:54:35 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA380106566B; Wed, 10 Aug 2011 08:54:35 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A4958FC08; Wed, 10 Aug 2011 08:54:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7A8sZBj033397; Wed, 10 Aug 2011 08:54:35 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7A8sZlL033395; Wed, 10 Aug 2011 08:54:35 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201108100854.p7A8sZlL033395@svn.freebsd.org> From: Xin LI Date: Wed, 10 Aug 2011 08:54:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224755 - stable/8/usr.bin/ipcs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 08:54:35 -0000 Author: delphij Date: Wed Aug 10 08:54:35 2011 New Revision: 224755 URL: http://svn.freebsd.org/changeset/base/224755 Log: MFC r223925: Use %zu when printing size_t. Modified: stable/8/usr.bin/ipcs/ipc.c Directory Properties: stable/8/usr.bin/ipcs/ (props changed) Modified: stable/8/usr.bin/ipcs/ipc.c ============================================================================== --- stable/8/usr.bin/ipcs/ipc.c Wed Aug 10 08:53:33 2011 (r224754) +++ stable/8/usr.bin/ipcs/ipc.c Wed Aug 10 08:54:35 2011 (r224755) @@ -120,7 +120,7 @@ sysctlgatherstruct(void *addr, size_t si if (rv == -1) err(1, "sysctlbyname: %s", xp->sysctl); if (tsiz != xp->size) - errx(1, "%s size mismatch (expected %d, got %d)", + errx(1, "%s size mismatch (expected %zu, got %zu)", xp->sysctl, xp->size, tsiz); } } @@ -199,7 +199,7 @@ kget(int idx, void *addr, size_t size) err(1, "sysctlbyname: %s", sym2sysctl[idx]); if (tsiz != size) errx(1, "%s size mismatch " - "(expected %d, got %d)", + "(expected %zu, got %zu)", sym2sysctl[idx], size, tsiz); break; } From owner-svn-src-stable-8@FreeBSD.ORG Wed Aug 10 08:55:46 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDC1F1065677; Wed, 10 Aug 2011 08:55:46 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CDFA08FC15; Wed, 10 Aug 2011 08:55:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7A8tkRX033489; Wed, 10 Aug 2011 08:55:46 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7A8tkQt033487; Wed, 10 Aug 2011 08:55:46 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201108100855.p7A8tkQt033487@svn.freebsd.org> From: Xin LI Date: Wed, 10 Aug 2011 08:55:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224756 - stable/8/usr.bin/tftp X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2011 08:55:47 -0000 Author: delphij Date: Wed Aug 10 08:55:46 2011 New Revision: 224756 URL: http://svn.freebsd.org/changeset/base/224756 Log: MFC r223926: peeraddr is only used in sizeof() evaluations, so instead of declaring it a variable, use typedef. Modified: stable/8/usr.bin/tftp/main.c Directory Properties: stable/8/usr.bin/tftp/ (props changed) Modified: stable/8/usr.bin/tftp/main.c ============================================================================== --- stable/8/usr.bin/tftp/main.c Wed Aug 10 08:54:35 2011 (r224755) +++ stable/8/usr.bin/tftp/main.c Wed Aug 10 08:55:46 2011 (r224756) @@ -82,7 +82,7 @@ __FBSDID("$FreeBSD$"); #define MAXLINE 200 #define TIMEOUT 5 /* secs between rexmt's */ -static struct sockaddr_storage peeraddr; +typedef struct sockaddr_storage peeraddr; static int connected; static char mode[32]; jmp_buf toplevel; From owner-svn-src-stable-8@FreeBSD.ORG Thu Aug 11 02:50:19 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 625B8106564A; Thu, 11 Aug 2011 02:50:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 374328FC0C; Thu, 11 Aug 2011 02:50:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7B2oJA8071689; Thu, 11 Aug 2011 02:50:19 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7B2oJeJ071687; Thu, 11 Aug 2011 02:50:19 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201108110250.p7B2oJeJ071687@svn.freebsd.org> From: Ed Maste Date: Thu, 11 Aug 2011 02:50:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224771 - stable/8/usr.bin/ar X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2011 02:50:19 -0000 Author: emaste Date: Thu Aug 11 02:50:18 2011 New Revision: 224771 URL: http://svn.freebsd.org/changeset/base/224771 Log: MFC r224650: Don't try to free() an address returned by mmap(). This appears to be triggered by the same .o being included twice on the command line. Modified: stable/8/usr.bin/ar/write.c Directory Properties: stable/8/usr.bin/ar/ (props changed) Modified: stable/8/usr.bin/ar/write.c ============================================================================== --- stable/8/usr.bin/ar/write.c Thu Aug 11 02:08:02 2011 (r224770) +++ stable/8/usr.bin/ar/write.c Thu Aug 11 02:50:18 2011 (r224771) @@ -58,6 +58,7 @@ static struct ar_obj *create_obj_from_fi const char *name, time_t mtime); static void create_symtab_entry(struct bsdar *bsdar, void *maddr, size_t size); +static void free_obj(struct bsdar *bsdar, struct ar_obj *obj); static void insert_obj(struct bsdar *bsdar, struct ar_obj *obj, struct ar_obj *pos); static void read_objs(struct bsdar *bsdar, const char *archive, @@ -210,6 +211,22 @@ giveup: } /* + * Free object itself and its associated allocations. + */ +static void +free_obj(struct bsdar *bsdar, struct ar_obj *obj) +{ + if (obj->fd == -1) + free(obj->maddr); + else + if (obj->maddr != NULL && munmap(obj->maddr, obj->size)) + bsdar_warnc(bsdar, errno, + "can't munmap file: %s", obj->name); + free(obj->name); + free(obj); +} + +/* * Insert obj to the tail, or before/after the pos obj. */ static void @@ -474,11 +491,8 @@ write_archive(struct bsdar *bsdar, char *av); TAILQ_REMOVE(&bsdar->v_obj, obj, objs); - if (mode == 'd' || mode == 'r') { - free(obj->maddr); - free(obj->name); - free(obj); - } + if (mode == 'd' || mode == 'r') + free_obj(bsdar, obj); if (mode == 'm') insert_obj(bsdar, obj, pos); @@ -525,15 +539,8 @@ write_cleanup(struct bsdar *bsdar) struct ar_obj *obj, *obj_temp; TAILQ_FOREACH_SAFE(obj, &bsdar->v_obj, objs, obj_temp) { - if (obj->fd == -1) - free(obj->maddr); - else - if (obj->maddr != NULL && munmap(obj->maddr, obj->size)) - bsdar_warnc(bsdar, errno, - "can't munmap file: %s", obj->name); TAILQ_REMOVE(&bsdar->v_obj, obj, objs); - free(obj->name); - free(obj); + free_obj(bsdar, obj); } free(bsdar->as); From owner-svn-src-stable-8@FreeBSD.ORG Fri Aug 12 21:40:25 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F386106564A; Fri, 12 Aug 2011 21:40:25 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DC918FC1F; Fri, 12 Aug 2011 21:40:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7CLePbE084072; Fri, 12 Aug 2011 21:40:25 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7CLeOq8084069; Fri, 12 Aug 2011 21:40:24 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201108122140.p7CLeOq8084069@svn.freebsd.org> From: Doug Barton Date: Fri, 12 Aug 2011 21:40:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224807 - stable/8/usr.sbin/mergemaster X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2011 21:40:25 -0000 Author: dougb Date: Fri Aug 12 21:40:24 2011 New Revision: 224807 URL: http://svn.freebsd.org/changeset/base/224807 Log: MFC r224726: Make clear that the -U option can be dangerous. In -p mode install the group file with the same permissions as normally done in etc/Makefile. Update the copyright. Modified: stable/8/usr.sbin/mergemaster/mergemaster.8 stable/8/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/8/usr.sbin/mergemaster/ (props changed) Modified: stable/8/usr.sbin/mergemaster/mergemaster.8 ============================================================================== --- stable/8/usr.sbin/mergemaster/mergemaster.8 Fri Aug 12 20:09:38 2011 (r224806) +++ stable/8/usr.sbin/mergemaster/mergemaster.8 Fri Aug 12 21:40:24 2011 (r224807) @@ -1,4 +1,4 @@ -.\" Copyright (c) 1998-2010 Douglas Barton +.\" Copyright (c) 1998-2011 Douglas Barton .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 13, 2010 +.Dd August 9, 2011 .Dt MERGEMASTER 8 .Os .Sh NAME @@ -244,6 +244,8 @@ or another directory you specify in your rc file. .It Fl U Attempt to auto upgrade files that have not been user modified. +This option can be dangerous when there are critical changes +in the new versions that affect your running system. .It Fl m Ar /path/to/sources Specify the path to the directory where you want to do the .Xr make 1 . @@ -361,6 +363,7 @@ with all values commented out: #AUTO_INSTALL= # # Automatically upgrade files that have not been user modified (-U) +# ***DANGEROUS*** #AUTO_UPGRADE= # # Compare /etc/rc.conf[.local] to /etc/defaults/rc.conf (-C) @@ -462,7 +465,7 @@ temporary root environment comes from Ni make world tutorial which is referenced above. .Sh AUTHORS This manual page and the script itself were written by -.An Douglas Barton Aq DougB@FreeBSD.org . +.An Douglas Barton Aq dougb@FreeBSD.org . .Sh BUGS There are no known bugs. Please report any problems, Modified: stable/8/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/8/usr.sbin/mergemaster/mergemaster.sh Fri Aug 12 20:09:38 2011 (r224806) +++ stable/8/usr.sbin/mergemaster/mergemaster.sh Fri Aug 12 21:40:24 2011 (r224807) @@ -5,8 +5,8 @@ # Compare files created by /usr/src/etc/Makefile (or the directory # the user specifies) with the currently installed copies. -# Copyright 1998-2010 Douglas Barton -# DougB@FreeBSD.org +# Copyright 1998-2011 Douglas Barton +# dougb@FreeBSD.org # $FreeBSD$ @@ -30,6 +30,7 @@ display_usage () { echo ' -C Compare local rc.conf variables to the defaults' echo ' -P Preserve files that are overwritten' echo " -U Attempt to auto upgrade files that have not been user modified" + echo ' ***DANGEROUS***' echo '' echo " -m /path/directory Specify location of source to do the make in" echo " -t /path/directory Specify temp root directory" @@ -635,7 +636,7 @@ case "${RERUN}" in # Only set up files that are crucial to {build|install}world { mkdir -p ${TEMPROOT}/etc && cp -p ${SOURCEDIR}/etc/master.passwd ${TEMPROOT}/etc && - cp -p ${SOURCEDIR}/etc/group ${TEMPROOT}/etc;} || + install -p -o root -g wheel -m 0644 ${SOURCEDIR}/etc/group ${TEMPROOT}/etc;} || { echo ''; echo ' *** FATAL ERROR: Cannot copy files to the temproot environment'; echo ''; From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 00:56:42 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 807931065673; Sat, 13 Aug 2011 00:56:42 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 66B9E8FC14; Sat, 13 Aug 2011 00:56:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7D0ug0B089953; Sat, 13 Aug 2011 00:56:42 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7D0ugmR089946; Sat, 13 Aug 2011 00:56:42 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201108130056.p7D0ugmR089946@svn.freebsd.org> From: Xin LI Date: Sat, 13 Aug 2011 00:56:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224809 - stable/8/usr.sbin/rpcbind X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 00:56:42 -0000 Author: delphij Date: Sat Aug 13 00:56:42 2011 New Revision: 224809 URL: http://svn.freebsd.org/changeset/base/224809 Log: MFC r224001: Use prototype. While I'm there, add a pair of parenthesis to mark an if statment's border. Modified: stable/8/usr.sbin/rpcbind/rpcb_stat.c stable/8/usr.sbin/rpcbind/rpcb_svc_com.c stable/8/usr.sbin/rpcbind/rpcbind.c stable/8/usr.sbin/rpcbind/util.c stable/8/usr.sbin/rpcbind/warmstart.c Directory Properties: stable/8/usr.sbin/rpcbind/ (props changed) Modified: stable/8/usr.sbin/rpcbind/rpcb_stat.c ============================================================================== --- stable/8/usr.sbin/rpcbind/rpcb_stat.c Fri Aug 12 21:41:20 2011 (r224808) +++ stable/8/usr.sbin/rpcbind/rpcb_stat.c Sat Aug 13 00:56:42 2011 (r224809) @@ -54,7 +54,7 @@ static rpcb_stat_byvers inf; void -rpcbs_init() +rpcbs_init(void) { } Modified: stable/8/usr.sbin/rpcbind/rpcb_svc_com.c ============================================================================== --- stable/8/usr.sbin/rpcbind/rpcb_svc_com.c Fri Aug 12 21:41:20 2011 (r224808) +++ stable/8/usr.sbin/rpcbind/rpcb_svc_com.c Sat Aug 13 00:56:42 2011 (r224809) @@ -1076,7 +1076,7 @@ netbuffree(struct netbuf *ap) extern bool_t __svc_clean_idle(fd_set *, int, bool_t); void -my_svc_run() +my_svc_run(void) { size_t nfds; struct pollfd pollfds[FD_SETSIZE]; Modified: stable/8/usr.sbin/rpcbind/rpcbind.c ============================================================================== --- stable/8/usr.sbin/rpcbind/rpcbind.c Fri Aug 12 21:41:20 2011 (r224808) +++ stable/8/usr.sbin/rpcbind/rpcbind.c Sat Aug 13 00:56:42 2011 (r224809) @@ -178,12 +178,13 @@ main(int argc, char *argv[]) init_transport(nconf); while ((nconf = getnetconfig(nc_handle))) { - if (nconf->nc_flag & NC_VISIBLE) + if (nconf->nc_flag & NC_VISIBLE) { if (ipv6_only == 1 && strcmp(nconf->nc_protofmly, "inet") == 0) { /* DO NOTHING */ } else init_transport(nconf); + } } endnetconfig(nc_handle); @@ -766,7 +767,7 @@ terminate(int dummy __unused) } void -rpcbind_abort() +rpcbind_abort(void) { #ifdef WARMSTART write_warmstart(); /* Dump yourself */ Modified: stable/8/usr.sbin/rpcbind/util.c ============================================================================== --- stable/8/usr.sbin/rpcbind/util.c Fri Aug 12 21:41:20 2011 (r224808) +++ stable/8/usr.sbin/rpcbind/util.c Sat Aug 13 00:56:42 2011 (r224809) @@ -290,7 +290,7 @@ freeit: } void -network_init() +network_init(void) { #ifdef INET6 struct ifaddrs *ifap, *ifp; Modified: stable/8/usr.sbin/rpcbind/warmstart.c ============================================================================== --- stable/8/usr.sbin/rpcbind/warmstart.c Fri Aug 12 21:41:20 2011 (r224808) +++ stable/8/usr.sbin/rpcbind/warmstart.c Sat Aug 13 00:56:42 2011 (r224809) @@ -142,7 +142,7 @@ error: fprintf(stderr, "rpcbind: will st } void -write_warmstart() +write_warmstart(void) { (void) write_struct(RPCBFILE, (xdrproc_t)xdr_rpcblist_ptr, &list_rbl); #ifdef PORTMAP @@ -152,7 +152,7 @@ write_warmstart() } void -read_warmstart() +read_warmstart(void) { rpcblist_ptr tmp_rpcbl = NULL; #ifdef PORTMAP From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 12:28:58 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8A8B106566C; Sat, 13 Aug 2011 12:28:58 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D6A4D8FC0A; Sat, 13 Aug 2011 12:28:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DCSwVG015353; Sat, 13 Aug 2011 12:28:58 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DCSws2015350; Sat, 13 Aug 2011 12:28:58 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108131228.p7DCSws2015350@svn.freebsd.org> From: Marius Strobl Date: Sat, 13 Aug 2011 12:28:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224816 - stable/8/sys/dev/mpt X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 12:28:59 -0000 Author: marius Date: Sat Aug 13 12:28:58 2011 New Revision: 224816 URL: http://svn.freebsd.org/changeset/base/224816 Log: MFC: r223985 - For SAS but neither FC nor SPI controllers default to using MSI/MSI-X (still allowing their use to be disabled via device hints though). This matches what the corresponding Linux driver provided by LSI does. Tested with SAS1064. - There's no need to keep track of the RIDs used. - Don't allocate MSI/MSI-X as RF_SHAREABLE. - Remove a comment which no longer applies since r209599 (MFC'ed to stable/8 in r210376). - Assign NULL rather than 0 to pointers. Modified: stable/8/sys/dev/mpt/mpt.h stable/8/sys/dev/mpt/mpt_pci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mpt/mpt.h ============================================================================== --- stable/8/sys/dev/mpt/mpt.h Sat Aug 13 12:14:40 2011 (r224815) +++ stable/8/sys/dev/mpt/mpt.h Sat Aug 13 12:28:58 2011 (r224816) @@ -721,11 +721,9 @@ struct mpt_softc { * DMA Mapping Stuff */ struct resource * pci_reg; /* Register map for chip */ - int pci_mem_rid; /* Resource ID */ bus_space_tag_t pci_st; /* Bus tag for registers */ bus_space_handle_t pci_sh; /* Bus handle for registers */ /* PIO versions of above. */ - int pci_pio_rid; struct resource * pci_pio_reg; bus_space_tag_t pci_pio_st; bus_space_handle_t pci_pio_sh; Modified: stable/8/sys/dev/mpt/mpt_pci.c ============================================================================== --- stable/8/sys/dev/mpt/mpt_pci.c Sat Aug 13 12:14:40 2011 (r224815) +++ stable/8/sys/dev/mpt/mpt_pci.c Sat Aug 13 12:28:58 2011 (r224816) @@ -362,9 +362,11 @@ mpt_set_options(struct mpt_softc *mpt) } tval = 0; mpt->msi_enable = 0; - if (resource_int_value(device_get_name(mpt->dev), - device_get_unit(mpt->dev), "msi_enable", &tval) == 0 && tval == 1) { + if (mpt->is_sas) mpt->msi_enable = 1; + if (resource_int_value(device_get_name(mpt->dev), + device_get_unit(mpt->dev), "msi_enable", &tval) == 0) { + mpt->msi_enable = tval; } } #endif @@ -517,9 +519,9 @@ mpt_pci_attach(device_t dev) * certain reset operations (but must be disabled for * some cards otherwise). */ - mpt->pci_pio_rid = PCIR_BAR(mpt_io_bar); + mpt_io_bar = PCIR_BAR(mpt_io_bar); mpt->pci_pio_reg = bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &mpt->pci_pio_rid, RF_ACTIVE); + &mpt_io_bar, RF_ACTIVE); if (mpt->pci_pio_reg == NULL) { device_printf(dev, "unable to map registers in PIO mode\n"); goto bad; @@ -528,9 +530,9 @@ mpt_pci_attach(device_t dev) mpt->pci_pio_sh = rman_get_bushandle(mpt->pci_pio_reg); /* Allocate kernel virtual memory for the 9x9's Mem0 region */ - mpt->pci_mem_rid = PCIR_BAR(mpt_mem_bar); + mpt_mem_bar = PCIR_BAR(mpt_mem_bar); mpt->pci_reg = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &mpt->pci_mem_rid, RF_ACTIVE); + &mpt_mem_bar, RF_ACTIVE); if (mpt->pci_reg == NULL) { device_printf(dev, "Unable to memory map registers.\n"); if (mpt->is_sas) { @@ -570,7 +572,7 @@ mpt_pci_attach(device_t dev) } } mpt->pci_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd, - RF_ACTIVE | RF_SHAREABLE); + RF_ACTIVE | (mpt->pci_msi_count ? 0 : RF_SHAREABLE)); if (mpt->pci_irq == NULL) { device_printf(dev, "could not allocate interrupt\n"); goto bad; @@ -589,7 +591,6 @@ mpt_pci_attach(device_t dev) } /* Allocate dma memory */ -/* XXX JGibbs -Should really be done based on IOCFacts. */ if (mpt_dma_mem_alloc(mpt)) { mpt_prt(mpt, "Could not allocate DMA memory\n"); goto bad; @@ -655,13 +656,13 @@ mpt_free_bus_resources(struct mpt_softc { if (mpt->ih) { bus_teardown_intr(mpt->dev, mpt->pci_irq, mpt->ih); - mpt->ih = 0; + mpt->ih = NULL; } if (mpt->pci_irq) { bus_release_resource(mpt->dev, SYS_RES_IRQ, - mpt->pci_msi_count ? 1 : 0, mpt->pci_irq); - mpt->pci_irq = 0; + rman_get_rid(mpt->pci_irq), mpt->pci_irq); + mpt->pci_irq = NULL; } if (mpt->pci_msi_count) { @@ -670,14 +671,14 @@ mpt_free_bus_resources(struct mpt_softc } if (mpt->pci_pio_reg) { - bus_release_resource(mpt->dev, SYS_RES_IOPORT, mpt->pci_pio_rid, - mpt->pci_pio_reg); - mpt->pci_pio_reg = 0; + bus_release_resource(mpt->dev, SYS_RES_IOPORT, + rman_get_rid(mpt->pci_pio_reg), mpt->pci_pio_reg); + mpt->pci_pio_reg = NULL; } if (mpt->pci_reg) { - bus_release_resource(mpt->dev, SYS_RES_MEMORY, mpt->pci_mem_rid, - mpt->pci_reg); - mpt->pci_reg = 0; + bus_release_resource(mpt->dev, SYS_RES_MEMORY, + rman_get_rid(mpt->pci_reg), mpt->pci_reg); + mpt->pci_reg = NULL; } MPT_LOCK_DESTROY(mpt); } @@ -817,10 +818,9 @@ mpt_dma_mem_free(struct mpt_softc *mpt) bus_dmamem_free(mpt->reply_dmat, mpt->reply, mpt->reply_dmap); bus_dma_tag_destroy(mpt->reply_dmat); bus_dma_tag_destroy(mpt->parent_dmat); - mpt->reply_dmat = 0; + mpt->reply_dmat = NULL; free(mpt->request_pool, M_DEVBUF); - mpt->request_pool = 0; - + mpt->request_pool = NULL; } /* Reads modifiable (via PCI transactions) config registers */ From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 12:33:06 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA6001065672; Sat, 13 Aug 2011 12:33:06 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A79F48FC16; Sat, 13 Aug 2011 12:33:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DCX6O3015599; Sat, 13 Aug 2011 12:33:06 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DCX67j015590; Sat, 13 Aug 2011 12:33:06 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108131233.p7DCX67j015590@svn.freebsd.org> From: Marius Strobl Date: Sat, 13 Aug 2011 12:33:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224818 - stable/8/sys/dev/mpt X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 12:33:06 -0000 Author: marius Date: Sat Aug 13 12:33:06 2011 New Revision: 224818 URL: http://svn.freebsd.org/changeset/base/224818 Log: MFC: r224493 - Staticize functions as appropriate and comment out unused ones. - Sprinkle some const where appropriate. - Consistently use target_id_t for the target parameter of mpt_map_physdisk() and mpt_is_raid_volume(). - Fix some whitespace bugs. Modified: stable/8/sys/dev/mpt/mpt.c stable/8/sys/dev/mpt/mpt.h stable/8/sys/dev/mpt/mpt_cam.c stable/8/sys/dev/mpt/mpt_debug.c stable/8/sys/dev/mpt/mpt_pci.c stable/8/sys/dev/mpt/mpt_raid.c stable/8/sys/dev/mpt/mpt_raid.h stable/8/sys/dev/mpt/mpt_user.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mpt/mpt.c ============================================================================== --- stable/8/sys/dev/mpt/mpt.c Sat Aug 13 12:29:50 2011 (r224817) +++ stable/8/sys/dev/mpt/mpt.c Sat Aug 13 12:33:06 2011 (r224818) @@ -301,66 +301,75 @@ mpt_modevent(module_t mod, int type, voi return (error); } -int +static int mpt_stdload(struct mpt_personality *pers) { + /* Load is always successful. */ return (0); } -int +static int mpt_stdprobe(struct mpt_softc *mpt) { + /* Probe is always successful. */ return (0); } -int +static int mpt_stdattach(struct mpt_softc *mpt) { + /* Attach is always successful. */ return (0); } -int +static int mpt_stdenable(struct mpt_softc *mpt) { + /* Enable is always successful. */ return (0); } -void +static void mpt_stdready(struct mpt_softc *mpt) { -} +} -int +static int mpt_stdevent(struct mpt_softc *mpt, request_t *req, MSG_EVENT_NOTIFY_REPLY *msg) { + mpt_lprt(mpt, MPT_PRT_DEBUG, "mpt_stdevent: 0x%x\n", msg->Event & 0xFF); /* Event was not for us. */ return (0); } -void +static void mpt_stdreset(struct mpt_softc *mpt, int type) { + } -void +static void mpt_stdshutdown(struct mpt_softc *mpt) { + } -void +static void mpt_stddetach(struct mpt_softc *mpt) { + } -int +static int mpt_stdunload(struct mpt_personality *pers) { + /* Unload is always successful. */ return (0); } @@ -383,7 +392,6 @@ mpt_postattach(void *unused) } SYSINIT(mptdev, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, mpt_postattach, NULL); - /******************************* Bus DMA Support ******************************/ void mpt_map_rquest(void *arg, bus_dma_segment_t *segs, int nseg, int error) @@ -478,6 +486,7 @@ static int mpt_default_reply_handler(struct mpt_softc *mpt, request_t *req, uint32_t reply_desc, MSG_DEFAULT_REPLY *reply_frame) { + mpt_prt(mpt, "Default Handler Called: req=%p:%u reply_descriptor=%x frame=%p\n", req, req->serno, reply_desc, reply_frame); @@ -494,8 +503,8 @@ static int mpt_config_reply_handler(struct mpt_softc *mpt, request_t *req, uint32_t reply_desc, MSG_DEFAULT_REPLY *reply_frame) { - if (req != NULL) { + if (req != NULL) { if (reply_frame != NULL) { MSG_CONFIG *cfgp; MSG_CONFIG_REPLY *reply; @@ -528,6 +537,7 @@ static int mpt_handshake_reply_handler(struct mpt_softc *mpt, request_t *req, uint32_t reply_desc, MSG_DEFAULT_REPLY *reply_frame) { + /* Nothing to be done. */ return (TRUE); } @@ -650,6 +660,7 @@ static int mpt_core_event(struct mpt_softc *mpt, request_t *req, MSG_EVENT_NOTIFY_REPLY *msg) { + mpt_lprt(mpt, MPT_PRT_DEBUG, "mpt_core_event: 0x%x\n", msg->Event & 0xFF); switch(msg->Event & 0xFF) { @@ -870,6 +881,7 @@ mpt_complete_request_chain(struct mpt_so void mpt_dump_reply_frame(struct mpt_softc *mpt, MSG_DEFAULT_REPLY *reply_frame) { + mpt_prt(mpt, "Address Reply:\n"); mpt_print_reply(reply_frame); } @@ -881,12 +893,14 @@ static __inline uint32_t mpt_rd_intr(st static __inline uint32_t mpt_rd_db(struct mpt_softc *mpt) { + return mpt_read(mpt, MPT_OFFSET_DOORBELL); } static __inline uint32_t mpt_rd_intr(struct mpt_softc *mpt) { + return mpt_read(mpt, MPT_OFFSET_INTR_STATUS); } @@ -895,6 +909,7 @@ static int mpt_wait_db_ack(struct mpt_softc *mpt) { int i; + for (i=0; i < MPT_MAX_WAIT; i++) { if (!MPT_DB_IS_BUSY(mpt_rd_intr(mpt))) { maxwait_ack = i > maxwait_ack ? i : maxwait_ack; @@ -910,6 +925,7 @@ static int mpt_wait_db_int(struct mpt_softc *mpt) { int i; + for (i = 0; i < MPT_MAX_WAIT; i++) { if (MPT_DB_INTR(mpt_rd_intr(mpt))) { maxwait_int = i > maxwait_int ? i : maxwait_int; @@ -925,6 +941,7 @@ void mpt_check_doorbell(struct mpt_softc *mpt) { uint32_t db = mpt_rd_db(mpt); + if (MPT_STATE(db) != MPT_DB_STATE_RUNNING) { mpt_prt(mpt, "Device not running\n"); mpt_print_db(db); @@ -956,6 +973,7 @@ static int mpt_download_fw(struct mpt_so static int mpt_soft_reset(struct mpt_softc *mpt) { + mpt_lprt(mpt, MPT_PRT_DEBUG, "soft reset\n"); /* Have to use hard reset if we are not in Running state */ @@ -1019,6 +1037,7 @@ mpt_enable_diag_mode(struct mpt_softc *m static void mpt_disable_diag_mode(struct mpt_softc *mpt) { + mpt_write(mpt, MPT_OFFSET_SEQUENCE, 0xFFFFFFFF); } @@ -1094,6 +1113,7 @@ mpt_hard_reset(struct mpt_softc *mpt) static void mpt_core_ioc_reset(struct mpt_softc *mpt, int type) { + /* * Complete all pending requests with a status * appropriate for an IOC reset. @@ -1102,7 +1122,6 @@ mpt_core_ioc_reset(struct mpt_softc *mpt MPI_IOCSTATUS_INVALID_STATE); } - /* * Reset the IOC when needed. Try software command first then if needed * poke at the magic diagnostic reset. Note that a hard reset resets @@ -1263,6 +1282,7 @@ retry: void mpt_send_cmd(struct mpt_softc *mpt, request_t *req) { + if (mpt->verbose > MPT_PRT_DEBUG2) { mpt_dump_request(mpt, req); } @@ -2110,6 +2130,7 @@ mpt_send_event_request(struct mpt_softc void mpt_enable_ints(struct mpt_softc *mpt) { + /* Unmask every thing except door bell int */ mpt_write(mpt, MPT_OFFSET_INTR_MASK, MPT_INTR_DB_MASK); } @@ -2120,6 +2141,7 @@ mpt_enable_ints(struct mpt_softc *mpt) void mpt_disable_ints(struct mpt_softc *mpt) { + /* Mask all interrupts */ mpt_write(mpt, MPT_OFFSET_INTR_MASK, MPT_INTR_REPLY_MASK | MPT_INTR_DB_MASK); @@ -2219,7 +2241,7 @@ mpt_detach(struct mpt_softc *mpt) return (0); } -int +static int mpt_core_load(struct mpt_personality *pers) { int i; @@ -2245,7 +2267,7 @@ mpt_core_load(struct mpt_personality *pe * Initialize per-instance driver data and perform * initial controller configuration. */ -int +static int mpt_core_attach(struct mpt_softc *mpt) { int val, error; @@ -2276,9 +2298,10 @@ mpt_core_attach(struct mpt_softc *mpt) return (error); } -int +static int mpt_core_enable(struct mpt_softc *mpt) { + /* * We enter with the IOC enabled, but async events * not enabled, ports not enabled and interrupts @@ -2326,13 +2349,14 @@ mpt_core_enable(struct mpt_softc *mpt) return (0); } -void +static void mpt_core_shutdown(struct mpt_softc *mpt) { + mpt_disable_ints(mpt); } -void +static void mpt_core_detach(struct mpt_softc *mpt) { int val; @@ -2351,9 +2375,10 @@ mpt_core_detach(struct mpt_softc *mpt) mpt_dma_buf_free(mpt); } -int +static int mpt_core_unload(struct mpt_personality *pers) { + /* Unload is always successful. */ return (0); } @@ -2575,6 +2600,7 @@ static void mpt_dma_buf_free(struct mpt_softc *mpt) { int i; + if (mpt->request_dmat == 0) { mpt_lprt(mpt, MPT_PRT_DEBUG, "already released dma memory\n"); return; Modified: stable/8/sys/dev/mpt/mpt.h ============================================================================== --- stable/8/sys/dev/mpt/mpt.h Sat Aug 13 12:29:50 2011 (r224817) +++ stable/8/sys/dev/mpt/mpt.h Sat Aug 13 12:33:06 2011 (r224818) @@ -1075,16 +1075,6 @@ mpt_complete_request_chain(struct mpt_so int mpt_reset(struct mpt_softc *, int /*reinit*/); /****************************** Debugging ************************************/ -typedef struct mpt_decode_entry { - char *name; - u_int value; - u_int mask; -} mpt_decode_entry_t; - -int mpt_decode_value(mpt_decode_entry_t *table, u_int num_entries, - const char *name, u_int value, u_int *cur_column, - u_int wrap_point); - void mpt_dump_data(struct mpt_softc *, const char *, void *, int); void mpt_dump_request(struct mpt_softc *, request_t *); @@ -1110,17 +1100,21 @@ do { \ mpt_prt(mpt, __VA_ARGS__); \ } while (0) +#if 0 #define mpt_lprtc(mpt, level, ...) \ do { \ if (level <= (mpt)->verbose) \ mpt_prtc(mpt, __VA_ARGS__); \ } while (0) +#endif #else void mpt_lprt(struct mpt_softc *, int, const char *, ...) __printflike(3, 4); +#if 0 void mpt_lprtc(struct mpt_softc *, int, const char *, ...) __printflike(3, 4); #endif +#endif void mpt_prt(struct mpt_softc *, const char *, ...) __printflike(2, 3); void mpt_prtc(struct mpt_softc *, const char *, ...) @@ -1277,7 +1271,6 @@ void mpt_check_doorbell(struct mpt_soft void mpt_dump_reply_frame(struct mpt_softc *mpt, MSG_DEFAULT_REPLY *reply_frame); -void mpt_set_config_regs(struct mpt_softc *); int mpt_issue_cfg_req(struct mpt_softc */*mpt*/, request_t */*req*/, cfgparms_t *params, bus_addr_t /*addr*/, bus_size_t/*len*/, @@ -1331,6 +1324,5 @@ char *mpt_ioc_diag(uint32_t diag); void mpt_req_state(mpt_req_state_t state); void mpt_print_config_request(void *vmsg); void mpt_print_request(void *vmsg); -void mpt_print_scsi_io_request(MSG_SCSI_IO_REQUEST *msg); void mpt_dump_sgl(SGE_IO_UNION *se, int offset); #endif /* _MPT_H_ */ Modified: stable/8/sys/dev/mpt/mpt_cam.c ============================================================================== --- stable/8/sys/dev/mpt/mpt_cam.c Sat Aug 13 12:29:50 2011 (r224817) +++ stable/8/sys/dev/mpt/mpt_cam.c Sat Aug 13 12:33:06 2011 (r224818) @@ -193,7 +193,7 @@ MODULE_DEPEND(mpt_cam, cam, 1, 1, 1); int mpt_enable_sata_wc = -1; TUNABLE_INT("hw.mpt.enable_sata_wc", &mpt_enable_sata_wc); -int +static int mpt_cam_probe(struct mpt_softc *mpt) { int role; @@ -215,7 +215,7 @@ mpt_cam_probe(struct mpt_softc *mpt) return (ENODEV); } -int +static int mpt_cam_attach(struct mpt_softc *mpt) { struct cam_devq *devq; @@ -509,7 +509,6 @@ mpt_read_config_info_fc(struct mpt_softc static int mpt_set_initial_config_fc(struct mpt_softc *mpt) { - CONFIG_PAGE_FC_PORT_1 fc; U32 fl; int r, doit = 0; @@ -881,8 +880,8 @@ static int mpt_sata_pass_reply_handler(struct mpt_softc *mpt, request_t *req, uint32_t reply_desc, MSG_DEFAULT_REPLY *reply_frame) { - if (req != NULL) { + if (req != NULL) { if (reply_frame != NULL) { req->IOCStatus = le16toh(reply_frame->IOCStatus); } @@ -1114,7 +1113,7 @@ mpt_set_initial_config_spi(struct mpt_so return (0); } -int +static int mpt_cam_enable(struct mpt_softc *mpt) { int error; @@ -1151,9 +1150,10 @@ out: return (error); } -void +static void mpt_cam_ready(struct mpt_softc *mpt) { + /* * If we're in target mode, hang out resources now * so we don't cause the world to hang talking to us. @@ -1171,7 +1171,7 @@ mpt_cam_ready(struct mpt_softc *mpt) mpt->ready = 1; } -void +static void mpt_cam_detach(struct mpt_softc *mpt) { mpt_handler_t handler; @@ -1842,8 +1842,6 @@ bad: memset(se, 0,sizeof (*se)); se->Address = htole32(dm_segs->ds_addr); - - MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len); tf = flags; if (seg == first_lim - 1) { @@ -1958,9 +1956,6 @@ bad: memset(se, 0, sizeof (*se)); se->Address = htole32(dm_segs->ds_addr); - - - MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len); tf = flags; if (seg == this_seg_lim - 1) { @@ -3045,6 +3040,7 @@ mpt_fc_els_reply_handler(struct mpt_soft static void mpt_cam_ioc_reset(struct mpt_softc *mpt, int type) { + /* * The pending list is already run down by * the generic handler. Perform the same @@ -3974,6 +3970,7 @@ mpt_spawn_recovery_thread(struct mpt_sof static void mpt_terminate_recovery_thread(struct mpt_softc *mpt) { + if (mpt->recovery_thread == NULL) { return; } @@ -4377,6 +4374,7 @@ mpt_add_target_commands(struct mpt_softc static int mpt_enable_lun(struct mpt_softc *mpt, target_id_t tgt, lun_id_t lun) { + if (tgt == CAM_TARGET_WILDCARD && lun == CAM_LUN_WILDCARD) { mpt->twildcard = 1; } else if (lun >= MPT_MAX_LUNS) { @@ -4402,6 +4400,7 @@ static int mpt_disable_lun(struct mpt_softc *mpt, target_id_t tgt, lun_id_t lun) { int i; + if (tgt == CAM_TARGET_WILDCARD && lun == CAM_LUN_WILDCARD) { mpt->twildcard = 0; } else if (lun >= MPT_MAX_LUNS) { @@ -5286,6 +5285,7 @@ mpt_tgt_dump_tgt_state(struct mpt_softc static void mpt_tgt_dump_req_state(struct mpt_softc *mpt, request_t *req) { + mpt_prt(mpt, "req %p:%u index %u (%x) state %x\n", req, req->serno, req->index, req->index, req->state); mpt_tgt_dump_tgt_state(mpt, req); Modified: stable/8/sys/dev/mpt/mpt_debug.c ============================================================================== --- stable/8/sys/dev/mpt/mpt_debug.c Sat Aug 13 12:29:50 2011 (r224817) +++ stable/8/sys/dev/mpt/mpt_debug.c Sat Aug 13 12:33:06 2011 (r224818) @@ -285,6 +285,7 @@ mpt_scsi_state(int code) } return buf; } + static char * mpt_scsi_status(int code) { @@ -298,10 +299,11 @@ mpt_scsi_status(int code) snprintf(buf, sizeof buf, "Unknown (0x%08x)", code); return buf; } -static char * + +static const char * mpt_who(int who_init) { - char *who; + const char *who; switch (who_init) { case MPT_DB_INIT_NOONE: who = "No One"; break; @@ -315,10 +317,10 @@ mpt_who(int who_init) return who; } -static char * +static const char * mpt_state(u_int32_t mb) { - char *text; + const char *text; switch (MPT_STATE(mb)) { case MPT_DB_STATE_RESET: text = "Reset"; break; @@ -347,6 +349,7 @@ mpt_scsi_tm_type(int code) void mpt_print_db(u_int32_t mb) { + printf("mpt mailbox: (0x%x) State %s WhoInit %s\n", mb, mpt_state(mb), mpt_who(MPT_WHO(mb))); } @@ -357,6 +360,7 @@ mpt_print_db(u_int32_t mb) static void mpt_print_reply_hdr(MSG_DEFAULT_REPLY *msg) { + printf("%s Reply @ %p\n", mpt_ioc_function(msg->Function), msg); printf("\tIOC Status %s\n", mpt_ioc_status(msg->IOCStatus)); printf("\tIOCLogInfo 0x%08x\n", msg->IOCLogInfo); @@ -368,6 +372,7 @@ mpt_print_reply_hdr(MSG_DEFAULT_REPLY *m static void mpt_print_init_reply(MSG_IOC_INIT_REPLY *msg) { + mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg); printf("\tWhoInit %s\n", mpt_who(msg->WhoInit)); printf("\tMaxDevices 0x%02x\n", msg->MaxDevices); @@ -377,6 +382,7 @@ mpt_print_init_reply(MSG_IOC_INIT_REPLY static void mpt_print_ioc_facts(MSG_IOC_FACTS_REPLY *msg) { + mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg); printf("\tIOCNumber %d\n", msg->IOCNumber); printf("\tMaxChainDepth %d\n", msg->MaxChainDepth); @@ -402,6 +408,7 @@ mpt_print_ioc_facts(MSG_IOC_FACTS_REPLY static void mpt_print_enable_reply(MSG_PORT_ENABLE_REPLY *msg) { + mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg); printf("\tPort: %d\n", msg->PortNumber); } @@ -409,6 +416,7 @@ mpt_print_enable_reply(MSG_PORT_ENABLE_R static void mpt_print_scsi_io_reply(MSG_SCSI_IO_REPLY *msg) { + mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg); printf("\tBus: %d\n", msg->Bus); printf("\tTargetID %d\n", msg->TargetID); @@ -420,11 +428,10 @@ mpt_print_scsi_io_reply(MSG_SCSI_IO_REPL printf("\tResponseInfo 0x%08x\n", msg->ResponseInfo); } - - static void mpt_print_event_notice(MSG_EVENT_NOTIFY_REPLY *msg) { + mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg); printf("\tEvent: %s\n", mpt_ioc_event(msg->Event)); printf("\tEventContext 0x%04x\n", msg->EventContext); @@ -517,7 +524,7 @@ mpt_print_request_hdr(MSG_REQUEST_HEADER printf("\tMsgContext 0x%08x\n", req->MsgContext); } -void +static void mpt_print_scsi_io_request(MSG_SCSI_IO_REQUEST *orig_msg) { MSG_SCSI_IO_REQUEST local, *msg = &local; @@ -575,6 +582,7 @@ mpt_print_scsi_io_request(MSG_SCSI_IO_RE static void mpt_print_scsi_tmf_request(MSG_SCSI_TASK_MGMT *msg) { + mpt_print_request_hdr((MSG_REQUEST_HEADER *)msg); printf("\tLun 0x%02x\n", msg->LUN[1]); printf("\tTaskType %s\n", mpt_scsi_tm_type(msg->TaskType)); @@ -585,6 +593,7 @@ mpt_print_scsi_tmf_request(MSG_SCSI_TASK static void mpt_print_scsi_target_assist_request(PTR_MSG_TARGET_ASSIST_REQUEST msg) { + mpt_print_request_hdr((MSG_REQUEST_HEADER *)msg); printf("\tStatusCode 0x%02x\n", msg->StatusCode); printf("\tTargetAssist 0x%02x\n", msg->TargetAssistFlags); @@ -600,6 +609,7 @@ static void mpt_print_scsi_target_status_send_request(MSG_TARGET_STATUS_SEND_REQUEST *msg) { SGE_IO_UNION x; + mpt_print_request_hdr((MSG_REQUEST_HEADER *)msg); printf("\tStatusCode 0x%02x\n", msg->StatusCode); printf("\tStatusFlags 0x%02x\n", msg->StatusFlags); @@ -637,7 +647,14 @@ mpt_print_request(void *vreq) } } -int +#if 0 +typedef struct mpt_decode_entry { + char *name; + u_int value; + u_int mask; +} mpt_decode_entry_t; + +static int mpt_decode_value(mpt_decode_entry_t *table, u_int num_entries, const char *name, u_int value, u_int *cur_column, u_int wrap_point) @@ -689,7 +706,7 @@ mpt_decode_value(mpt_decode_entry_t *tab return (printed); } -static mpt_decode_entry_t req_state_parse_table[] = { +static const mpt_decode_entry_t req_state_parse_table[] = { { "REQ_FREE", 0x00, 0xff }, { "REQ_ALLOCATED", 0x01, 0x01 }, { "REQ_QUEUED", 0x02, 0x02 }, @@ -698,13 +715,15 @@ static mpt_decode_entry_t req_state_pars { "REQ_NEED_WAKEUP", 0x10, 0x10 } }; -void +static void mpt_req_state(mpt_req_state_t state) { + mpt_decode_value(req_state_parse_table, NUM_ELEMENTS(req_state_parse_table), "REQ_STATE", state, NULL, 80); } +#endif #define LAST_SGE ( \ MPI_SGE_FLAGS_END_OF_LIST | \ @@ -805,6 +824,7 @@ mpt_dump_data(struct mpt_softc *mpt, con { int offset; uint8_t *cp = addr; + mpt_prt(mpt, "%s:", msg); for (offset = 0; offset < len; offset++) { if ((offset & 0xf) == 0) { @@ -820,6 +840,7 @@ mpt_dump_request(struct mpt_softc *mpt, { uint32_t *pReq = req->req_vbuf; int o; + #if __FreeBSD_version >= 500000 mpt_prt(mpt, "Send Request %d (%jx):", req->index, (uintmax_t) req->req_pbuf); @@ -850,6 +871,7 @@ mpt_lprt(struct mpt_softc *mpt, int leve } } +#if 0 void mpt_lprtc(struct mpt_softc *mpt, int level, const char *fmt, ...) { @@ -861,6 +883,7 @@ mpt_lprtc(struct mpt_softc *mpt, int lev } } #endif +#endif void mpt_prt(struct mpt_softc *mpt, const char *fmt, ...) Modified: stable/8/sys/dev/mpt/mpt_pci.c ============================================================================== --- stable/8/sys/dev/mpt/mpt_pci.c Sat Aug 13 12:29:50 2011 (r224817) +++ stable/8/sys/dev/mpt/mpt_pci.c Sat Aug 13 12:33:06 2011 (r224818) @@ -201,6 +201,9 @@ static int mpt_pci_shutdown(device_t); static int mpt_dma_mem_alloc(struct mpt_softc *mpt); static void mpt_dma_mem_free(struct mpt_softc *mpt); static void mpt_read_config_regs(struct mpt_softc *mpt); +#if 0 +static void mpt_set_config_regs(struct mpt_softc *mpt); +#endif static void mpt_pci_intr(void *); static device_method_t mpt_methods[] = { @@ -404,6 +407,7 @@ mpt_link_peer(struct mpt_softc *mpt) static void mpt_unlink_peer(struct mpt_softc *mpt) { + if (mpt->mpt2) { mpt->mpt2->mpt2 = NULL; } @@ -654,6 +658,7 @@ bad: static void mpt_free_bus_resources(struct mpt_softc *mpt) { + if (mpt->ih) { bus_teardown_intr(mpt->dev, mpt->pci_irq, mpt->ih); mpt->ih = NULL; @@ -827,6 +832,7 @@ mpt_dma_mem_free(struct mpt_softc *mpt) static void mpt_read_config_regs(struct mpt_softc *mpt) { + mpt->pci_cfg.Command = pci_read_config(mpt->dev, PCIR_COMMAND, 2); mpt->pci_cfg.LatencyTimer_LineSize = pci_read_config(mpt->dev, PCIR_CACHELNSZ, 2); @@ -840,8 +846,9 @@ mpt_read_config_regs(struct mpt_softc *m mpt->pci_cfg.PMCSR = pci_read_config(mpt->dev, 0x44, 4); } +#if 0 /* Sets modifiable config registers */ -void +static void mpt_set_config_regs(struct mpt_softc *mpt) { uint32_t val; @@ -880,6 +887,7 @@ mpt_set_config_regs(struct mpt_softc *mp pci_write_config(mpt->dev, PCIR_INTLINE, mpt->pci_cfg.IntLine, 1); pci_write_config(mpt->dev, 0x44, mpt->pci_cfg.PMCSR, 4); } +#endif static void mpt_pci_intr(void *arg) Modified: stable/8/sys/dev/mpt/mpt_raid.c ============================================================================== --- stable/8/sys/dev/mpt/mpt_raid.c Sat Aug 13 12:29:50 2011 (r224817) +++ stable/8/sys/dev/mpt/mpt_raid.c Sat Aug 13 12:33:06 2011 (r224818) @@ -81,7 +81,6 @@ struct mpt_raid_action_result #define REQ_IOCSTATUS(req) ((req)->IOCStatus & MPI_IOCSTATUS_MASK) - static mpt_probe_handler_t mpt_raid_probe; static mpt_attach_handler_t mpt_raid_attach; static mpt_enable_handler_t mpt_raid_enable; @@ -125,9 +124,25 @@ static void mpt_adjust_queue_depth(struc static void mpt_raid_sysctl_attach(struct mpt_softc *); #endif +static const char *mpt_vol_type(struct mpt_raid_volume *vol); +static const char *mpt_vol_state(struct mpt_raid_volume *vol); +static const char *mpt_disk_state(struct mpt_raid_disk *disk); +static void mpt_vol_prt(struct mpt_softc *mpt, struct mpt_raid_volume *vol, + const char *fmt, ...); +static void mpt_disk_prt(struct mpt_softc *mpt, struct mpt_raid_disk *disk, + const char *fmt, ...); + +static int mpt_issue_raid_req(struct mpt_softc *mpt, + struct mpt_raid_volume *vol, struct mpt_raid_disk *disk, request_t *req, + u_int Action, uint32_t ActionDataWord, bus_addr_t addr, bus_size_t len, + int write, int wait); + +static int mpt_refresh_raid_data(struct mpt_softc *mpt); +static void mpt_schedule_raid_refresh(struct mpt_softc *mpt); + static uint32_t raid_handler_id = MPT_HANDLER_ID_NONE; -const char * +static const char * mpt_vol_type(struct mpt_raid_volume *vol) { switch (vol->config_page->VolumeType) { @@ -142,7 +157,7 @@ mpt_vol_type(struct mpt_raid_volume *vol } } -const char * +static const char * mpt_vol_state(struct mpt_raid_volume *vol) { switch (vol->config_page->VolumeStatus.State) { @@ -157,7 +172,7 @@ mpt_vol_state(struct mpt_raid_volume *vo } } -const char * +static const char * mpt_disk_state(struct mpt_raid_disk *disk) { switch (disk->config_page.PhysDiskStatus.State) { @@ -182,7 +197,7 @@ mpt_disk_state(struct mpt_raid_disk *dis } } -void +static void mpt_vol_prt(struct mpt_softc *mpt, struct mpt_raid_volume *vol, const char *fmt, ...) { @@ -196,7 +211,7 @@ mpt_vol_prt(struct mpt_softc *mpt, struc va_end(ap); } -void +static void mpt_disk_prt(struct mpt_softc *mpt, struct mpt_raid_disk *disk, const char *fmt, ...) { @@ -254,16 +269,17 @@ mpt_raid_async(void *callback_arg, u_int } } -int +static int mpt_raid_probe(struct mpt_softc *mpt) { + if (mpt->ioc_page2 == NULL || mpt->ioc_page2->MaxPhysDisks == 0) { return (ENODEV); } return (0); } -int +static int mpt_raid_attach(struct mpt_softc *mpt) { struct ccb_setasync csa; @@ -307,13 +323,14 @@ cleanup: return (error); } -int +static int mpt_raid_enable(struct mpt_softc *mpt) { + return (0); } -void +static void mpt_raid_detach(struct mpt_softc *mpt) { struct ccb_setasync csa; @@ -338,6 +355,7 @@ mpt_raid_detach(struct mpt_softc *mpt) static void mpt_raid_ioc_reset(struct mpt_softc *mpt, int type) { + /* Nothing to do yet. */ } @@ -570,7 +588,7 @@ mpt_raid_reply_frame_handler(struct mpt_ /* * Utiltity routine to perform a RAID action command; */ -int +static int mpt_issue_raid_req(struct mpt_softc *mpt, struct mpt_raid_volume *vol, struct mpt_raid_disk *disk, request_t *req, u_int Action, uint32_t ActionDataWord, bus_addr_t addr, bus_size_t len, @@ -719,6 +737,7 @@ mpt_raid_thread(void *arg) static void mpt_raid_quiesce_timeout(void *arg) { + /* Complete the CCB with error */ /* COWWWW */ } @@ -776,7 +795,7 @@ mpt_raid_quiesce_disk(struct mpt_softc * /* XXX Ignores that there may be multiple busses/IOCs involved. */ cam_status -mpt_map_physdisk(struct mpt_softc *mpt, union ccb *ccb, u_int *tgt) +mpt_map_physdisk(struct mpt_softc *mpt, union ccb *ccb, target_id_t *tgt) { struct mpt_raid_disk *mpt_disk; @@ -793,7 +812,7 @@ mpt_map_physdisk(struct mpt_softc *mpt, /* XXX Ignores that there may be multiple busses/IOCs involved. */ int -mpt_is_raid_volume(struct mpt_softc *mpt, int tgt) +mpt_is_raid_volume(struct mpt_softc *mpt, target_id_t tgt) { CONFIG_PAGE_IOC_2_RAID_VOL *ioc_vol; CONFIG_PAGE_IOC_2_RAID_VOL *ioc_last_vol; @@ -1305,7 +1324,7 @@ mpt_refresh_raid_vol(struct mpt_softc *m * be updated by our event handler. Interesting changes are displayed * to the console. */ -int +static int mpt_refresh_raid_data(struct mpt_softc *mpt) { CONFIG_PAGE_IOC_2_RAID_VOL *ioc_vol; @@ -1565,9 +1584,10 @@ mpt_raid_timer(void *arg) #endif } -void +static void mpt_schedule_raid_refresh(struct mpt_softc *mpt) { + callout_reset(&mpt->raid_timer, MPT_RAID_SYNC_REPORT_INTERVAL, mpt_raid_timer, mpt); } @@ -1719,7 +1739,8 @@ mpt_raid_set_vol_mwce(struct mpt_softc * MPT_UNLOCK(mpt); return (0); } -const char *mpt_vol_mwce_strs[] = + +static const char *mpt_vol_mwce_strs[] = { "On", "Off", Modified: stable/8/sys/dev/mpt/mpt_raid.h ============================================================================== --- stable/8/sys/dev/mpt/mpt_raid.h Sat Aug 13 12:29:50 2011 (r224817) +++ stable/8/sys/dev/mpt/mpt_raid.h Sat Aug 13 12:33:06 2011 (r224818) @@ -53,29 +53,13 @@ typedef enum { MPT_RAID_MWCE_NC } mpt_raid_mwce_t; -const char *mpt_vol_type(struct mpt_raid_volume *); -const char *mpt_vol_state(struct mpt_raid_volume *); -const char *mpt_disk_state(struct mpt_raid_disk *); -void -mpt_vol_prt(struct mpt_softc *, struct mpt_raid_volume *, const char *fmt, ...); -void -mpt_disk_prt(struct mpt_softc *, struct mpt_raid_disk *, const char *, ...); - -int -mpt_issue_raid_req(struct mpt_softc *, struct mpt_raid_volume *, - struct mpt_raid_disk *, request_t *, u_int, uint32_t, bus_addr_t, - bus_size_t, int, int); - -cam_status -mpt_map_physdisk(struct mpt_softc *, union ccb *, target_id_t *); -int mpt_is_raid_volume(struct mpt_softc *, int); +cam_status mpt_map_physdisk(struct mpt_softc *, union ccb *, target_id_t *); +int mpt_is_raid_volume(struct mpt_softc *, target_id_t); #if 0 cam_status mpt_raid_quiesce_disk(struct mpt_softc *, struct mpt_raid_disk *, request_t *); #endif -int mpt_refresh_raid_data(struct mpt_softc *); -void mpt_schedule_raid_refresh(struct mpt_softc *); void mpt_raid_free_mem(struct mpt_softc *); static __inline void Modified: stable/8/sys/dev/mpt/mpt_user.c ============================================================================== --- stable/8/sys/dev/mpt/mpt_user.c Sat Aug 13 12:29:50 2011 (r224817) +++ stable/8/sys/dev/mpt/mpt_user.c Sat Aug 13 12:33:06 2011 (r224818) @@ -94,7 +94,7 @@ static MALLOC_DEFINE(M_MPTUSER, "mpt_use static uint32_t user_handler_id = MPT_HANDLER_ID_NONE; -int +static int mpt_user_probe(struct mpt_softc *mpt) { @@ -102,7 +102,7 @@ mpt_user_probe(struct mpt_softc *mpt) return (0); } -int +static int mpt_user_attach(struct mpt_softc *mpt) { mpt_handler_t handler; @@ -131,19 +131,20 @@ mpt_user_attach(struct mpt_softc *mpt) return (0); } -int +static int mpt_user_enable(struct mpt_softc *mpt) { return (0); } -void +static void mpt_user_ready(struct mpt_softc *mpt) { + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 12:37:23 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 418EA106564A; Sat, 13 Aug 2011 12:37:23 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F2BB8FC16; Sat, 13 Aug 2011 12:37:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DCbNa1015865; Sat, 13 Aug 2011 12:37:23 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DCbMn8015852; Sat, 13 Aug 2011 12:37:22 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108131237.p7DCbMn8015852@svn.freebsd.org> From: Marius Strobl Date: Sat, 13 Aug 2011 12:37:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224820 - in stable/8/sys/dev/mpt: . mpilib X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 12:37:23 -0000 Author: marius Date: Sat Aug 13 12:37:22 2011 New Revision: 224820 URL: http://svn.freebsd.org/changeset/base/224820 Log: MFC: r224494, r224761 - Send the RELSIM_ADJUST_OPENINGS in response to a MPI_EVENT_QUEUE_FULL using the right SIM in case the HBA is RAID-capable but the target in question is not a hot spare or member of a RAID volume. - Report the loss and addition of SAS and SATA targets detected via PHY link status changes and signalled by MPI_EVENT_SAS_DEVICE_STATUS_CHANGE to cam(4) as lost devices and trigger rescans as appropriate. Without this it can take quite some time until a lost device actually is no longer tried to be used, if it ever stops. [1] - Handle MPI_EVENT_IR2, MPI_EVENT_LOG_ENTRY_ADDED, MPI_EVENT_SAS_DISCOVERY and MPI_EVENT_SAS_PHY_LINK_STATUS silently as these serve no additional purpose beyond adding cryptic entries to logs. - Add a warning for MPI_EVENT_SAS_DISCOVERY_ERROR events, which can help identifying broken disks. [2] Thanks to Hans-Joerg Sirtl for providing one of the HBAs these changes were developed with and RIP to the mainboard that didn't survive testing them. PR: 157534 [1] Submitted by: Andrew Boyer [2] Modified: stable/8/sys/dev/mpt/mpilib/mpi_ioc.h stable/8/sys/dev/mpt/mpt_cam.c stable/8/sys/dev/mpt/mpt_raid.c stable/8/sys/dev/mpt/mpt_raid.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/mpt/mpilib/mpi_ioc.h ============================================================================== --- stable/8/sys/dev/mpt/mpilib/mpi_ioc.h Sat Aug 13 12:33:41 2011 (r224819) +++ stable/8/sys/dev/mpt/mpilib/mpi_ioc.h Sat Aug 13 12:37:22 2011 (r224820) @@ -33,7 +33,7 @@ * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages * Creation Date: August 11, 2000 * - * mpi_ioc.h Version: 01.05.14 + * mpi_ioc.h Version: 01.05.16 * * Version History * --------------- @@ -140,6 +140,16 @@ * added _MULTI_PORT_DOMAIN. * 05-24-07 01.05.14 Added Common Boot Block type to FWDownload Request. * Added Common Boot Block type to FWUpload Request. + * 08-07-07 01.05.15 Added MPI_EVENT_SAS_INIT_RC_REMOVED define. + * Added MPI_EVENT_IR2_RC_DUAL_PORT_ADDED and + * MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED for IR2 event data. + * Added SASAddress field to SAS Initiator Device Table + * Overflow event data structure. + * 03-28-08 01.05.16 Added two new ReasonCode values to SAS Device Status + * Change Event data to indicate completion of internally + * generated task management. + * Added MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE define. + * Added MPI_EVENT_SAS_INIT_RC_INACCESSIBLE define. * -------------------------------------------------------------------------- */ @@ -639,6 +649,8 @@ typedef struct _EVENT_DATA_SAS_DEVICE_ST #define MPI_EVENT_SAS_DEV_STAT_RC_CLEAR_TASK_SET_INTERNAL (0x0B) #define MPI_EVENT_SAS_DEV_STAT_RC_QUERY_TASK_INTERNAL (0x0C) #define MPI_EVENT_SAS_DEV_STAT_RC_ASYNC_NOTIFICATION (0x0D) +#define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_INTERNAL_DEV_RESET (0x0E) +#define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_TASK_ABORT_INTERNAL (0x0F) /* SCSI Event data for Queue Full event */ @@ -735,6 +747,8 @@ typedef struct _MPI_EVENT_DATA_IR2 #define MPI_EVENT_IR2_RC_PD_REMOVED (0x05) #define MPI_EVENT_IR2_RC_FOREIGN_CFG_DETECTED (0x06) #define MPI_EVENT_IR2_RC_REBUILD_MEDIUM_ERROR (0x07) +#define MPI_EVENT_IR2_RC_DUAL_PORT_ADDED (0x08) +#define MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED (0x09) /* defines for logical disk states */ #define MPI_LD_STATE_OPTIMAL (0x00) @@ -894,6 +908,7 @@ typedef struct _EVENT_DATA_DISCOVERY_ERR #define MPI_EVENT_DSCVRY_ERR_DS_UNSUPPORTED_DEVICE (0x00000800) #define MPI_EVENT_DSCVRY_ERR_DS_MAX_SATA_TARGETS (0x00001000) #define MPI_EVENT_DSCVRY_ERR_DS_MULTI_PORT_DOMAIN (0x00002000) +#define MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE (0x00004000) /* SAS SMP Error Event data */ @@ -929,6 +944,8 @@ typedef struct _EVENT_DATA_SAS_INIT_DEV_ /* defines for the ReasonCode field of the SAS Initiator Device Status Change event */ #define MPI_EVENT_SAS_INIT_RC_ADDED (0x01) +#define MPI_EVENT_SAS_INIT_RC_REMOVED (0x02) +#define MPI_EVENT_SAS_INIT_RC_INACCESSIBLE (0x03) /* SAS Initiator Device Table Overflow Event data */ @@ -937,6 +954,7 @@ typedef struct _EVENT_DATA_SAS_INIT_TABL U8 MaxInit; /* 00h */ U8 CurrentInit; /* 01h */ U16 Reserved1; /* 02h */ + U64 SASAddress; /* 04h */ } EVENT_DATA_SAS_INIT_TABLE_OVERFLOW, MPI_POINTER PTR_EVENT_DATA_SAS_INIT_TABLE_OVERFLOW, MpiEventDataSasInitTableOverflow_t, Modified: stable/8/sys/dev/mpt/mpt_cam.c ============================================================================== --- stable/8/sys/dev/mpt/mpt_cam.c Sat Aug 13 12:33:41 2011 (r224819) +++ stable/8/sys/dev/mpt/mpt_cam.c Sat Aug 13 12:37:22 2011 (r224820) @@ -2538,7 +2538,8 @@ mpt_cam_event(struct mpt_softc *mpt, req pqf->CurrentDepth = le16toh(pqf->CurrentDepth); mpt_prt(mpt, "QUEUE FULL EVENT: Bus 0x%02x Target 0x%02x Depth " "%d\n", pqf->Bus, pqf->TargetID, pqf->CurrentDepth); - if (mpt->phydisk_sim) { + if (mpt->phydisk_sim && mpt_is_raid_member(mpt, + pqf->TargetID) != 0) { sim = mpt->phydisk_sim; } else { sim = mpt->sim; @@ -2570,9 +2571,85 @@ mpt_cam_event(struct mpt_softc *mpt, req mpt_prt(mpt, "IR resync update %d completed\n", (data0 >> 16) & 0xff); break; + case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: + { + union ccb *ccb; + struct cam_sim *sim; + struct cam_path *tmppath; + PTR_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE psdsc; + + psdsc = (PTR_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE)msg->Data; + if (mpt->phydisk_sim && mpt_is_raid_member(mpt, + psdsc->TargetID) != 0) + sim = mpt->phydisk_sim; + else + sim = mpt->sim; + switch(psdsc->ReasonCode) { + case MPI_EVENT_SAS_DEV_STAT_RC_ADDED: + MPTLOCK_2_CAMLOCK(mpt); + ccb = xpt_alloc_ccb_nowait(); + if (ccb == NULL) { + mpt_prt(mpt, + "unable to alloc CCB for rescan\n"); + CAMLOCK_2_MPTLOCK(mpt); + break; + } + if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, + cam_sim_path(sim), psdsc->TargetID, + CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + CAMLOCK_2_MPTLOCK(mpt); + mpt_prt(mpt, + "unable to create path for rescan\n"); + xpt_free_ccb(ccb); + break; + } + xpt_rescan(ccb); + CAMLOCK_2_MPTLOCK(mpt); + break; + case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING: + MPTLOCK_2_CAMLOCK(mpt); + if (xpt_create_path(&tmppath, NULL, cam_sim_path(sim), + psdsc->TargetID, CAM_LUN_WILDCARD) != + CAM_REQ_CMP) { + mpt_prt(mpt, + "unable to create path for async event"); + CAMLOCK_2_MPTLOCK(mpt); + break; + } + xpt_async(AC_LOST_DEVICE, tmppath, NULL); + xpt_free_path(tmppath); + CAMLOCK_2_MPTLOCK(mpt); + break; + case MPI_EVENT_SAS_DEV_STAT_RC_CMPL_INTERNAL_DEV_RESET: + case MPI_EVENT_SAS_DEV_STAT_RC_CMPL_TASK_ABORT_INTERNAL: + case MPI_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET: + break; + default: + mpt_lprt(mpt, MPT_PRT_WARN, + "SAS device status change: Bus: 0x%02x TargetID: " + "0x%02x ReasonCode: 0x%02x\n", psdsc->Bus, + psdsc->TargetID, psdsc->ReasonCode); + break; + } + break; + } + case MPI_EVENT_SAS_DISCOVERY_ERROR: + { + PTR_EVENT_DATA_DISCOVERY_ERROR pde; + + pde = (PTR_EVENT_DATA_DISCOVERY_ERROR)msg->Data; + pde->DiscoveryStatus = le32toh(pde->DiscoveryStatus); + mpt_lprt(mpt, MPT_PRT_WARN, + "SAS discovery error: Port: 0x%02x Status: 0x%08x\n", + pde->Port, pde->DiscoveryStatus); + break; + } case MPI_EVENT_EVENT_CHANGE: case MPI_EVENT_INTEGRATED_RAID: - case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: + case MPI_EVENT_IR2: + case MPI_EVENT_LOG_ENTRY_ADDED: + case MPI_EVENT_SAS_DISCOVERY: + case MPI_EVENT_SAS_PHY_LINK_STATUS: case MPI_EVENT_SAS_SES: break; default: Modified: stable/8/sys/dev/mpt/mpt_raid.c ============================================================================== --- stable/8/sys/dev/mpt/mpt_raid.c Sat Aug 13 12:33:41 2011 (r224819) +++ stable/8/sys/dev/mpt/mpt_raid.c Sat Aug 13 12:37:22 2011 (r224820) @@ -812,6 +812,25 @@ mpt_map_physdisk(struct mpt_softc *mpt, /* XXX Ignores that there may be multiple busses/IOCs involved. */ int +mpt_is_raid_member(struct mpt_softc *mpt, target_id_t tgt) +{ + struct mpt_raid_disk *mpt_disk; + int i; + + if (mpt->ioc_page2 == NULL || mpt->ioc_page2->MaxPhysDisks == 0) + return (0); + for (i = 0; i < mpt->ioc_page2->MaxPhysDisks; i++) { + mpt_disk = &mpt->raid_disks[i]; + if ((mpt_disk->flags & MPT_RDF_ACTIVE) != 0 && + mpt_disk->config_page.PhysDiskID == tgt) + return (1); + } + return (0); + +} + +/* XXX Ignores that there may be multiple busses/IOCs involved. */ +int mpt_is_raid_volume(struct mpt_softc *mpt, target_id_t tgt) { CONFIG_PAGE_IOC_2_RAID_VOL *ioc_vol; Modified: stable/8/sys/dev/mpt/mpt_raid.h ============================================================================== --- stable/8/sys/dev/mpt/mpt_raid.h Sat Aug 13 12:33:41 2011 (r224819) +++ stable/8/sys/dev/mpt/mpt_raid.h Sat Aug 13 12:37:22 2011 (r224820) @@ -54,6 +54,7 @@ typedef enum { } mpt_raid_mwce_t; cam_status mpt_map_physdisk(struct mpt_softc *, union ccb *, target_id_t *); +int mpt_is_raid_member(struct mpt_softc *, target_id_t); int mpt_is_raid_volume(struct mpt_softc *, target_id_t); #if 0 cam_status From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 12:43:33 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 718BD1065672; Sat, 13 Aug 2011 12:43:33 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FF6C8FC14; Sat, 13 Aug 2011 12:43:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DChXj2016145; Sat, 13 Aug 2011 12:43:33 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DChXsN016143; Sat, 13 Aug 2011 12:43:33 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108131243.p7DChXsN016143@svn.freebsd.org> From: Marius Strobl Date: Sat, 13 Aug 2011 12:43:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224822 - stable/8/sys/sparc64/sparc64 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 12:43:33 -0000 Author: marius Date: Sat Aug 13 12:43:33 2011 New Revision: 224822 URL: http://svn.freebsd.org/changeset/base/224822 Log: MFC: r224682 - Merge from r147740: When the last, possibly partially filled buffer is flushed, we didn't reset fragsz to 0 and as such would stop reflecting reality. - Use __FBSDID. - Wrap a too long line. Modified: stable/8/sys/sparc64/sparc64/dump_machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/sparc64/sparc64/dump_machdep.c ============================================================================== --- stable/8/sys/sparc64/sparc64/dump_machdep.c Sat Aug 13 12:37:23 2011 (r224821) +++ stable/8/sys/sparc64/sparc64/dump_machdep.c Sat Aug 13 12:43:33 2011 (r224822) @@ -23,10 +23,11 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (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$ */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include @@ -92,6 +93,7 @@ buf_flush(struct dumperinfo *di) error = dump_write(di, buffer, 0, dumplo, DEV_BSIZE); dumplo += DEV_BSIZE; + fragsz = 0; return (error); } @@ -169,7 +171,8 @@ dumpsys(struct dumperinfo *di) /* Determine dump offset on device. */ dumplo = di->mediaoffset + di->mediasize - totsize; - mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_SPARC64_VERSION, size, di->blocksize); + mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_SPARC64_VERSION, size, + di->blocksize); printf("Dumping %lu MB (%d chunks)\n", (u_long)(size >> 20), nreg); From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 12:47:09 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A8E7106564A; Sat, 13 Aug 2011 12:47:09 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FA298FC08; Sat, 13 Aug 2011 12:47:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DCl9F4016381; Sat, 13 Aug 2011 12:47:09 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DCl9l2016379; Sat, 13 Aug 2011 12:47:09 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108131247.p7DCl9l2016379@svn.freebsd.org> From: Marius Strobl Date: Sat, 13 Aug 2011 12:47:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224824 - stable/8/lib/libthread_db X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 12:47:09 -0000 Author: marius Date: Sat Aug 13 12:47:09 2011 New Revision: 224824 URL: http://svn.freebsd.org/changeset/base/224824 Log: MFC: r224683, r224693 The tid member of struct pthread actually is long so read it as such. Accessing it as an int causes failure on big-endian LP64, i.e. mips64be, powerpc64 and sparc64. Reviewed by: marcel Modified: stable/8/lib/libthread_db/libthr_db.c Directory Properties: stable/8/lib/libthread_db/ (props changed) Modified: stable/8/lib/libthread_db/libthr_db.c ============================================================================== --- stable/8/lib/libthread_db/libthr_db.c Sat Aug 13 12:43:35 2011 (r224823) +++ stable/8/lib/libthread_db/libthr_db.c Sat Aug 13 12:47:09 2011 (r224824) @@ -202,7 +202,7 @@ static td_err_e pt_ta_map_id2thr(const td_thragent_t *ta, thread_t id, td_thrhandle_t *th) { psaddr_t pt; - int32_t lwp; + int64_t lwp; int ret; TDBG_FUNC(); @@ -214,7 +214,7 @@ pt_ta_map_id2thr(const td_thragent_t *ta return (TD_ERR); /* Iterate through thread list to find pthread */ while (pt != 0) { - ret = thr_pread_int(ta, pt + ta->thread_off_tid, &lwp); + ret = thr_pread_long(ta, pt + ta->thread_off_tid, &lwp); if (ret != 0) return (TD_ERR); if (lwp == id) @@ -245,7 +245,7 @@ pt_ta_thr_iter(const td_thragent_t *ta, { td_thrhandle_t th; psaddr_t pt; - int32_t lwp; + int64_t lwp; int ret; TDBG_FUNC(); @@ -254,7 +254,7 @@ pt_ta_thr_iter(const td_thragent_t *ta, if (ret != 0) return (TD_ERR); while (pt != 0) { - ret = thr_pread_int(ta, pt + ta->thread_off_tid, &lwp); + ret = thr_pread_long(ta, pt + ta->thread_off_tid, &lwp); if (ret != 0) return (TD_ERR); if (lwp != 0 && lwp != TERMINATED) { @@ -368,7 +368,7 @@ pt_ta_event_getmsg(const td_thragent_t * psaddr_t pt; td_thr_events_e tmp; - int32_t lwp; + int64_t lwp; int ret; TDBG_FUNC(); @@ -395,7 +395,7 @@ pt_ta_event_getmsg(const td_thragent_t * ps_pwrite(ta->ph, pt + ta->thread_off_event_buf, &tmp, sizeof(tmp)); /* Convert event */ pt = msg->th_p; - ret = thr_pread_int(ta, pt + ta->thread_off_tid, &lwp); + ret = thr_pread_long(ta, pt + ta->thread_off_tid, &lwp); if (ret != 0) return (TD_ERR); handle.th_ta = ta; @@ -672,7 +672,7 @@ pt_thr_event_getmsg(const td_thrhandle_t static td_thrhandle_t handle; const td_thragent_t *ta = th->th_ta; psaddr_t pt, pt_temp; - int32_t lwp; + int64_t lwp; int ret; td_thr_events_e tmp; @@ -699,7 +699,7 @@ pt_thr_event_getmsg(const td_thrhandle_t ps_pwrite(ta->ph, pt + ta->thread_off_event_buf, &tmp, sizeof(tmp)); /* Convert event */ pt = msg->th_p; - ret = thr_pread_int(ta, pt + ta->thread_off_tid, &lwp); + ret = thr_pread_long(ta, pt + ta->thread_off_tid, &lwp); if (ret != 0) return (TD_ERR); handle.th_ta = ta; From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 12:49:01 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32CF9106566B; Sat, 13 Aug 2011 12:49:01 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 214E68FC16; Sat, 13 Aug 2011 12:49:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DCn1ui016529; Sat, 13 Aug 2011 12:49:01 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DCn1O5016527; Sat, 13 Aug 2011 12:49:01 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108131249.p7DCn1O5016527@svn.freebsd.org> From: Marius Strobl Date: Sat, 13 Aug 2011 12:49:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224826 - stable/8/lib/libthread_db/arch/amd64 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 12:49:01 -0000 Author: marius Date: Sat Aug 13 12:49:00 2011 New Revision: 224826 URL: http://svn.freebsd.org/changeset/base/224826 Log: MFC: r224684 Use the size of struct fpreg rather than of the pointer to it when copying the FPU state. Reviewed by: marcel Modified: stable/8/lib/libthread_db/arch/amd64/libpthread_md.c Directory Properties: stable/8/lib/libthread_db/ (props changed) Modified: stable/8/lib/libthread_db/arch/amd64/libpthread_md.c ============================================================================== --- stable/8/lib/libthread_db/arch/amd64/libpthread_md.c Sat Aug 13 12:47:10 2011 (r224825) +++ stable/8/lib/libthread_db/arch/amd64/libpthread_md.c Sat Aug 13 12:49:00 2011 (r224826) @@ -92,18 +92,21 @@ pt_ucontext_to_reg(const ucontext_t *uc, void pt_fpreg_to_ucontext(const struct fpreg* r, ucontext_t *uc) { - memcpy(&uc->uc_mcontext.mc_fpstate, r, sizeof(r)); + + memcpy(&uc->uc_mcontext.mc_fpstate, r, sizeof(*r)); } void pt_ucontext_to_fpreg(const ucontext_t *uc, struct fpreg *r) { - memcpy(r, &uc->uc_mcontext.mc_fpstate, sizeof(r)); + + memcpy(r, &uc->uc_mcontext.mc_fpstate, sizeof(*r)); } void pt_md_init(void) { + /* Nothing to do */ } From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 12:50:39 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E18E106564A; Sat, 13 Aug 2011 12:50:39 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D73C98FC15; Sat, 13 Aug 2011 12:50:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DCocum016684; Sat, 13 Aug 2011 12:50:38 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DCocV8016682; Sat, 13 Aug 2011 12:50:38 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108131250.p7DCocV8016682@svn.freebsd.org> From: Marius Strobl Date: Sat, 13 Aug 2011 12:50:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224828 - stable/8/lib/libthread_db/arch/sparc64 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 12:50:39 -0000 Author: marius Date: Sat Aug 13 12:50:38 2011 New Revision: 224828 URL: http://svn.freebsd.org/changeset/base/224828 Log: MFC: r224685 Implement Reviewed by: marcel Modified: stable/8/lib/libthread_db/arch/sparc64/libpthread_md.c Directory Properties: stable/8/lib/libthread_db/ (props changed) Modified: stable/8/lib/libthread_db/arch/sparc64/libpthread_md.c ============================================================================== --- stable/8/lib/libthread_db/arch/sparc64/libpthread_md.c Sat Aug 13 12:49:02 2011 (r224827) +++ stable/8/lib/libthread_db/arch/sparc64/libpthread_md.c Sat Aug 13 12:50:38 2011 (r224828) @@ -1,5 +1,6 @@ /* * Copyright (c) 2004 Marcel Moolenaar + * Copyright (c) 2011 Marius Strobl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,39 +28,63 @@ #include __FBSDID("$FreeBSD$"); -#include +#include +#include #include #include +#include #include "libpthread_db.h" void -pt_reg_to_ucontext(const struct reg *r __unused, ucontext_t *uc __unused) +pt_reg_to_ucontext(const struct reg *r, ucontext_t *uc) { + + memcpy(&uc->uc_mcontext, r, MIN(sizeof(uc->uc_mcontext), sizeof(*r))); } void -pt_ucontext_to_reg(const ucontext_t *uc __unused, struct reg *r __unused) +pt_ucontext_to_reg(const ucontext_t *uc, struct reg *r) { + + memcpy(r, &uc->uc_mcontext, MIN(sizeof(uc->uc_mcontext), sizeof(*r))); } void -pt_fpreg_to_ucontext(const struct fpreg* r __unused, ucontext_t *uc __unused) +pt_fpreg_to_ucontext(const struct fpreg* r, ucontext_t *uc) { + mcontext_t *mc = &uc->uc_mcontext; + + memcpy(mc->mc_fp, r->fr_regs, MIN(sizeof(mc->mc_fp), + sizeof(r->fr_regs))); + mc->mc_fsr = r->fr_fsr; + mc->mc_gsr = r->fr_gsr; + mc->mc_fprs |= FPRS_FEF; } void -pt_ucontext_to_fpreg(const ucontext_t *uc __unused, struct fpreg *r __unused) +pt_ucontext_to_fpreg(const ucontext_t *uc, struct fpreg *r) { + const mcontext_t *mc = &uc->uc_mcontext; + + if ((mc->mc_fprs & FPRS_FEF) != 0) { + memcpy(r->fr_regs, mc->mc_fp, MIN(sizeof(mc->mc_fp), + sizeof(r->fr_regs))); + r->fr_fsr = mc->mc_fsr; + r->fr_gsr = mc->mc_gsr; + } else + memset(r, 0, sizeof(*r)); } void pt_md_init(void) { + } int pt_reg_sstep(struct reg *reg __unused, int step __unused) { + return (0); } From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 12:57:48 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA42D106564A; Sat, 13 Aug 2011 12:57:48 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF4568FC16; Sat, 13 Aug 2011 12:57:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DCvmrY016985; Sat, 13 Aug 2011 12:57:48 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DCvmWH016982; Sat, 13 Aug 2011 12:57:48 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108131257.p7DCvmWH016982@svn.freebsd.org> From: Marius Strobl Date: Sat, 13 Aug 2011 12:57:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224830 - in stable/8/contrib/gdb: . gdb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 12:57:49 -0000 Author: marius Date: Sat Aug 13 12:57:48 2011 New Revision: 224830 URL: http://svn.freebsd.org/changeset/base/224830 Log: MFC: r224686 Implement functions necessary for compiling fbsd-threads.c. Reviewed by: marcel Modified: stable/8/contrib/gdb/FREEBSD-diffs stable/8/contrib/gdb/gdb/sparc64fbsd-tdep.c Directory Properties: stable/8/contrib/gdb/ (props changed) Modified: stable/8/contrib/gdb/FREEBSD-diffs ============================================================================== --- stable/8/contrib/gdb/FREEBSD-diffs Sat Aug 13 12:50:39 2011 (r224829) +++ stable/8/contrib/gdb/FREEBSD-diffs Sat Aug 13 12:57:48 2011 (r224830) @@ -927,3 +927,39 @@ diff -N gdb/config/ia64/tm-fbsd.h +#include "ia64/tm-ia64.h" + +#endif /* TM_FBSD_H */ +Index: gdb/sparc64fbsd-tdep.c +=================================================================== +--- gdb/sparc64fbsd-tdep.c (revision 223862) ++++ gdb/sparc64fbsd-tdep.c (working copy) +@@ -64,6 +64,31 @@ sparc64fbsd_supply_fpregset (const struct regset * + { + sparc64_supply_fpregset (regcache, regnum, fpregs); + } ++ ++void ++supply_gregset (const void *gregs) ++{ ++ sparc64_supply_gregset (&sparc64fbsd_gregset, current_regcache, -1, gregs); ++} ++ ++void ++supply_fpregset (const void *fpregs) ++{ ++ sparc64_supply_fpregset (current_regcache, -1, fpregs); ++} ++ ++void ++fill_gregset (void *gregs, int regnum) ++{ ++ sparc64_collect_gregset (&sparc64fbsd_gregset, current_regcache, regnum, ++ gregs); ++} ++ ++void ++fill_fpregset (void *fpregs, int regnum) ++{ ++ sparc64_collect_fpregset (current_regcache, regnum, fpregs); ++} + + + /* Signal trampolines. */ Modified: stable/8/contrib/gdb/gdb/sparc64fbsd-tdep.c ============================================================================== --- stable/8/contrib/gdb/gdb/sparc64fbsd-tdep.c Sat Aug 13 12:50:39 2011 (r224829) +++ stable/8/contrib/gdb/gdb/sparc64fbsd-tdep.c Sat Aug 13 12:57:48 2011 (r224830) @@ -64,6 +64,31 @@ sparc64fbsd_supply_fpregset (const struc { sparc64_supply_fpregset (regcache, regnum, fpregs); } + +void +supply_gregset (const void *gregs) +{ + sparc64_supply_gregset (&sparc64fbsd_gregset, current_regcache, -1, gregs); +} + +void +supply_fpregset (const void *fpregs) +{ + sparc64_supply_fpregset (current_regcache, -1, fpregs); +} + +void +fill_gregset (void *gregs, int regnum) +{ + sparc64_collect_gregset (&sparc64fbsd_gregset, current_regcache, regnum, + gregs); +} + +void +fill_fpregset (void *fpregs, int regnum) +{ + sparc64_collect_fpregset (current_regcache, regnum, fpregs); +} /* Signal trampolines. */ From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 13:09:44 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3EB13106564A; Sat, 13 Aug 2011 13:09:44 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D1B58FC0A; Sat, 13 Aug 2011 13:09:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DD9iJG017457; Sat, 13 Aug 2011 13:09:44 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DD9i0n017454; Sat, 13 Aug 2011 13:09:44 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108131309.p7DD9i0n017454@svn.freebsd.org> From: Marius Strobl Date: Sat, 13 Aug 2011 13:09:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224832 - stable/8/gnu/usr.bin/gdb/arch/sparc64 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 13:09:44 -0000 Author: marius Date: Sat Aug 13 13:09:43 2011 New Revision: 224832 URL: http://svn.freebsd.org/changeset/base/224832 Log: MFC: r224687 Compile fbsd-threads.c. Amongst others this is necessary for a working kgdb(1). PR: 158719 Reviewed by: marcel Modified: stable/8/gnu/usr.bin/gdb/arch/sparc64/Makefile stable/8/gnu/usr.bin/gdb/arch/sparc64/init.c Directory Properties: stable/8/gnu/usr.bin/gdb/arch/sparc64/ (props changed) Modified: stable/8/gnu/usr.bin/gdb/arch/sparc64/Makefile ============================================================================== --- stable/8/gnu/usr.bin/gdb/arch/sparc64/Makefile Sat Aug 13 12:57:51 2011 (r224831) +++ stable/8/gnu/usr.bin/gdb/arch/sparc64/Makefile Sat Aug 13 13:09:43 2011 (r224832) @@ -1,6 +1,7 @@ # $FreeBSD$ .if !defined(GDB_CROSS_DEBUGGER) +LIBSRCS+= fbsd-threads.c LIBSRCS+= solib.c solib-legacy.c solib-svr4.c LIBSRCS+= sparc-nat.c sparc64-nat.c sparc64fbsd-nat.c .endif Modified: stable/8/gnu/usr.bin/gdb/arch/sparc64/init.c ============================================================================== --- stable/8/gnu/usr.bin/gdb/arch/sparc64/init.c Sat Aug 13 12:57:51 2011 (r224831) +++ stable/8/gnu/usr.bin/gdb/arch/sparc64/init.c Sat Aug 13 13:09:43 2011 (r224832) @@ -11,6 +11,7 @@ extern initialize_file_ftype _initialize extern initialize_file_ftype _initialize_ser_hardwire; extern initialize_file_ftype _initialize_ser_pipe; extern initialize_file_ftype _initialize_ser_tcp; +extern initialize_file_ftype _initialize_thread_db; extern initialize_file_ftype _initialize_sparc64fbsd_nat; extern initialize_file_ftype _initialize_sparc64_nat; extern initialize_file_ftype _initialize_sparc_nat; @@ -124,6 +125,7 @@ initialize_all_files (void) _initialize_ser_pipe (); _initialize_ser_tcp (); #ifndef CROSS_DEBUGGER + _initialize_thread_db (); _initialize_sparc64fbsd_nat (); _initialize_sparc64_nat (); _initialize_sparc_nat (); From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 13:15:28 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E9531065670; Sat, 13 Aug 2011 13:15:28 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFDA38FC1A; Sat, 13 Aug 2011 13:15:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DDFRW3017821; Sat, 13 Aug 2011 13:15:27 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DDFRSc017814; Sat, 13 Aug 2011 13:15:27 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108131315.p7DDFRSc017814@svn.freebsd.org> From: Marius Strobl Date: Sat, 13 Aug 2011 13:15:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224835 - in stable/8/usr.sbin/makefs: . cd9660 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 13:15:28 -0000 Author: marius Date: Sat Aug 13 13:15:27 2011 New Revision: 224835 URL: http://svn.freebsd.org/changeset/base/224835 Log: MFC: r224762 Sync makefs(8) ISO 9660 support with NetBSD: o cd9960 -> cd9660 o Move inclusion of sys/endian.h from cd9660_eltorito.c to cd9660.h since actual user is not cd9660_eltorito.c but iso.h and cd9660_eltorito.h. Actually, include order/place of sys/endian.h doesn't matter on netbsd since it is always included by sys/types.h but it's not true on other system. This should fix cross build breakage on freebsd introduced by rev. 1.16 of cd9660_eltorito.c. Problem reported and fix suggested on twitter. o Fix fd leaks in error cases. Found by cppcheck. o RRIP RE length should be 4, not 0 o Apply fixes for PR bin/44114 (makefs(8) -t cd9660 -o rockridge creates corrupted cd9660fs), iso9660_rrip.c part: - cd9660_rrip_finalize_node() should check rr_real_parent in node->parent, not in node itself in RRIP_PL case - cd9660_rrip_initialize_node() should update only node passed as arg so handle RRIP_PL in DOTDOT case Fixes malformed dotdot entries in deep (more than 8 level) directories moved into .rr_moved dir. Should be pulled up to netbsd-5. (no official ISO has such deep dirs, but cobalt restorecd is affected) Reviewed by: mm Obtained from: NetBSD Modified: stable/8/usr.sbin/makefs/cd9660.c stable/8/usr.sbin/makefs/cd9660.h stable/8/usr.sbin/makefs/cd9660/cd9660_conversion.c stable/8/usr.sbin/makefs/cd9660/cd9660_eltorito.c stable/8/usr.sbin/makefs/cd9660/cd9660_write.c stable/8/usr.sbin/makefs/cd9660/iso9660_rrip.c Directory Properties: stable/8/usr.sbin/makefs/ (props changed) Modified: stable/8/usr.sbin/makefs/cd9660.c ============================================================================== --- stable/8/usr.sbin/makefs/cd9660.c Sat Aug 13 13:11:28 2011 (r224834) +++ stable/8/usr.sbin/makefs/cd9660.c Sat Aug 13 13:15:27 2011 (r224835) @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660.c,v 1.27 2010/10/27 18:51:34 christos Exp $ */ +/* $NetBSD: cd9660.c,v 1.31 2011/08/06 23:25:19 christos Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -127,7 +127,7 @@ static int cd9660_setup_volume_descripto static int cd9660_fill_extended_attribute_record(cd9660node *); #endif static void cd9660_sort_nodes(cd9660node *); -static int cd9960_translate_node_common(cd9660node *); +static int cd9660_translate_node_common(cd9660node *); static int cd9660_translate_node(fsnode *, cd9660node *); static int cd9660_compare_filename(const char *, const char *); static void cd9660_sorted_child_insert(cd9660node *, cd9660node *); @@ -809,7 +809,7 @@ cd9660_fill_extended_attribute_record(cd #endif static int -cd9960_translate_node_common(cd9660node *newnode) +cd9660_translate_node_common(cd9660node *newnode) { time_t tim; int test; @@ -846,7 +846,7 @@ cd9960_translate_node_common(cd9660node } /* - * Translate fsnode to cd9960node + * Translate fsnode to cd9660node * Translate filenames and other metadata, including dates, sizes, * permissions, etc * @param struct fsnode * The node generated by makefs @@ -875,7 +875,7 @@ cd9660_translate_node(fsnode *node, cd96 if (!(S_ISDIR(node->type))) newnode->fileDataLength = node->inode->st.st_size; - if (cd9960_translate_node_common(newnode) == 0) + if (cd9660_translate_node_common(newnode) == 0) return 0; /* Finally, overwrite some of the values that are set by default */ @@ -2042,7 +2042,7 @@ cd9660_create_file(const char * name, cd return NULL; *temp->node->inode = *me->node->inode; - if (cd9960_translate_node_common(temp) == 0) + if (cd9660_translate_node_common(temp) == 0) return NULL; return temp; } @@ -2069,7 +2069,7 @@ cd9660_create_directory(const char *name return NULL; *temp->node->inode = *me->node->inode; - if (cd9960_translate_node_common(temp) == 0) + if (cd9660_translate_node_common(temp) == 0) return NULL; return temp; } Modified: stable/8/usr.sbin/makefs/cd9660.h ============================================================================== --- stable/8/usr.sbin/makefs/cd9660.h Sat Aug 13 13:11:28 2011 (r224834) +++ stable/8/usr.sbin/makefs/cd9660.h Sat Aug 13 13:15:27 2011 (r224835) @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660.h,v 1.15 2010/10/27 18:51:34 christos Exp $ */ +/* $NetBSD: cd9660.h,v 1.17 2011/06/23 02:35:56 enami Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -50,6 +50,7 @@ #include #include #include +#include #include "makefs.h" #include "iso.h" Modified: stable/8/usr.sbin/makefs/cd9660/cd9660_conversion.c ============================================================================== --- stable/8/usr.sbin/makefs/cd9660/cd9660_conversion.c Sat Aug 13 13:11:28 2011 (r224834) +++ stable/8/usr.sbin/makefs/cd9660/cd9660_conversion.c Sat Aug 13 13:15:27 2011 (r224835) @@ -36,8 +36,6 @@ #include __FBSDID("$FreeBSD$"); -#include - static char cd9660_compute_gm_offset(time_t); #if 0 Modified: stable/8/usr.sbin/makefs/cd9660/cd9660_eltorito.c ============================================================================== --- stable/8/usr.sbin/makefs/cd9660/cd9660_eltorito.c Sat Aug 13 13:11:28 2011 (r224834) +++ stable/8/usr.sbin/makefs/cd9660/cd9660_eltorito.c Sat Aug 13 13:15:27 2011 (r224835) @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660_eltorito.c,v 1.14 2010/10/27 18:51:35 christos Exp $ */ +/* $NetBSD: cd9660_eltorito.c,v 1.17 2011/06/23 02:35:56 enami Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -32,8 +32,6 @@ * OF SUCH DAMAGE. */ -#include - #include "cd9660.h" #include "cd9660_eltorito.h" @@ -501,13 +499,14 @@ cd9660_setup_boot_volume_descriptor(volu } static int -cd9660_write_mbr_partition_entry(FILE *fd, int index, off_t sector_start, +cd9660_write_mbr_partition_entry(FILE *fd, int idx, off_t sector_start, off_t nsectors, int type) { uint8_t val; uint32_t lba; - fseeko(fd, (off_t)(index) * 16 + 0x1be, SEEK_SET); + if (fseeko(fd, (off_t)(idx) * 16 + 0x1be, SEEK_SET) == -1) + err(1, "fseeko"); val = 0x80; /* Bootable */ fwrite(&val, sizeof(val), 1, fd); @@ -531,18 +530,19 @@ cd9660_write_mbr_partition_entry(FILE *f lba = htole32(nsectors); fwrite(&lba, sizeof(lba), 1, fd); - return (0); + return 0; } static int -cd9660_write_apm_partition_entry(FILE *fd, int index, int total_partitions, +cd9660_write_apm_partition_entry(FILE *fd, int idx, int total_partitions, off_t sector_start, off_t nsectors, off_t sector_size, const char *part_name, const char *part_type) { uint32_t apm32; uint16_t apm16; - fseeko(fd, (off_t)(index + 1) * sector_size, SEEK_SET); + if (fseeko(fd, (off_t)(idx + 1) * sector_size, SEEK_SET) == -1) + err(1, "fseeko"); /* Signature */ apm16 = htobe16(0x504d); Modified: stable/8/usr.sbin/makefs/cd9660/cd9660_write.c ============================================================================== --- stable/8/usr.sbin/makefs/cd9660/cd9660_write.c Sat Aug 13 13:11:28 2011 (r224834) +++ stable/8/usr.sbin/makefs/cd9660/cd9660_write.c Sat Aug 13 13:15:27 2011 (r224835) @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660_write.c,v 1.13 2010/10/22 00:49:15 christos Exp $ */ +/* $NetBSD: cd9660_write.c,v 1.14 2011/01/04 09:48:21 wiz Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -458,6 +458,7 @@ cd9660_copy_file(FILE *fd, off_t start_s if (ferror(rf)) { warn("%s: fread", __func__); free(buf); + (void)fclose(rf); return 0; } @@ -465,6 +466,7 @@ cd9660_copy_file(FILE *fd, off_t start_s if (ferror(fd)) { warn("%s: fwrite", __func__); free(buf); + (void)fclose(rf); return 0; } sector++; Modified: stable/8/usr.sbin/makefs/cd9660/iso9660_rrip.c ============================================================================== --- stable/8/usr.sbin/makefs/cd9660/iso9660_rrip.c Sat Aug 13 13:11:28 2011 (r224834) +++ stable/8/usr.sbin/makefs/cd9660/iso9660_rrip.c Sat Aug 13 13:15:27 2011 (r224835) @@ -1,4 +1,4 @@ -/* $NetBSD: iso9660_rrip.c,v 1.8 2009/01/10 22:06:29 bjh21 Exp $ */ +/* $NetBSD: iso9660_rrip.c,v 1.10 2011/05/29 17:07:58 tsutsui Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -183,10 +183,11 @@ cd9660_rrip_finalize_node(cd9660node *no break; case SUSP_ENTRY_RRIP_PL: /* Look at rr_real_parent */ - if (node->rr_real_parent == NULL) + if (node->parent == NULL || + node->parent->rr_real_parent == NULL) return -1; cd9660_bothendian_dword( - node->rr_real_parent->fileDataSector, + node->parent->rr_real_parent->fileDataSector, (unsigned char *) t->attr.rr_entry.PL.dir_loc); break; @@ -396,6 +397,13 @@ cd9660_rrip_initialize_node(cd9660node * cd9660node_rrip_px(current, grandparent->node); TAILQ_INSERT_TAIL(&node->head, current, rr_ll); } + /* Handle PL */ + if (parent != NULL && parent->rr_real_parent != NULL) { + current = cd9660node_susp_create_node(SUSP_TYPE_RRIP, + SUSP_ENTRY_RRIP_PL, "PL", SUSP_LOC_DOTDOT); + cd9660_rrip_PL(current,node); + TAILQ_INSERT_TAIL(&node->head, current, rr_ll); + } } else { cd9660_rrip_initialize_inode(node); @@ -435,14 +443,6 @@ cd9660_rrip_initialize_node(cd9660node * SUSP_ENTRY_RRIP_RE, "RE", SUSP_LOC_ENTRY); cd9660_rrip_RE(current,node); TAILQ_INSERT_TAIL(&node->head, current, rr_ll); - - /* Handle PL */ - current = cd9660node_susp_create_node(SUSP_TYPE_RRIP, - SUSP_ENTRY_RRIP_PL, "PL", SUSP_LOC_DOTDOT); - cd9660_rrip_PL(current,node->dot_dot_record); - TAILQ_INSERT_TAIL(&node->dot_dot_record->head, current, - rr_ll); - TAILQ_INSERT_TAIL(&node->head, current, rr_ll); } } return 1; @@ -496,7 +496,7 @@ cd9660_rrip_CL(struct ISO_SUSP_ATTRIBUTE int cd9660_rrip_RE(struct ISO_SUSP_ATTRIBUTES *p, cd9660node *node __unused) { - p->attr.rr_entry.RE.h.length[0] = 0; + p->attr.rr_entry.RE.h.length[0] = 4; p->attr.rr_entry.RE.h.version[0] = 1; return 1; } From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 13:18:40 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F1E7106566B; Sat, 13 Aug 2011 13:18:40 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C6F88FC08; Sat, 13 Aug 2011 13:18:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DDIeW1018005; Sat, 13 Aug 2011 13:18:40 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DDIetV017999; Sat, 13 Aug 2011 13:18:40 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201108131318.p7DDIetV017999@svn.freebsd.org> From: Marius Strobl Date: Sat, 13 Aug 2011 13:18:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224837 - in stable/8/release: . amd64 i386 pc98 picobsd/floppy.tree/sbin sun4v X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 13:18:40 -0000 Author: marius Date: Sat Aug 13 13:18:39 2011 New Revision: 224837 URL: http://svn.freebsd.org/changeset/base/224837 Log: MFC: r221466, r221494 (partial), r224652 Change several archs to use makefs (from base) instead of mkisofs (from ports) which makes release CD generation both faster and self-hosting. Added: stable/8/release/pc98/mkisoimages.sh - copied, changed from r221466, head/release/pc98/mkisoimages.sh stable/8/release/sun4v/mkisoimages.sh - copied, changed from r221466, head/release/sun4v/mkisoimages.sh Modified: stable/8/release/Makefile stable/8/release/amd64/mkisoimages.sh stable/8/release/i386/mkisoimages.sh Directory Properties: stable/8/release/ (props changed) stable/8/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/8/release/picobsd/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/dhclient-script (props changed) stable/8/release/picobsd/qemu/ (props changed) stable/8/release/picobsd/tinyware/login/ (props changed) stable/8/release/powerpc/ (props changed) Modified: stable/8/release/Makefile ============================================================================== --- stable/8/release/Makefile Sat Aug 13 13:15:38 2011 (r224836) +++ stable/8/release/Makefile Sat Aug 13 13:18:39 2011 (r224837) @@ -335,12 +335,8 @@ EXTRAS+= cdrom.1 cdrom.2 cdrom.3 .if defined(MAKE_ISOS) EXTRAS+= iso.1 .endif -.if ${TARGET} == "pc98" -BOOTABLE="-G" -.else BOOTABLE="-b" .endif -.endif .if !defined(NODOC) DOCREL= doc.1 doc.2 @@ -1123,35 +1119,35 @@ CD_DVD1_PKGS= ${CD_PACKAGE_TREE}/dvd1 .endif iso.1: -.if exists(${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh) +.if exists(${.CURDIR}/${TARGET}/mkisoimages.sh) @echo "Creating ISO images..." .if defined(CD_BOOT) - @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \ + @sh ${.CURDIR}/${TARGET}/mkisoimages.sh ${BOOTABLE} \ FreeBSD_bootonly \ ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-bootonly.iso ${CD_BOOT} .endif - @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \ + @sh ${.CURDIR}/${TARGET}/mkisoimages.sh ${BOOTABLE} \ FreeBSD_Install \ ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-disc1.iso ${CD_DISC1} \ ${CD_DISC1_PKGS} - @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh \ + @sh ${.CURDIR}/${TARGET}/mkisoimages.sh \ FreeBSD_Packages \ ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-disc2.iso ${CD_DISC2} \ ${CD_DISC2_PKGS} .if defined(MAKE_DVD) - @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \ + @sh ${.CURDIR}/${TARGET}/mkisoimages.sh ${BOOTABLE} \ FreeBSD_Install \ ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-dvd1.iso ${CD_DVD1} \ ${CD_DVD1_PKGS} .endif .if !defined(NODOC) - @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh \ + @sh ${.CURDIR}/${TARGET}/mkisoimages.sh \ FreeBSD_Documentation \ ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-disc3.iso ${CD_DOCS} \ ${CD_DOCS_PKGS} .endif .if defined(SEPARATE_LIVEFS) - @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \ + @sh ${.CURDIR}/${TARGET}/mkisoimages.sh ${BOOTABLE} \ FreeBSD_LiveFS \ ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-livefs.iso ${CD_LIVEFS} .endif @@ -1160,7 +1156,7 @@ iso.1: @(cd ${CD} && sha256 *.iso > FreeBSD-${BUILDNAME}-${TARGET}-iso.CHECKSUM.SHA256) touch ${.TARGET} .else - @echo "Do not know how to create an ISO for ${TARGET_ARCH}." + @echo "Do not know how to create an ISO for ${TARGET}." .endif # Modified: stable/8/release/amd64/mkisoimages.sh ============================================================================== --- stable/8/release/amd64/mkisoimages.sh Sat Aug 13 13:15:38 2011 (r224836) +++ stable/8/release/amd64/mkisoimages.sh Sat Aug 13 13:18:39 2011 (r224837) @@ -23,10 +23,9 @@ # extra-bits-dir, if provided, contains additional files to be merged # into base-bits-dir as part of making the image. -publisher="The FreeBSD Project. http://www.freebsd.org/" if [ "x$1" = "x-b" ]; then # This is highly x86-centric and will be used directly below. - bootable="-b boot/cdboot -no-emul-boot" + bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot" shift else bootable="" @@ -37,21 +36,7 @@ if [ $# -lt 3 ]; then exit 1 fi -type mkisofs 2>&1 | grep " is " >/dev/null -if [ $? -ne 0 ]; then - echo The cdrtools port is not installed. Trying to get it now. - if [ -f /usr/ports/sysutils/cdrtools/Makefile ]; then - cd /usr/ports/sysutils/cdrtools && make install BATCH=yes && make clean - else - if ! pkg_add -r cdrtools; then - echo "Could not get it via pkg_add - please go install this" - echo "from the ports collection and run this script again." - exit 2 - fi - fi -fi - LABEL=$1; shift NAME=$1; shift -mkisofs $bootable -r -J -V $LABEL -publisher "$publisher" -o $NAME $* +makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $* Modified: stable/8/release/i386/mkisoimages.sh ============================================================================== --- stable/8/release/i386/mkisoimages.sh Sat Aug 13 13:15:38 2011 (r224836) +++ stable/8/release/i386/mkisoimages.sh Sat Aug 13 13:18:39 2011 (r224837) @@ -23,38 +23,20 @@ # extra-bits-dir, if provided, contains additional files to be merged # into base-bits-dir as part of making the image. -publisher="The FreeBSD Project. http://www.freebsd.org/" - if [ "x$1" = "x-b" ]; then - bootable="-b boot/cdboot -no-emul-boot" - shift -elif [ "x$1" = "x-G" ]; then - bootable="-G /R/cdrom/bootonly/boot/cdboot" + # This is highly x86-centric and will be used directly below. + bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot" shift else bootable="" fi if [ $# -lt 3 ]; then - echo Usage: $0 '[-bG] image-label image-name base-bits-dir [extra-bits-dir]' + echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]' exit 1 fi -type mkisofs 2>&1 | grep " is " >/dev/null -if [ $? -ne 0 ]; then - echo The cdrtools port is not installed. Trying to get it now. - if [ -f /usr/ports/sysutils/cdrtools/Makefile ]; then - cd /usr/ports/sysutils/cdrtools && make install BATCH=yes && make clean - else - if ! pkg_add -r cdrtools; then - echo "Could not get it via pkg_add - please go install this" - echo "from the ports collection and run this script again." - exit 2 - fi - fi -fi - LABEL=$1; shift NAME=$1; shift -mkisofs $bootable -r -J -V $LABEL -publisher "$publisher" -o $NAME $* +makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $* Copied and modified: stable/8/release/pc98/mkisoimages.sh (from r221466, head/release/pc98/mkisoimages.sh) ============================================================================== --- head/release/pc98/mkisoimages.sh Wed May 4 23:41:11 2011 (r221466, copy source) +++ stable/8/release/pc98/mkisoimages.sh Sat Aug 13 13:18:39 2011 (r224837) @@ -23,7 +23,6 @@ # extra-bits-dir, if provided, contains additional files to be merged # into base-bits-dir as part of making the image. -publisher="The FreeBSD Project. http://www.freebsd.org/" if [ "x$1" = "x-b" ]; then # This is highly x86-centric and will be used directly below. bootable="-o generic-bootimage=$4/boot/cdboot" @@ -40,6 +39,4 @@ fi LABEL=$1; shift NAME=$1; shift -echo "/dev/iso9660/`echo $LABEL | tr '[:lower:]' '[:upper:]'` / cd9660 ro 0 0" > $1/etc/fstab makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $* -rm $1/etc/fstab Copied and modified: stable/8/release/sun4v/mkisoimages.sh (from r221466, head/release/sun4v/mkisoimages.sh) ============================================================================== --- head/release/sun4v/mkisoimages.sh Wed May 4 23:41:11 2011 (r221466, copy source) +++ stable/8/release/sun4v/mkisoimages.sh Sat Aug 13 13:18:39 2011 (r224837) @@ -66,7 +66,5 @@ fi LABEL=$1; shift NAME=$1; shift -echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab mkisofs $bootable -r -J -V $LABEL -publisher "$publisher" -o $NAME $* -rm $1/etc/fstab rm -f ${IMG} From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 17:08:58 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 014191065672; Sat, 13 Aug 2011 17:08:58 +0000 (UTC) (envelope-from zack@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E4D498FC13; Sat, 13 Aug 2011 17:08:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DH8vRg025103; Sat, 13 Aug 2011 17:08:57 GMT (envelope-from zack@svn.freebsd.org) Received: (from zack@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DH8vCe025100; Sat, 13 Aug 2011 17:08:57 GMT (envelope-from zack@svn.freebsd.org) Message-Id: <201108131708.p7DH8vCe025100@svn.freebsd.org> From: Zack Kirsch Date: Sat, 13 Aug 2011 17:08:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224843 - in stable/8/sys/fs: nfs nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 17:08:58 -0000 Author: zack Date: Sat Aug 13 17:08:57 2011 New Revision: 224843 URL: http://svn.freebsd.org/changeset/base/224843 Log: MFC: r224077 Small acl patch to return the aclerror that comes back from nfsrv_dissectacl(). This fixes a problem where ATTRNOTSUPP was being returned instead of BADOWNER. Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c stable/8/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonsubs.c Sat Aug 13 16:03:40 2011 (r224842) +++ stable/8/sys/fs/nfs/nfs_commonsubs.c Sat Aug 13 17:08:57 2011 (r224843) @@ -660,9 +660,9 @@ nfsrv_dissectacl(struct nfsrv_descript * aclsize = NFSX_UNSIGNED; acecnt = fxdr_unsigned(int, *tl); if (acecnt > ACL_MAX_ENTRIES) - aceerr = 1; + aceerr = NFSERR_ATTRNOTSUPP; if (nfsrv_useacl == 0) - aceerr = 1; + aceerr = NFSERR_ATTRNOTSUPP; for (i = 0; i < acecnt; i++) { if (aclp && !aceerr) error = nfsrv_dissectace(nd, &aclp->acl_entry[i], Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Sat Aug 13 16:03:40 2011 (r224842) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Sat Aug 13 17:08:57 2011 (r224843) @@ -2301,7 +2301,7 @@ nfsv4_sattr(struct nfsrv_descript *nd, s if (error) goto nfsmout; if (aceerr && !nd->nd_repstat) - nd->nd_repstat = NFSERR_ATTRNOTSUPP; + nd->nd_repstat = aceerr; attrsum += aclsize; break; case NFSATTRBIT_ARCHIVE: From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 17:16:07 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 360301065676; Sat, 13 Aug 2011 17:16:07 +0000 (UTC) (envelope-from zack@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C23A8FC08; Sat, 13 Aug 2011 17:16:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DHG6Z8025446; Sat, 13 Aug 2011 17:16:06 GMT (envelope-from zack@svn.freebsd.org) Received: (from zack@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DHG6V8025442; Sat, 13 Aug 2011 17:16:06 GMT (envelope-from zack@svn.freebsd.org) Message-Id: <201108131716.p7DHG6V8025442@svn.freebsd.org> From: Zack Kirsch Date: Sat, 13 Aug 2011 17:16:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224844 - in stable/8/sys/fs: nfs nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 17:16:07 -0000 Author: zack Date: Sat Aug 13 17:16:06 2011 New Revision: 224844 URL: http://svn.freebsd.org/changeset/base/224844 Log: MFC: 224078 Move nfsvno_pathconf to be accessible to sys/fs/nfs; no functionality change. Modified: stable/8/sys/fs/nfs/nfs_commonport.c stable/8/sys/fs/nfs/nfs_var.h stable/8/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_commonport.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonport.c Sat Aug 13 17:08:57 2011 (r224843) +++ stable/8/sys/fs/nfs/nfs_commonport.c Sat Aug 13 17:16:06 2011 (r224844) @@ -291,6 +291,49 @@ nfsvno_getfs(struct nfsfsinfo *sip, int NFSV3FSINFO_CANSETTIME); } +/* + * Do the pathconf vnode op. + */ +int +nfsvno_pathconf(struct vnode *vp, int flag, register_t *retf, + struct ucred *cred, struct thread *p) +{ + int error; + + error = VOP_PATHCONF(vp, flag, retf); + if (error == EOPNOTSUPP || error == EINVAL) { + /* + * Some file systems return EINVAL for name arguments not + * supported and some return EOPNOTSUPP for this case. + * So the NFSv3 Pathconf RPC doesn't fail for these cases, + * just fake them. + */ + switch (flag) { + case _PC_LINK_MAX: + *retf = LINK_MAX; + break; + case _PC_NAME_MAX: + *retf = NAME_MAX; + break; + case _PC_CHOWN_RESTRICTED: + *retf = 1; + break; + case _PC_NO_TRUNC: + *retf = 1; + break; + default: + /* + * Only happens if a _PC_xxx is added to the server, + * but this isn't updated. + */ + *retf = 0; + printf("nfsrvd pathconf flag=%d not supp\n", flag); + }; + error = 0; + } + return (error); +} + /* Fake nfsrv_atroot. Just return 0 */ int nfsrv_atroot(struct vnode *vp, long *retp) Modified: stable/8/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/8/sys/fs/nfs/nfs_var.h Sat Aug 13 17:08:57 2011 (r224843) +++ stable/8/sys/fs/nfs/nfs_var.h Sat Aug 13 17:16:06 2011 (r224844) @@ -325,6 +325,8 @@ struct ucred *newnfs_getcred(void); void newnfs_setroot(struct ucred *); int nfs_catnap(int, int, const char *); struct nfsreferral *nfsv4root_getreferral(vnode_t, vnode_t, u_int32_t); +int nfsvno_pathconf(vnode_t, int, register_t *, struct ucred *, + NFSPROC_T *); int nfsrv_atroot(vnode_t, long *); void newnfs_timer(void *); int nfs_supportsnfsv4acls(vnode_t); @@ -569,8 +571,6 @@ int nfsvno_checkexp(mount_t, NFSSOCKADDR struct ucred **); int nfsvno_fhtovp(mount_t, fhandle_t *, NFSSOCKADDR_T, int, vnode_t *, struct nfsexstuff *, struct ucred **); -int nfsvno_pathconf(vnode_t, int, register_t *, struct ucred *, - NFSPROC_T *); vnode_t nfsvno_getvp(fhandle_t *); int nfsvno_advlock(vnode_t, int, u_int64_t, u_int64_t, NFSPROC_T *); int nfsrv_v4rootexport(void *, struct ucred *, NFSPROC_T *); Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Sat Aug 13 17:08:57 2011 (r224843) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Sat Aug 13 17:16:06 2011 (r224844) @@ -2580,49 +2580,6 @@ nfsvno_fhtovp(struct mount *mp, fhandle_ } /* - * Do the pathconf vnode op. - */ -int -nfsvno_pathconf(struct vnode *vp, int flag, register_t *retf, - struct ucred *cred, struct thread *p) -{ - int error; - - error = VOP_PATHCONF(vp, flag, retf); - if (error == EOPNOTSUPP || error == EINVAL) { - /* - * Some file systems return EINVAL for name arguments not - * supported and some return EOPNOTSUPP for this case. - * So the NFSv3 Pathconf RPC doesn't fail for these cases, - * just fake them. - */ - switch (flag) { - case _PC_LINK_MAX: - *retf = LINK_MAX; - break; - case _PC_NAME_MAX: - *retf = NAME_MAX; - break; - case _PC_CHOWN_RESTRICTED: - *retf = 1; - break; - case _PC_NO_TRUNC: - *retf = 1; - break; - default: - /* - * Only happens if a _PC_xxx is added to the server, - * but this isn't updated. - */ - *retf = 0; - printf("nfsrvd pathconf flag=%d not supp\n", flag); - }; - error = 0; - } - return (error); -} - -/* * nfsd_fhtovp() - convert a fh to a vnode ptr * - look up fsid in mount list (if not found ret error) * - get vp and export rights by calling nfsvno_fhtovp() From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 17:17:06 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E486F106566C; Sat, 13 Aug 2011 17:17:06 +0000 (UTC) (envelope-from zack@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA5D88FC1D; Sat, 13 Aug 2011 17:17:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DHH6Ld025571; Sat, 13 Aug 2011 17:17:06 GMT (envelope-from zack@svn.freebsd.org) Received: (from zack@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DHH6Pm025566; Sat, 13 Aug 2011 17:17:06 GMT (envelope-from zack@svn.freebsd.org) Message-Id: <201108131717.p7DHH6Pm025566@svn.freebsd.org> From: Zack Kirsch Date: Sat, 13 Aug 2011 17:17:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224846 - in stable/8/sys/fs: nfs nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 17:17:07 -0000 Author: zack Date: Sat Aug 13 17:17:06 2011 New Revision: 224846 URL: http://svn.freebsd.org/changeset/base/224846 Log: MFC: 224080 Remove unnecessary thread pointer from VOPLOCK macros and current users. Modified: stable/8/sys/fs/nfs/nfsport.h stable/8/sys/fs/nfsserver/nfs_nfsdport.c stable/8/sys/fs/nfsserver/nfs_nfsdserv.c stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfs/nfsport.h ============================================================================== --- stable/8/sys/fs/nfs/nfsport.h Sat Aug 13 17:17:04 2011 (r224845) +++ stable/8/sys/fs/nfs/nfsport.h Sat Aug 13 17:17:06 2011 (r224846) @@ -832,10 +832,13 @@ void nfsd_mntinit(void); /* * Define these for vnode lock/unlock ops. + * + * These are good abstractions to macro out, so that they can be added to + * later, for debugging or stats, etc. */ -#define NFSVOPLOCK(v, f, p) vn_lock((v), (f)) -#define NFSVOPUNLOCK(v, f, p) VOP_UNLOCK((v), (f)) -#define NFSVOPISLOCKED(v, p) VOP_ISLOCKED((v)) +#define NFSVOPLOCK(v, f) vn_lock((v), (f)) +#define NFSVOPUNLOCK(v, f) VOP_UNLOCK((v), (f)) +#define NFSVOPISLOCKED(v) VOP_ISLOCKED((v)) /* * Define ncl_hash(). Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Sat Aug 13 17:17:04 2011 (r224845) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Sat Aug 13 17:17:06 2011 (r224846) @@ -280,7 +280,7 @@ nfsvno_namei(struct nfsrv_descript *nd, return (ENOTDIR); } if (islocked) - NFSVOPUNLOCK(dp, 0, p); + NFSVOPUNLOCK(dp, 0); VREF(dp); *retdirp = dp; if (NFSVNO_EXRDONLY(exp)) @@ -349,7 +349,7 @@ nfsvno_namei(struct nfsrv_descript *nd, if ((cnp->cn_flags & (SAVENAME | SAVESTART)) == 0) nfsvno_relpathbuf(ndp); if (ndp->ni_vp && !lockleaf) - NFSVOPUNLOCK(ndp->ni_vp, 0, p); + NFSVOPUNLOCK(ndp->ni_vp, 0); break; } @@ -357,7 +357,7 @@ nfsvno_namei(struct nfsrv_descript *nd, * Validate symlink */ if ((cnp->cn_flags & LOCKPARENT) && ndp->ni_pathlen == 1) - NFSVOPUNLOCK(ndp->ni_dvp, 0, p); + NFSVOPUNLOCK(ndp->ni_dvp, 0); if (!(nd->nd_flag & ND_PUBLOOKUP)) { error = EINVAL; goto badlink2; @@ -2865,14 +2865,14 @@ nfsvno_advlock(struct vnode *vp, int fty fl.l_pid = (pid_t)0; fl.l_sysid = (int)nfsv4_sysid; - NFSVOPUNLOCK(vp, 0, td); + NFSVOPUNLOCK(vp, 0); if (ftype == F_UNLCK) error = VOP_ADVLOCK(vp, (caddr_t)td->td_proc, F_UNLCK, &fl, (F_POSIX | F_REMOTE)); else error = VOP_ADVLOCK(vp, (caddr_t)td->td_proc, F_SETLK, &fl, (F_POSIX | F_REMOTE)); - NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY, td); + NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY); return (error); } Modified: stable/8/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Sat Aug 13 17:17:04 2011 (r224845) +++ stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Sat Aug 13 17:17:06 2011 (r224846) @@ -1449,7 +1449,7 @@ nfsrvd_rename(struct nfsrv_descript *nd, if (tdp) { tdirfor_ret = nfsvno_getattr(tdp, &tdirfor, nd->nd_cred, p, 1); - NFSVOPUNLOCK(tdp, 0, p); + NFSVOPUNLOCK(tdp, 0); } } NFSNAMEICNDSET(&tond.ni_cnd, nd->nd_cred, RENAME, LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART); @@ -1554,7 +1554,7 @@ nfsrvd_link(struct nfsrv_descript *nd, i nfsrv_wcc(nd, dirfor_ret, &dirfor, diraft_ret, &diraft); return (0); } - NFSVOPUNLOCK(vp, 0, p); + NFSVOPUNLOCK(vp, 0); if (vnode_vtype(vp) == VDIR) { if (nd->nd_flag & ND_NFSV4) nd->nd_repstat = NFSERR_ISDIR; @@ -1584,7 +1584,7 @@ nfsrvd_link(struct nfsrv_descript *nd, i nfsd_fhtovp(nd, &dfh, LK_EXCLUSIVE, &dp, &tnes, NULL, 0, p); if (dp) - NFSVOPUNLOCK(dp, 0, p); + NFSVOPUNLOCK(dp, 0); } } NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, CREATE, @@ -1868,7 +1868,7 @@ nfsrvd_mkdirsub(struct nfsrv_descript *n nd->nd_repstat = nfsvno_getattr(vp, nvap, nd->nd_cred, p, 1); if (vpp && !nd->nd_repstat) { - NFSVOPUNLOCK(vp, 0, p); + NFSVOPUNLOCK(vp, 0); *vpp = vp; } else { vput(vp); @@ -2765,7 +2765,7 @@ nfsrvd_open(struct nfsrv_descript *nd, _ * (ie: Leave the NFSVOPUNLOCK() about here.) */ if (vp) - NFSVOPUNLOCK(vp, 0, p); + NFSVOPUNLOCK(vp, 0); if (stp) FREE((caddr_t)stp, M_NFSDSTATE); if (!nd->nd_repstat && dirp) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c Sat Aug 13 17:17:04 2011 (r224845) +++ stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c Sat Aug 13 17:17:06 2011 (r224846) @@ -430,7 +430,7 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, } else { if (nfs_retfh[nd->nd_procnum] == 1) { if (vp) - NFSVOPUNLOCK(vp, 0, p); + NFSVOPUNLOCK(vp, 0); error = (*(nfsrv3_procs1[nd->nd_procnum]))(nd, isdgram, vp, NULL, (fhandle_t *)fh.nfsrvfh_data, p, &nes); } else if (nfs_retfh[nd->nd_procnum] == 2) { From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 17:17:59 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91E93106566C; Sat, 13 Aug 2011 17:17:59 +0000 (UTC) (envelope-from zack@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8015B8FC08; Sat, 13 Aug 2011 17:17:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DHHxqG025650; Sat, 13 Aug 2011 17:17:59 GMT (envelope-from zack@svn.freebsd.org) Received: (from zack@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DHHxU9025641; Sat, 13 Aug 2011 17:17:59 GMT (envelope-from zack@svn.freebsd.org) Message-Id: <201108131717.p7DHHxU9025641@svn.freebsd.org> From: Zack Kirsch Date: Sat, 13 Aug 2011 17:17:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224847 - in stable/8/sys/fs: nfs nfsclient nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 17:17:59 -0000 Author: zack Date: Sat Aug 13 17:17:59 2011 New Revision: 224847 URL: http://svn.freebsd.org/changeset/base/224847 Log: MFC: 224081 Simple find/replace of vn_lock -> NFSVOPLOCK. This is done so that NFSVOPLOCK can be modified later to add enhanced logging and assertions. Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c stable/8/sys/fs/nfsclient/nfs_clport.c stable/8/sys/fs/nfsclient/nfs_clsubs.c stable/8/sys/fs/nfsclient/nfs_clvnops.c stable/8/sys/fs/nfsserver/nfs_nfsdport.c stable/8/sys/fs/nfsserver/nfs_nfsdserv.c stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonsubs.c Sat Aug 13 17:17:06 2011 (r224846) +++ stable/8/sys/fs/nfs/nfs_commonsubs.c Sat Aug 13 17:17:59 2011 (r224847) @@ -1995,7 +1995,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd supports_nfsv4acls == 0)) { NFSCLRBIT_ATTRBIT(retbitp, NFSATTRBIT_ACL); } else if (naclp != NULL) { - if (vn_lock(vp, LK_SHARED) == 0) { + if (NFSVOPLOCK(vp, LK_SHARED) == 0) { error = VOP_ACCESSX(vp, VREAD_ACL, cred, p); if (error == 0) error = VOP_GETACL(vp, ACL_TYPE_NFS4, Modified: stable/8/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clport.c Sat Aug 13 17:17:06 2011 (r224846) +++ stable/8/sys/fs/nfsclient/nfs_clport.c Sat Aug 13 17:17:59 2011 (r224847) @@ -105,7 +105,7 @@ nfscl_nget(struct mount *mntp, struct vn if (error == 0 && nvp != NULL) { /* * I believe there is a slight chance that vgonel() could - * get called on this vnode between when vn_lock() drops + * get called on this vnode between when NFSVOPLOCK() drops * the VI_LOCK() and vget() acquires it again, so that it * hasn't yet had v_usecount incremented. If this were to * happen, the VI_DOOMED flag would be set, so check for Modified: stable/8/sys/fs/nfsclient/nfs_clsubs.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clsubs.c Sat Aug 13 17:17:06 2011 (r224846) +++ stable/8/sys/fs/nfsclient/nfs_clsubs.c Sat Aug 13 17:17:59 2011 (r224847) @@ -145,7 +145,7 @@ ncl_upgrade_vnlock(struct vnode *vp) KASSERT(old_lock == LK_SHARED, ("ncl_upgrade_vnlock: wrong old_lock %d", old_lock)); /* Upgrade to exclusive lock, this might block */ - vn_lock(vp, LK_UPGRADE | LK_RETRY); + NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY); } return (old_lock); } @@ -156,7 +156,7 @@ ncl_downgrade_vnlock(struct vnode *vp, i if (old_lock != LK_EXCLUSIVE) { KASSERT(old_lock == LK_SHARED, ("wrong old_lock %d", old_lock)); /* Downgrade from exclusive lock. */ - vn_lock(vp, LK_DOWNGRADE | LK_RETRY); + NFSVOPLOCK(vp, LK_DOWNGRADE | LK_RETRY); } } Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Sat Aug 13 17:17:06 2011 (r224846) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Sat Aug 13 17:17:59 2011 (r224847) @@ -1177,7 +1177,7 @@ nfs_lookup(struct vop_lookup_args *ap) vfs_ref(mp); VOP_UNLOCK(dvp, 0); error = vfs_busy(mp, 0); - vn_lock(dvp, ltype | LK_RETRY); + NFSVOPLOCK(dvp, ltype | LK_RETRY); vfs_rel(mp); if (error == 0 && (dvp->v_iflag & VI_DOOMED)) { vfs_unbusy(mp); @@ -1193,7 +1193,7 @@ nfs_lookup(struct vop_lookup_args *ap) newvp = NFSTOV(np); vfs_unbusy(mp); if (newvp != dvp) - vn_lock(dvp, ltype | LK_RETRY); + NFSVOPLOCK(dvp, ltype | LK_RETRY); if (dvp->v_iflag & VI_DOOMED) { if (error == 0) { if (newvp == dvp) @@ -1707,7 +1707,7 @@ nfs_rename(struct vop_rename_args *ap) error = 0; goto out; } - if ((error = vn_lock(fvp, LK_EXCLUSIVE)) != 0) + if ((error = NFSVOPLOCK(fvp, LK_EXCLUSIVE)) != 0) goto out; /* @@ -2879,7 +2879,7 @@ nfs_advlock(struct vop_advlock_args *ap) cred = p->p_ucred; else cred = td->td_ucred; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_iflag & VI_DOOMED) { VOP_UNLOCK(vp, 0); return (EBADF); @@ -2909,7 +2909,7 @@ nfs_advlock(struct vop_advlock_args *ap) "ncladvl"); if (error) return (EINTR); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_iflag & VI_DOOMED) { VOP_UNLOCK(vp, 0); return (EBADF); @@ -2952,7 +2952,7 @@ nfs_advlock(struct vop_advlock_args *ap) VOP_UNLOCK(vp, 0); return (0); } else if (!NFS_ISV4(vp)) { - error = vn_lock(vp, LK_SHARED); + error = NFSVOPLOCK(vp, LK_SHARED); if (error) return (error); if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOLOCKD) != 0) { @@ -2983,7 +2983,7 @@ nfs_advlockasync(struct vop_advlockasync if (NFS_ISV4(vp)) return (EOPNOTSUPP); - error = vn_lock(vp, LK_SHARED); + error = NFSVOPLOCK(vp, LK_SHARED); if (error) return (error); if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOLOCKD) != 0) { Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Sat Aug 13 17:17:06 2011 (r224846) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Sat Aug 13 17:17:59 2011 (r224847) @@ -116,7 +116,7 @@ nfsvno_getattr(struct vnode *vp, struct */ if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) { lockedit = 1; - vn_lock(vp, LK_SHARED | LK_RETRY); + NFSVOPLOCK(vp, LK_SHARED | LK_RETRY); } } error = VOP_GETATTR(vp, &nvap->na_vattr, cred); @@ -158,7 +158,7 @@ nfsvno_accchk(struct vnode *vp, accmode_ int error = 0, getret = 0; if (vpislocked == 0) { - if (vn_lock(vp, LK_SHARED) != 0) + if (NFSVOPLOCK(vp, LK_SHARED) != 0) return (EPERM); } if (accmode & VWRITE) { @@ -1095,7 +1095,7 @@ nfsvno_rename(struct nameidata *fromndp, goto out; } if (ndflag & ND_NFSV4) { - if (vn_lock(fvp, LK_EXCLUSIVE) == 0) { + if (NFSVOPLOCK(fvp, LK_EXCLUSIVE) == 0) { error = nfsrv_checkremove(fvp, 0, p); VOP_UNLOCK(fvp, 0); } else @@ -1156,7 +1156,7 @@ nfsvno_link(struct nameidata *ndp, struc error = EXDEV; } if (!error) { - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY); if ((vp->v_iflag & VI_DOOMED) == 0) error = VOP_LINK(ndp->ni_dvp, vp, &ndp->ni_cnd); else @@ -1983,7 +1983,7 @@ again: dp->d_name[1] == '.') cn.cn_flags |= ISDOTDOT; - if (vn_lock(vp, LK_SHARED) + if (NFSVOPLOCK(vp, LK_SHARED) != 0) { nd->nd_repstat = EPERM; break; @@ -2575,7 +2575,7 @@ nfsvno_fhtovp(struct mount *mp, fhandle_ * but this will have to do until VFS_FHTOVP() has a lock * type argument like VFS_VGET(). */ - vn_lock(*vpp, LK_DOWNGRADE | LK_RETRY); + NFSVOPLOCK(*vpp, LK_DOWNGRADE | LK_RETRY); return (error); } Modified: stable/8/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Sat Aug 13 17:17:06 2011 (r224846) +++ stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Sat Aug 13 17:17:59 2011 (r224847) @@ -238,7 +238,7 @@ nfsrvd_getattr(struct nfsrv_descript *nd VOP_UNLOCK(vp, 0); if (at_root != 0) { if ((nd->nd_repstat = - vn_lock(tvp, LK_SHARED)) == 0) { + NFSVOPLOCK(tvp, LK_SHARED)) == 0) { nd->nd_repstat = VOP_GETATTR( tvp, &va, nd->nd_cred); vput(tvp); @@ -2703,7 +2703,7 @@ nfsrvd_open(struct nfsrv_descript *nd, _ }; stp->ls_flags |= NFSLCK_RECLAIM; vp = dp; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY); if ((vp->v_iflag & VI_DOOMED) == 0) nd->nd_repstat = nfsrv_opencheck(clientid, &stateid, stp, vp, nd, p, nd->nd_repstat); Modified: stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c Sat Aug 13 17:17:06 2011 (r224846) +++ stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c Sat Aug 13 17:17:59 2011 (r224847) @@ -861,7 +861,7 @@ nfsrvd_compound(struct nfsrv_descript *n } if (nfsv4_opflag[op].modifyfs) vn_start_write(savevp, &temp_mp, V_WAIT); - if (vn_lock(savevp, LK_EXCLUSIVE) == 0) { + if (NFSVOPLOCK(savevp, LK_EXCLUSIVE) == 0) { VREF(vp); VREF(savevp); error = (*(nfsrv4_ops2[op]))(nd, isdgram, @@ -878,7 +878,7 @@ nfsrvd_compound(struct nfsrv_descript *n if (nfsv4_opflag[op].modifyfs) vn_start_write(vp, &temp_mp, V_WAIT); - if (vn_lock(vp, nfsv4_opflag[op].lktype) + if (NFSVOPLOCK(vp, nfsv4_opflag[op].lktype) == 0) VREF(vp); else Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Sat Aug 13 17:17:06 2011 (r224846) +++ stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Sat Aug 13 17:17:59 2011 (r224847) @@ -4096,7 +4096,7 @@ nfsrv_updatestable(NFSPROC_T *p) NFSVNO_SETATTRVAL(&nva, size, 0); vp = NFSFPVNODE(sf->nsf_fp); vn_start_write(vp, &mp, V_WAIT); - if (vn_lock(vp, LK_EXCLUSIVE) == 0) { + if (NFSVOPLOCK(vp, LK_EXCLUSIVE) == 0) { error = nfsvno_setattr(vp, &nva, NFSFPCRED(sf->nsf_fp), p, NULL); VOP_UNLOCK(vp, 0); @@ -4231,7 +4231,7 @@ nfsrv_checkstable(struct nfsclient *clp) * Return 0 to indicate the conflict can't be revoked and 1 to indicate * the revocation worked and the conflicting client is "bye, bye", so it * can be tried again. - * Return 2 to indicate that the vnode is VI_DOOMED after vn_lock(). + * Return 2 to indicate that the vnode is VI_DOOMED after NFSVOPLOCK(). * Unlocks State before a non-zero value is returned. */ static int @@ -4258,7 +4258,7 @@ nfsrv_clientconflict(struct nfsclient *c } while (!gotlock); NFSUNLOCKV4ROOTMUTEX(); *haslockp = 1; - vn_lock(vp, lktype | LK_RETRY); + NFSVOPLOCK(vp, lktype | LK_RETRY); if ((vp->v_iflag & VI_DOOMED) != 0) return (2); else @@ -4426,7 +4426,7 @@ nfsrv_delegconflict(struct nfsstate *stp } while (!gotlock); NFSUNLOCKV4ROOTMUTEX(); *haslockp = 1; - vn_lock(vp, lktype | LK_RETRY); + NFSVOPLOCK(vp, lktype | LK_RETRY); if ((vp->v_iflag & VI_DOOMED) != 0) { *haslockp = 0; NFSLOCKV4ROOTMUTEX(); @@ -4626,7 +4626,7 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO NFSGETNANOTIME(&mytime); starttime = (u_int32_t)mytime.tv_sec; do { - if (vn_lock(vp, LK_EXCLUSIVE) == 0) { + if (NFSVOPLOCK(vp, LK_EXCLUSIVE) == 0) { error = nfsrv_checkremove(vp, 0, p); VOP_UNLOCK(vp, 0); } else From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 17:18:45 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED10A106566B; Sat, 13 Aug 2011 17:18:45 +0000 (UTC) (envelope-from zack@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB5D08FC1D; Sat, 13 Aug 2011 17:18:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DHIjGA025738; Sat, 13 Aug 2011 17:18:45 GMT (envelope-from zack@svn.freebsd.org) Received: (from zack@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DHIj55025729; Sat, 13 Aug 2011 17:18:45 GMT (envelope-from zack@svn.freebsd.org) Message-Id: <201108131718.p7DHIj55025729@svn.freebsd.org> From: Zack Kirsch Date: Sat, 13 Aug 2011 17:18:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224848 - in stable/8/sys/fs: nfs nfsclient nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 17:18:46 -0000 Author: zack Date: Sat Aug 13 17:18:45 2011 New Revision: 224848 URL: http://svn.freebsd.org/changeset/base/224848 Log: MFC: 224082 Simple find/replace of VOP_UNLOCK -> NFSVOPUNLOCK. This is done so that NFSVOPUNLOCK can be modified later to add enhanced logging and assertions. Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c stable/8/sys/fs/nfsclient/nfs_clport.c stable/8/sys/fs/nfsclient/nfs_clvfsops.c stable/8/sys/fs/nfsclient/nfs_clvnops.c stable/8/sys/fs/nfsserver/nfs_nfsdport.c stable/8/sys/fs/nfsserver/nfs_nfsdserv.c stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonsubs.c Sat Aug 13 17:17:59 2011 (r224847) +++ stable/8/sys/fs/nfs/nfs_commonsubs.c Sat Aug 13 17:18:45 2011 (r224848) @@ -2000,7 +2000,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd if (error == 0) error = VOP_GETACL(vp, ACL_TYPE_NFS4, naclp, cred, p); - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); } else error = NFSERR_PERM; if (error != 0) { Modified: stable/8/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clport.c Sat Aug 13 17:17:59 2011 (r224847) +++ stable/8/sys/fs/nfsclient/nfs_clport.c Sat Aug 13 17:18:45 2011 (r224848) @@ -295,7 +295,7 @@ nfscl_ngetreopen(struct mount *mntp, u_i error = vfs_hash_get(mntp, hash, (LK_EXCLUSIVE | LK_NOWAIT), td, &nvp, newnfs_vncmpf, nfhp); if (error == 0 && nvp != NULL) { - VOP_UNLOCK(nvp, 0); + NFSVOPUNLOCK(nvp, 0); } else if (error == EBUSY) { /* * The LK_EXCLOTHER lock type tells nfs_lock1() to not try Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvfsops.c Sat Aug 13 17:17:59 2011 (r224847) +++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c Sat Aug 13 17:18:45 2011 (r224848) @@ -1340,7 +1340,7 @@ mountnfs(struct nfs_args *argp, struct m /* * Lose the lock but keep the ref. */ - VOP_UNLOCK(*vpp, 0); + NFSVOPUNLOCK(*vpp, 0); return (0); } error = EIO; @@ -1487,7 +1487,7 @@ loop: error = VOP_FSYNC(vp, waitfor, td); if (error) allerror = error; - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); vrele(vp); MNT_ILOCK(mp); Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Sat Aug 13 17:17:59 2011 (r224847) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Sat Aug 13 17:18:45 2011 (r224848) @@ -1175,7 +1175,7 @@ nfs_lookup(struct vop_lookup_args *ap) error = vfs_busy(mp, MBF_NOWAIT); if (error != 0) { vfs_ref(mp); - VOP_UNLOCK(dvp, 0); + NFSVOPUNLOCK(dvp, 0); error = vfs_busy(mp, 0); NFSVOPLOCK(dvp, ltype | LK_RETRY); vfs_rel(mp); @@ -1186,7 +1186,7 @@ nfs_lookup(struct vop_lookup_args *ap) if (error != 0) return (error); } - VOP_UNLOCK(dvp, 0); + NFSVOPUNLOCK(dvp, 0); error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL, cnp->cn_lkflags); if (error == 0) @@ -1724,7 +1724,7 @@ nfs_rename(struct vop_rename_args *ap) * this condition can result in potential (silent) data loss. */ error = VOP_FSYNC(fvp, MNT_WAIT, fcnp->cn_thread); - VOP_UNLOCK(fvp, 0); + NFSVOPUNLOCK(fvp, 0); if (!error && tvp) error = VOP_FSYNC(tvp, MNT_WAIT, tcnp->cn_thread); if (error) @@ -2881,7 +2881,7 @@ nfs_advlock(struct vop_advlock_args *ap) cred = td->td_ucred; NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_iflag & VI_DOOMED) { - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); return (EBADF); } @@ -2904,27 +2904,27 @@ nfs_advlock(struct vop_advlock_args *ap) ap->a_fl, 0, cred, td, ap->a_id, ap->a_flags); if (ret == NFSERR_DENIED && (ap->a_flags & F_WAIT) && ap->a_op == F_SETLK) { - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); error = nfs_catnap(PZERO | PCATCH, ret, "ncladvl"); if (error) return (EINTR); NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_iflag & VI_DOOMED) { - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); return (EBADF); } } } while (ret == NFSERR_DENIED && (ap->a_flags & F_WAIT) && ap->a_op == F_SETLK); if (ret == NFSERR_DENIED) { - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); return (EAGAIN); } else if (ret == EINVAL || ret == EBADF || ret == EINTR) { - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); return (ret); } else if (ret != 0) { - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); return (EACCES); } @@ -2949,7 +2949,7 @@ nfs_advlock(struct vop_advlock_args *ap) } } } - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); return (0); } else if (!NFS_ISV4(vp)) { error = NFSVOPLOCK(vp, LK_SHARED); @@ -2957,13 +2957,13 @@ nfs_advlock(struct vop_advlock_args *ap) return (error); if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOLOCKD) != 0) { size = VTONFS(vp)->n_size; - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); error = lf_advlock(ap, &(vp->v_lockf), size); } else { if (nfs_advlock_p != NULL) error = nfs_advlock_p(ap); else { - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); error = ENOLCK; } } @@ -2988,10 +2988,10 @@ nfs_advlockasync(struct vop_advlockasync return (error); if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOLOCKD) != 0) { size = VTONFS(vp)->n_size; - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); error = lf_advlockasync(ap, &(vp->v_lockf), size); } else { - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); error = EOPNOTSUPP; } return (error); Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Sat Aug 13 17:17:59 2011 (r224847) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Sat Aug 13 17:18:45 2011 (r224848) @@ -121,7 +121,7 @@ nfsvno_getattr(struct vnode *vp, struct } error = VOP_GETATTR(vp, &nvap->na_vattr, cred); if (lockedit != 0) - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); return (error); } @@ -189,7 +189,7 @@ nfsvno_accchk(struct vnode *vp, accmode_ } if (error != 0) { if (vpislocked == 0) - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); return (error); } @@ -229,7 +229,7 @@ nfsvno_accchk(struct vnode *vp, accmode_ } } if (vpislocked == 0) - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); return (error); } @@ -1097,7 +1097,7 @@ nfsvno_rename(struct nameidata *fromndp, if (ndflag & ND_NFSV4) { if (NFSVOPLOCK(fvp, LK_EXCLUSIVE) == 0) { error = nfsrv_checkremove(fvp, 0, p); - VOP_UNLOCK(fvp, 0); + NFSVOPUNLOCK(fvp, 0); } else error = EPERM; if (tvp && !error) @@ -1165,7 +1165,7 @@ nfsvno_link(struct nameidata *ndp, struc vrele(ndp->ni_dvp); else vput(ndp->ni_dvp); - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); } else { if (ndp->ni_dvp == ndp->ni_vp) vrele(ndp->ni_dvp); @@ -1884,7 +1884,7 @@ again: */ mp = vp->v_mount; vfs_ref(mp); - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); nd->nd_repstat = vfs_busy(mp, 0); vfs_rel(mp); if (nd->nd_repstat != 0) { @@ -1998,7 +1998,7 @@ again: r = VOP_LOOKUP(vp, &nvp, &cn); if (vp != nvp) - VOP_UNLOCK(vp, + NFSVOPUNLOCK(vp, 0); } } @@ -2077,7 +2077,7 @@ again: if (nvp != NULL) { supports_nfsv4acls = nfs_supportsnfsv4acls(nvp); - VOP_UNLOCK(nvp, 0); + NFSVOPUNLOCK(nvp, 0); } else supports_nfsv4acls = 0; if (refp != NULL) { Modified: stable/8/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Sat Aug 13 17:17:59 2011 (r224847) +++ stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Sat Aug 13 17:18:45 2011 (r224848) @@ -235,7 +235,7 @@ nfsrvd_getattr(struct nfsrv_descript *nd } else at_root = 0; vfs_ref(mp); - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); if (at_root != 0) { if ((nd->nd_repstat = NFSVOPLOCK(tvp, LK_SHARED)) == 0) { @@ -1276,7 +1276,7 @@ nfsrvd_mknod(struct nfsrv_descript *nd, nd->nd_repstat = nfsvno_getattr(vp, &nva, nd->nd_cred, p, 1); if (vpp != NULL && nd->nd_repstat == 0) { - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); *vpp = vp; } else vput(vp); @@ -1735,7 +1735,7 @@ nfsrvd_symlinksub(struct nfsrv_descript nvap, nd->nd_cred, p, 1); } if (vpp != NULL && nd->nd_repstat == 0) { - VOP_UNLOCK(ndp->ni_vp, 0); + NFSVOPUNLOCK(ndp->ni_vp, 0); *vpp = ndp->ni_vp; } else vput(ndp->ni_vp); Modified: stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c Sat Aug 13 17:17:59 2011 (r224847) +++ stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c Sat Aug 13 17:18:45 2011 (r224848) @@ -705,7 +705,7 @@ nfsrvd_compound(struct nfsrv_descript *n vrele(vp); vp = nvp; cur_fsid = vp->v_mount->mnt_stat.f_fsid; - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); vpnes = nes; } break; @@ -720,7 +720,7 @@ nfsrvd_compound(struct nfsrv_descript *n vrele(vp); vp = nvp; cur_fsid = vp->v_mount->mnt_stat.f_fsid; - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); vpnes = nes; } break; @@ -733,7 +733,7 @@ nfsrvd_compound(struct nfsrv_descript *n vrele(vp); vp = nvp; cur_fsid = vp->v_mount->mnt_stat.f_fsid; - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); vpnes = nes; } } else @@ -840,7 +840,7 @@ nfsrvd_compound(struct nfsrv_descript *n } } /* Lookup ops return a locked vnode */ - VOP_UNLOCK(nvp, 0); + NFSVOPUNLOCK(nvp, 0); } if (!nd->nd_repstat) { vrele(vp); Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Sat Aug 13 17:17:59 2011 (r224847) +++ stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Sat Aug 13 17:18:45 2011 (r224848) @@ -4099,7 +4099,7 @@ nfsrv_updatestable(NFSPROC_T *p) if (NFSVOPLOCK(vp, LK_EXCLUSIVE) == 0) { error = nfsvno_setattr(vp, &nva, NFSFPCRED(sf->nsf_fp), p, NULL); - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); } else error = EPERM; vn_finished_write(mp); @@ -4249,7 +4249,7 @@ nfsrv_clientconflict(struct nfsclient *c if (*haslockp == 0) { NFSUNLOCKSTATE(); lktype = VOP_ISLOCKED(vp); - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); NFSLOCKV4ROOTMUTEX(); nfsv4_relref(&nfsv4rootfs_lock); do { @@ -4417,7 +4417,7 @@ nfsrv_delegconflict(struct nfsstate *stp if (*haslockp == 0) { NFSUNLOCKSTATE(); lktype = VOP_ISLOCKED(vp); - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); NFSLOCKV4ROOTMUTEX(); nfsv4_relref(&nfsv4rootfs_lock); do { @@ -4628,7 +4628,7 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO do { if (NFSVOPLOCK(vp, LK_EXCLUSIVE) == 0) { error = nfsrv_checkremove(vp, 0, p); - VOP_UNLOCK(vp, 0); + NFSVOPUNLOCK(vp, 0); } else error = EPERM; if (error == NFSERR_DELAY) { From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 17:19:24 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5F9E106566B; Sat, 13 Aug 2011 17:19:24 +0000 (UTC) (envelope-from zack@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC72D8FC15; Sat, 13 Aug 2011 17:19:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DHJOjh025815; Sat, 13 Aug 2011 17:19:24 GMT (envelope-from zack@svn.freebsd.org) Received: (from zack@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DHJOF7025809; Sat, 13 Aug 2011 17:19:24 GMT (envelope-from zack@svn.freebsd.org) Message-Id: <201108131719.p7DHJOF7025809@svn.freebsd.org> From: Zack Kirsch Date: Sat, 13 Aug 2011 17:19:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224849 - in stable/8/sys/fs: nfsclient nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 17:19:25 -0000 Author: zack Date: Sat Aug 13 17:19:24 2011 New Revision: 224849 URL: http://svn.freebsd.org/changeset/base/224849 Log: MFC: r224083 Simple find/replace of VOP_ISLOCKED -> NFSVOPISLOCKED. This is done so that NFSVOPISLOCKED can be modified later to add enhanced logging and assertions. Modified: stable/8/sys/fs/nfsclient/nfs_clsubs.c stable/8/sys/fs/nfsclient/nfs_clvfsops.c stable/8/sys/fs/nfsclient/nfs_clvnops.c stable/8/sys/fs/nfsserver/nfs_nfsdport.c stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clsubs.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clsubs.c Sat Aug 13 17:18:45 2011 (r224848) +++ stable/8/sys/fs/nfsclient/nfs_clsubs.c Sat Aug 13 17:19:24 2011 (r224849) @@ -140,7 +140,7 @@ ncl_upgrade_vnlock(struct vnode *vp) int old_lock; ASSERT_VOP_LOCKED(vp, "ncl_upgrade_vnlock"); - old_lock = VOP_ISLOCKED(vp); + old_lock = NFSVOPISLOCKED(vp); if (old_lock != LK_EXCLUSIVE) { KASSERT(old_lock == LK_SHARED, ("ncl_upgrade_vnlock: wrong old_lock %d", old_lock)); Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvfsops.c Sat Aug 13 17:18:45 2011 (r224848) +++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c Sat Aug 13 17:19:24 2011 (r224849) @@ -1473,7 +1473,7 @@ loop: VI_LOCK(vp); MNT_IUNLOCK(mp); /* XXX Racy bv_cnt check. */ - if (VOP_ISLOCKED(vp) || vp->v_bufobj.bo_dirty.bv_cnt == 0 || + if (NFSVOPISLOCKED(vp) || vp->v_bufobj.bo_dirty.bv_cnt == 0 || waitfor == MNT_LAZY) { VI_UNLOCK(vp); MNT_ILOCK(mp); Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Sat Aug 13 17:18:45 2011 (r224848) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Sat Aug 13 17:19:24 2011 (r224849) @@ -1171,7 +1171,7 @@ nfs_lookup(struct vop_lookup_args *ap) } if (flags & ISDOTDOT) { - ltype = VOP_ISLOCKED(dvp); + ltype = NFSVOPISLOCKED(dvp); error = vfs_busy(mp, MBF_NOWAIT); if (error != 0) { vfs_ref(mp); Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Sat Aug 13 17:18:45 2011 (r224848) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Sat Aug 13 17:19:24 2011 (r224849) @@ -114,7 +114,7 @@ nfsvno_getattr(struct vnode *vp, struct * locked by this thread or not locked by this thread. * As such, shared lock it, if not exclusively locked. */ - if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) { + if (NFSVOPISLOCKED(vp) != LK_EXCLUSIVE) { lockedit = 1; NFSVOPLOCK(vp, LK_SHARED | LK_RETRY); } Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Sat Aug 13 17:18:45 2011 (r224848) +++ stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Sat Aug 13 17:19:24 2011 (r224849) @@ -4248,7 +4248,7 @@ nfsrv_clientconflict(struct nfsclient *c return (0); if (*haslockp == 0) { NFSUNLOCKSTATE(); - lktype = VOP_ISLOCKED(vp); + lktype = NFSVOPISLOCKED(vp); NFSVOPUNLOCK(vp, 0); NFSLOCKV4ROOTMUTEX(); nfsv4_relref(&nfsv4rootfs_lock); @@ -4416,7 +4416,7 @@ nfsrv_delegconflict(struct nfsstate *stp */ if (*haslockp == 0) { NFSUNLOCKSTATE(); - lktype = VOP_ISLOCKED(vp); + lktype = NFSVOPISLOCKED(vp); NFSVOPUNLOCK(vp, 0); NFSLOCKV4ROOTMUTEX(); nfsv4_relref(&nfsv4rootfs_lock); @@ -4610,7 +4610,7 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO nfsrv_issuedelegs == 0) return; - KASSERT((VOP_ISLOCKED(vp) != LK_EXCLUSIVE), ("vp %p is locked", vp)); + KASSERT((NFSVOPISLOCKED(vp) != LK_EXCLUSIVE), ("vp %p is locked", vp)); /* * First, get a reference on the nfsv4rootfs_lock so that an * exclusive lock cannot be acquired by another thread. From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 17:20:01 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 519A91065670; Sat, 13 Aug 2011 17:20:01 +0000 (UTC) (envelope-from zack@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 39FEA8FC13; Sat, 13 Aug 2011 17:20:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DHK1qr025889; Sat, 13 Aug 2011 17:20:01 GMT (envelope-from zack@svn.freebsd.org) Received: (from zack@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DHK1xW025888; Sat, 13 Aug 2011 17:20:01 GMT (envelope-from zack@svn.freebsd.org) Message-Id: <201108131720.p7DHK1xW025888@svn.freebsd.org> From: Zack Kirsch Date: Sat, 13 Aug 2011 17:20:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224850 - stable/8/sys/kgssapi X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 17:20:01 -0000 Author: zack Date: Sat Aug 13 17:20:00 2011 New Revision: 224850 URL: http://svn.freebsd.org/changeset/base/224850 Log: MFC: 224084 Add a small comment about unloading the kgsappi module. Modified: stable/8/sys/kgssapi/gss_impl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kgssapi/gss_impl.c ============================================================================== --- stable/8/sys/kgssapi/gss_impl.c Sat Aug 13 17:19:24 2011 (r224849) +++ stable/8/sys/kgssapi/gss_impl.c Sat Aug 13 17:20:00 2011 (r224850) @@ -282,7 +282,11 @@ kgssapi_modevent(module_t mod, int type, rpc_gss_svc_max_data_length; break; case MOD_UNLOAD: - /* Unloading of the kgssapi module isn't supported. */ + /* + * Unloading of the kgssapi module is not currently supported. + * If somebody wants this, we would need to keep track of + * currently executing threads and make sure the count is 0. + */ /* FALLTHROUGH */ default: error = EOPNOTSUPP; From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 17:21:50 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFB75106566C; Sat, 13 Aug 2011 17:21:50 +0000 (UTC) (envelope-from zack@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE06B8FC1A; Sat, 13 Aug 2011 17:21:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DHLoc4026002; Sat, 13 Aug 2011 17:21:50 GMT (envelope-from zack@svn.freebsd.org) Received: (from zack@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DHLoo3025993; Sat, 13 Aug 2011 17:21:50 GMT (envelope-from zack@svn.freebsd.org) Message-Id: <201108131721.p7DHLoo3025993@svn.freebsd.org> From: Zack Kirsch Date: Sat, 13 Aug 2011 17:21:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224851 - in stable/8/sys/fs: nfs nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 17:21:50 -0000 Author: zack Date: Sat Aug 13 17:21:50 2011 New Revision: 224851 URL: http://svn.freebsd.org/changeset/base/224851 Log: MFC r224086: Add DEXITCODE plumbing to NFS. Isilon has the concept of an in-memory exit-code ring that saves the last exit code of a function and allows for stack tracing. This is very helpful when debugging tough issues. This patch is essentially a no-op for BSD at this point, until we upstream the dexitcode logic itself. The patch adds DEXITCODE calls to every NFS function that returns an errno error code. A number of code paths were also reorganized to have single exit paths, to reduce code duplication. Submitted by: David Kwan Modified: stable/8/sys/fs/nfs/nfs_commonacl.c stable/8/sys/fs/nfs/nfs_commonkrpc.c stable/8/sys/fs/nfs/nfs_commonport.c stable/8/sys/fs/nfs/nfs_commonsubs.c stable/8/sys/fs/nfs/nfsdport.h stable/8/sys/fs/nfsserver/nfs_nfsdcache.c stable/8/sys/fs/nfsserver/nfs_nfsdkrpc.c stable/8/sys/fs/nfsserver/nfs_nfsdport.c stable/8/sys/fs/nfsserver/nfs_nfsdserv.c stable/8/sys/fs/nfsserver/nfs_nfsdsocket.c stable/8/sys/fs/nfsserver/nfs_nfsdstate.c stable/8/sys/fs/nfsserver/nfs_nfsdsubs.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_commonacl.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonacl.c Sat Aug 13 17:20:00 2011 (r224850) +++ stable/8/sys/fs/nfs/nfs_commonacl.c Sat Aug 13 17:21:50 2011 (r224851) @@ -59,7 +59,8 @@ nfsrv_dissectace(struct nfsrv_descript * mask = fxdr_unsigned(u_int32_t, *tl++); len = fxdr_unsigned(int, *tl); if (len < 0) { - return (NFSERR_BADXDR); + error = NFSERR_BADXDR; + goto nfsmout; } else if (len == 0) { /* Netapp filers return a 0 length who for nil users */ acep->ae_tag = ACL_UNDEFINED_TAG; @@ -68,7 +69,8 @@ nfsrv_dissectace(struct nfsrv_descript * acep->ae_entry_type = ACL_ENTRY_TYPE_DENY; if (acesizep) *acesizep = 4 * NFSX_UNSIGNED; - return (0); + error = 0; + goto nfsmout; } if (len > NFSV4_SMALLSTR) name = malloc(len + 1, M_NFSSTRING, M_WAITOK); @@ -78,7 +80,7 @@ nfsrv_dissectace(struct nfsrv_descript * if (error) { if (len > NFSV4_SMALLSTR) free(name, M_NFSSTRING); - return (error); + goto nfsmout; } if (len == 6) { if (!NFSBCMP(name, "OWNER@", 6)) { @@ -171,8 +173,9 @@ nfsrv_dissectace(struct nfsrv_descript * *aceerrp = aceerr; if (acesizep) *acesizep = NFSM_RNDUP(len) + (4 * NFSX_UNSIGNED); - return (0); + error = 0; nfsmout: + NFSEXITCODE(error); return (error); } @@ -184,6 +187,7 @@ nfsrv_acemasktoperm(u_int32_t acetype, u enum vtype type, acl_perm_t *permp) { acl_perm_t perm = 0x0; + int error = 0; if (mask & NFSV4ACE_READDATA) { mask &= ~NFSV4ACE_READDATA; @@ -257,10 +261,15 @@ nfsrv_acemasktoperm(u_int32_t acetype, u mask &= ~NFSV4ACE_SYNCHRONIZE; perm |= ACL_SYNCHRONIZE; } - if (mask != 0) - return (NFSERR_ATTRNOTSUPP); + if (mask != 0) { + error = NFSERR_ATTRNOTSUPP; + goto out; + } *permp = perm; - return (0); + +out: + NFSEXITCODE(error); + return (error); } /* local functions */ @@ -445,19 +454,26 @@ nfsrv_setacl(vnode_t vp, NFSACL_T *aclp, { int error; - if (nfsrv_useacl == 0 || nfs_supportsnfsv4acls(vp) == 0) - return (NFSERR_ATTRNOTSUPP); + if (nfsrv_useacl == 0 || nfs_supportsnfsv4acls(vp) == 0) { + error = NFSERR_ATTRNOTSUPP; + goto out; + } /* * With NFSv4 ACLs, chmod(2) may need to add additional entries. * Make sure it has enough room for that - splitting every entry * into two and appending "canonical six" entries at the end. * Cribbed out of kern/vfs_acl.c - Rick M. */ - if (aclp->acl_cnt > (ACL_MAX_ENTRIES - 6) / 2) - return (NFSERR_ATTRNOTSUPP); + if (aclp->acl_cnt > (ACL_MAX_ENTRIES - 6) / 2) { + error = NFSERR_ATTRNOTSUPP; + goto out; + } error = VOP_ACLCHECK(vp, ACL_TYPE_NFS4, aclp, cred, p); if (!error) error = VOP_SETACL(vp, ACL_TYPE_NFS4, aclp, cred, p); + +out: + NFSEXITCODE(error); return (error); } Modified: stable/8/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonkrpc.c Sat Aug 13 17:20:00 2011 (r224850) +++ stable/8/sys/fs/nfs/nfs_commonkrpc.c Sat Aug 13 17:21:50 2011 (r224851) @@ -143,7 +143,7 @@ newnfs_connect(struct nfsmount *nmp, str CLIENT *client; struct netconfig *nconf; struct socket *so; - int one = 1, retries, error; + int one = 1, retries, error = 0; struct thread *td = curthread; /* @@ -199,7 +199,7 @@ newnfs_connect(struct nfsmount *nmp, str nrp->nr_soproto, td->td_ucred, td); if (error) { td->td_ucred = origcred; - return (error); + goto out; } do { if (error != 0 && pktscale > 2) @@ -230,7 +230,7 @@ newnfs_connect(struct nfsmount *nmp, str soclose(so); if (error) { td->td_ucred = origcred; - return (error); + goto out; } client = clnt_reconnect_create(nconf, saddr, nrp->nr_prog, @@ -284,7 +284,10 @@ newnfs_connect(struct nfsmount *nmp, str /* Restore current thread's credentials. */ td->td_ucred = origcred; - return (0); + +out: + NFSEXITCODE(error); + return (error); } /* Modified: stable/8/sys/fs/nfs/nfs_commonport.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonport.c Sat Aug 13 17:20:00 2011 (r224850) +++ stable/8/sys/fs/nfs/nfs_commonport.c Sat Aug 13 17:21:50 2011 (r224851) @@ -331,6 +331,7 @@ nfsvno_pathconf(struct vnode *vp, int fl }; error = 0; } + NFSEXITCODE(error); return (error); } @@ -429,6 +430,7 @@ nfssvc_nfscommon(struct thread *td, stru int error; error = nfssvc_call(td, uap, td->td_ucred); + NFSEXITCODE(error); return (error); } @@ -441,9 +443,9 @@ nfssvc_call(struct thread *p, struct nfs if (uap->flag & NFSSVC_IDNAME) { error = copyin(uap->argp, (caddr_t)&nid, sizeof (nid)); if (error) - return (error); + goto out; error = nfssvc_idname(&nid); - return (error); + goto out; } else if (uap->flag & NFSSVC_GETSTATS) { error = copyout(&newnfsstats, CAST_USER_ADDR_T(uap->argp), sizeof (newnfsstats)); @@ -505,7 +507,7 @@ nfssvc_call(struct thread *p, struct nfs sizeof(newnfsstats.cbrpccnt)); } } - return (error); + goto out; } else if (uap->flag & NFSSVC_NFSUSERDPORT) { u_short sockport; @@ -517,6 +519,9 @@ nfssvc_call(struct thread *p, struct nfs nfsrv_nfsuserddelport(); error = 0; } + +out: + NFSEXITCODE(error); return (error); } @@ -571,7 +576,7 @@ nfscommon_modevent(module_t mod, int typ switch (type) { case MOD_LOAD: if (loaded) - return (0); + goto out; newnfs_portinit(); mtx_init(&nfs_nameid_mutex, "nfs_nameid_mutex", NULL, MTX_DEF); mtx_init(&nfs_sockl_mutex, "nfs_sockl_mutex", NULL, MTX_DEF); @@ -608,6 +613,9 @@ nfscommon_modevent(module_t mod, int typ error = EOPNOTSUPP; break; } + +out: + NFSEXITCODE(error); return error; } static moduledata_t nfscommon_mod = { Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonsubs.c Sat Aug 13 17:20:00 2011 (r224850) +++ stable/8/sys/fs/nfs/nfs_commonsubs.c Sat Aug 13 17:21:50 2011 (r224851) @@ -179,8 +179,10 @@ nfsm_mbufuio(struct nfsrv_descript *nd, len = NFSMTOD(mp, caddr_t) + mbuf_len(mp) - mbufcp; rem = NFSM_RNDUP(siz) - siz; while (siz > 0) { - if (uiop->uio_iovcnt <= 0 || uiop->uio_iov == NULL) - return (EBADRPC); + if (uiop->uio_iovcnt <= 0 || uiop->uio_iov == NULL) { + error = EBADRPC; + goto out; + } left = uiop->uio_iov->iov_len; uiocp = uiop->uio_iov->iov_base; if (left > siz) @@ -189,8 +191,10 @@ nfsm_mbufuio(struct nfsrv_descript *nd, while (left > 0) { while (len == 0) { mp = mbuf_next(mp); - if (mp == NULL) - return (EBADRPC); + if (mp == NULL) { + error = EBADRPC; + goto out; + } mbufcp = NFSMTOD(mp, caddr_t); len = mbuf_len(mp); } @@ -231,6 +235,9 @@ nfsm_mbufuio(struct nfsrv_descript *nd, else nd->nd_dpos += rem; } + +out: + NFSEXITCODE2(error, nd); return (error); } #endif /* !APPLE */ @@ -308,9 +315,10 @@ nfsm_dissct(struct nfsrv_descript *nd, i APPLESTATIC int nfsm_advance(struct nfsrv_descript *nd, int offs, int left) { + int error = 0; if (offs == 0) - return (0); + goto out; /* * A negative offs should be considered a serious problem. */ @@ -330,13 +338,18 @@ nfsm_advance(struct nfsrv_descript *nd, while (offs > left) { offs -= left; nd->nd_md = mbuf_next(nd->nd_md); - if (nd->nd_md == NULL) - return (EBADRPC); + if (nd->nd_md == NULL) { + error = EBADRPC; + goto out; + } left = mbuf_len(nd->nd_md); nd->nd_dpos = NFSMTOD(nd->nd_md, caddr_t); } nd->nd_dpos += offs; - return (0); + +out: + NFSEXITCODE(error); + return (error); } /* @@ -620,8 +633,10 @@ nfsm_getfh(struct nfsrv_descript *nd, st if (nd->nd_flag & (ND_NFSV3 | ND_NFSV4)) { NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); if ((len = fxdr_unsigned(int, *tl)) <= 0 || - len > NFSX_FHMAX) - return (EBADRPC); + len > NFSX_FHMAX) { + error = EBADRPC; + goto nfsmout; + } } else len = NFSX_V2FH; MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + len, @@ -629,11 +644,12 @@ nfsm_getfh(struct nfsrv_descript *nd, st error = nfsrv_mtostr(nd, nfhp->nfh_fh, len); if (error) { FREE((caddr_t)nfhp, M_NFSFH); - return (error); + goto nfsmout; } nfhp->nfh_len = len; *nfhpp = nfhp; nfsmout: + NFSEXITCODE2(error, nd); return (error); } @@ -670,7 +686,7 @@ nfsrv_dissectacl(struct nfsrv_descript * else error = nfsrv_skipace(nd, &acesize); if (error) - return (error); + goto nfsmout; aclsize += acesize; } if (aclp && !aceerr) @@ -680,6 +696,7 @@ nfsrv_dissectacl(struct nfsrv_descript * if (aclsizep) *aclsizep = aclsize; nfsmout: + NFSEXITCODE2(error, nd); return (error); } @@ -697,6 +714,7 @@ nfsrv_skipace(struct nfsrv_descript *nd, error = nfsm_advance(nd, NFSM_RNDUP(len), -1); nfsmout: *acesizep = NFSM_RNDUP(len) + (4 * NFSX_UNSIGNED); + NFSEXITCODE2(error, nd); return (error); } @@ -715,8 +733,10 @@ nfsrv_getattrbits(struct nfsrv_descript NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); cnt = fxdr_unsigned(int, *tl); - if (cnt < 0) - return (NFSERR_BADXDR); + if (cnt < 0) { + error = NFSERR_BADXDR; + goto nfsmout; + } if (cnt > NFSATTRBIT_MAXWORDS) { outcnt = NFSATTRBIT_MAXWORDS; if (retnotsupp) @@ -735,6 +755,7 @@ nfsrv_getattrbits(struct nfsrv_descript if (cntp) *cntp = NFSX_UNSIGNED + (cnt * NFSX_UNSIGNED); nfsmout: + NFSEXITCODE2(error, nd); return (error); } @@ -756,7 +777,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd u_int32_t *leasep, u_int32_t *rderrp, NFSPROC_T *p, struct ucred *cred) { u_int32_t *tl; - int i = 0, j, k, l, m, bitpos, attrsum = 0; + int i = 0, j, k, l = 0, m, bitpos, attrsum = 0; int error, tfhsize, aceerr, attrsize, cnt, retnotsup; u_char *cp, *cp2, namestr[NFSV4_SMALLSTR + 1]; nfsattrbit_t attrbits, retattrbits, checkattrbits; @@ -782,7 +803,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd error = nfsrv_getattrbits(nd, &attrbits, NULL, NULL); } if (error) - return (error); + goto nfsmout; if (compare) { *retcmpp = retnotsup; @@ -853,7 +874,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd error = nfsrv_getattrbits(nd, &nap->na_suppattr, &cnt, &retnotsup); if (error) - return (error); + goto nfsmout; if (compare && !(*retcmpp)) { NFSSETSUPP_ATTRBIT(&checkattrbits); if (!NFSEQUAL_ATTRBIT(&retattrbits, &checkattrbits) @@ -1014,7 +1035,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd &cnt, p); if (error) { acl_free(naclp); - return (error); + goto nfsmout; } if (aceerr || nfsrv_compareacl(aclp, naclp)) *retcmpp = NFSERR_NOTSAME; @@ -1033,7 +1054,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd error = nfsrv_dissectacl(nd, NULL, &aceerr, &cnt, p); if (error) - return (error); + goto nfsmout; } attrsum += cnt; break; @@ -1118,7 +1139,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd case NFSATTRBIT_FILEHANDLE: error = nfsm_getfh(nd, &tnfhp); if (error) - return (error); + goto nfsmout; tfhsize = tnfhp->nfh_len; if (compare) { if (!(*retcmpp) && @@ -1184,7 +1205,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd case NFSATTRBIT_FSLOCATIONS: error = nfsrv_getrefstr(nd, &cp, &cp2, &l, &m); if (error) - return (error); + goto nfsmout; attrsum += l; if (compare && !(*retcmpp)) { refp = nfsv4root_getreferral(vp, NULL, 0); @@ -1360,8 +1381,10 @@ nfsv4_loadattr(struct nfsrv_descript *nd case NFSATTRBIT_OWNER: NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); j = fxdr_unsigned(int, *tl); - if (j < 0) - return (NFSERR_BADXDR); + if (j < 0) { + error = NFSERR_BADXDR; + goto nfsmout; + } attrsum += (NFSX_UNSIGNED + NFSM_RNDUP(j)); if (j > NFSV4_SMALLSTR) cp = malloc(j + 1, M_NFSSTRING, M_WAITOK); @@ -1371,7 +1394,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd if (error) { if (j > NFSV4_SMALLSTR) free(cp, M_NFSSTRING); - return (error); + goto nfsmout; } if (compare) { if (!(*retcmpp)) { @@ -1391,8 +1414,10 @@ nfsv4_loadattr(struct nfsrv_descript *nd case NFSATTRBIT_OWNERGROUP: NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); j = fxdr_unsigned(int, *tl); - if (j < 0) - return (NFSERR_BADXDR); + if (j < 0) { + error = NFSERR_BADXDR; + goto nfsmout; + } attrsum += (NFSX_UNSIGNED + NFSM_RNDUP(j)); if (j > NFSV4_SMALLSTR) cp = malloc(j + 1, M_NFSSTRING, M_WAITOK); @@ -1402,7 +1427,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd if (error) { if (j > NFSV4_SMALLSTR) free(cp, M_NFSSTRING); - return (error); + goto nfsmout; } if (compare) { if (!(*retcmpp)) { @@ -1708,6 +1733,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd error = nfsm_advance(nd, attrsize - attrsum, -1); } nfsmout: + NFSEXITCODE2(error, nd); return (error); } @@ -1904,8 +1930,10 @@ nfsrv_mtostr(struct nfsrv_descript *nd, siz -= xfer; if (siz > 0) { mp = mbuf_next(mp); - if (mp == NULL) - return (EBADRPC); + if (mp == NULL) { + error = EBADRPC; + goto out; + } cp = NFSMTOD(mp, caddr_t); len = mbuf_len(mp); } else { @@ -1922,6 +1950,9 @@ nfsrv_mtostr(struct nfsrv_descript *nd, else nd->nd_dpos += rem; } + +out: + NFSEXITCODE2(error, nd); return (error); } @@ -2568,9 +2599,12 @@ nfsv4_strtouid(u_char *str, int len, uid u_char *cp; struct nfsusrgrp *usrp; int cnt, ret; + int error = 0; - if (len == 0) - return (NFSERR_BADOWNER); + if (len == 0) { + error = NFSERR_BADOWNER; + goto out; + } /* * Look for an '@'. */ @@ -2601,7 +2635,8 @@ tryagain: if (len == 6 && !NFSBCMP(str, "nobody", 6)) { *uidp = nfsrv_defaultuid; NFSUNLOCKNAMEID(); - return (0); + error = 0; + goto out; } LIST_FOREACH(usrp, NFSUSERNAMEHASH(str, len), lug_namehash) { @@ -2613,7 +2648,8 @@ tryagain: TAILQ_REMOVE(&nfsuserlruhead, usrp, lug_lru); TAILQ_INSERT_TAIL(&nfsuserlruhead, usrp, lug_lru); NFSUNLOCKNAMEID(); - return (0); + error = 0; + goto out; } } NFSUNLOCKNAMEID(); @@ -2622,7 +2658,11 @@ tryagain: str, p); if (ret == 0 && cnt < 2) goto tryagain; - return (NFSERR_BADOWNER); + error = NFSERR_BADOWNER; + +out: + NFSEXITCODE(error); + return (error); } /* @@ -2748,9 +2788,12 @@ nfsv4_strtogid(u_char *str, int len, gid u_char *cp; struct nfsusrgrp *usrp; int cnt, ret; + int error = 0; - if (len == 0) - return (NFSERR_BADOWNER); + if (len == 0) { + error = NFSERR_BADOWNER; + goto out; + } /* * Look for an '@'. */ @@ -2779,7 +2822,8 @@ tryagain: if (len == 7 && !NFSBCMP(str, "nogroup", 7)) { *gidp = nfsrv_defaultgid; NFSUNLOCKNAMEID(); - return (0); + error = 0; + goto out; } LIST_FOREACH(usrp, NFSGROUPNAMEHASH(str, len), lug_namehash) { @@ -2791,7 +2835,8 @@ tryagain: TAILQ_REMOVE(&nfsuserlruhead, usrp, lug_lru); TAILQ_INSERT_TAIL(&nfsuserlruhead, usrp, lug_lru); NFSUNLOCKNAMEID(); - return (0); + error = 0; + goto out; } } NFSUNLOCKNAMEID(); @@ -2800,7 +2845,11 @@ tryagain: str, p); if (ret == 0 && cnt < 2) goto tryagain; - return (NFSERR_BADOWNER); + error = NFSERR_BADOWNER; + +out: + NFSEXITCODE(error); + return (error); } /* @@ -2845,7 +2894,8 @@ nfsrv_nfsuserdport(u_short port, NFSPROC NFSLOCKNAMEID(); if (nfsrv_nfsuserd) { NFSUNLOCKNAMEID(); - return (EPERM); + error = EPERM; + goto out; } nfsrv_nfsuserd = 1; NFSUNLOCKNAMEID(); @@ -2871,6 +2921,8 @@ nfsrv_nfsuserdport(u_short port, NFSPROC NFSSOCKADDRFREE(rp->nr_nam); nfsrv_nfsuserd = 0; } +out: + NFSEXITCODE(error); return (error); } @@ -2910,7 +2962,8 @@ nfsrv_getuser(int procnum, uid_t uid, gi NFSLOCKNAMEID(); if (nfsrv_nfsuserd == 0) { NFSUNLOCKNAMEID(); - return (EPERM); + error = EPERM; + goto out; } NFSUNLOCKNAMEID(); nd = &nfsd; @@ -2936,6 +2989,8 @@ nfsrv_getuser(int procnum, uid_t uid, gi mbuf_freem(nd->nd_mrep); error = nd->nd_repstat; } +out: + NFSEXITCODE(error); return (error); } @@ -2992,7 +3047,7 @@ nfssvc_idname(struct nfsd_idargs *nidp) NFSUNLOCKNAMEID(); if (error) free(cp, M_NFSSTRING); - return (error); + goto out; } /* @@ -3005,7 +3060,7 @@ nfssvc_idname(struct nfsd_idargs *nidp) nidp->nid_namelen); if (error) { free((caddr_t)newusrp, M_NFSUSERGROUP); - return (error); + goto out; } newusrp->lug_namelen = nidp->nid_namelen; @@ -3080,6 +3135,8 @@ nfssvc_idname(struct nfsd_idargs *nidp) } else FREE((caddr_t)newusrp, M_NFSUSERGROUP); NFSUNLOCKNAMEID(); +out: + NFSEXITCODE(error); return (error); } @@ -3109,6 +3166,7 @@ nfsrv_checkutf8(u_int8_t *cp, int len) int cnt = 0, gotd = 0, shift = 0; u_int8_t byte; static int utf8_shift[5] = { 7, 11, 16, 21, 26 }; + int error = 0; /* * Here are what the variables are used for: @@ -3125,14 +3183,18 @@ nfsrv_checkutf8(u_int8_t *cp, int len) if (cnt > 0) { /* This handles the 10xxxxxx bytes */ if ((*cp & 0xc0) != 0x80 || - (gotd && (*cp & 0x20))) - return (NFSERR_INVAL); + (gotd && (*cp & 0x20))) { + error = NFSERR_INVAL; + goto out; + } gotd = 0; val <<= 6; val |= (*cp & 0x3f); cnt--; - if (cnt == 0 && (val >> shift) == 0x0) - return (NFSERR_INVAL); + if (cnt == 0 && (val >> shift) == 0x0) { + error = NFSERR_INVAL; + goto out; + } } else if (*cp & 0x80) { /* first byte of multi byte char */ byte = *cp; @@ -3140,8 +3202,10 @@ nfsrv_checkutf8(u_int8_t *cp, int len) cnt++; byte <<= 1; } - if (cnt == 0 || cnt == 6) - return (NFSERR_INVAL); + if (cnt == 0 || cnt == 6) { + error = NFSERR_INVAL; + goto out; + } val = (*cp & (0x3f >> cnt)); shift = utf8_shift[cnt - 1]; if (cnt == 2 && val == 0xd) @@ -3152,8 +3216,11 @@ nfsrv_checkutf8(u_int8_t *cp, int len) len--; } if (cnt > 0) - return (NFSERR_INVAL); - return (0); + error = NFSERR_INVAL; + +out: + NFSEXITCODE(error); + return (error); } /* @@ -3174,7 +3241,7 @@ nfsrv_getrefstr(struct nfsrv_descript *n { u_int32_t *tl; u_char *cp = NULL, *cp2 = NULL, *cp3, *str; - int i, j, len, stringlen, cnt, slen, siz, xdrsum, error, nsrv; + int i, j, len, stringlen, cnt, slen, siz, xdrsum, error = 0, nsrv; struct list { SLIST_ENTRY(list) next; int len; @@ -3192,15 +3259,20 @@ nfsrv_getrefstr(struct nfsrv_descript *n */ NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); len = fxdr_unsigned(int, *tl); - if (len < 0 || len > 10240) - return (NFSERR_BADXDR); + if (len < 0 || len > 10240) { + error = NFSERR_BADXDR; + goto nfsmout; + } if (len == 0) { NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); - if (*tl != 0) - return (NFSERR_BADXDR); + if (*tl != 0) { + error = NFSERR_BADXDR; + goto nfsmout; + } *nilp = 1; *sump = 2 * NFSX_UNSIGNED; - return (0); + error = 0; + goto nfsmout; } cp = malloc(len + 1, M_NFSSTRING, M_WAITOK); error = nfsrv_mtostr(nd, cp, len); @@ -3210,10 +3282,8 @@ nfsrv_getrefstr(struct nfsrv_descript *n if (cnt <= 0) error = NFSERR_BADXDR; } - if (error) { - free(cp, M_NFSSTRING); - return (error); - } + if (error) + goto nfsmout; /* * Now, loop through the location list and make up the srvlist. @@ -3227,9 +3297,8 @@ nfsrv_getrefstr(struct nfsrv_descript *n NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); nsrv = fxdr_unsigned(int, *tl); if (nsrv <= 0) { - free(cp, M_NFSSTRING); - free(cp2, M_NFSSTRING); - return (NFSERR_BADXDR); + error = NFSERR_BADXDR; + goto nfsmout; } /* @@ -3238,9 +3307,8 @@ nfsrv_getrefstr(struct nfsrv_descript *n NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); len = fxdr_unsigned(int, *tl); if (len <= 0 || len > 1024) { - free(cp, M_NFSSTRING); - free(cp2, M_NFSSTRING); - return (NFSERR_BADXDR); + error = NFSERR_BADXDR; + goto nfsmout; } nfsrv_refstrbigenough(siz + len + 3, &cp2, &cp3, &slen); if (cp3 != cp2) { @@ -3248,11 +3316,8 @@ nfsrv_getrefstr(struct nfsrv_descript *n siz++; } error = nfsrv_mtostr(nd, cp3, len); - if (error) { - free(cp, M_NFSSTRING); - free(cp2, M_NFSSTRING); - return (error); - } + if (error) + goto nfsmout; cp3 += len; *cp3++ = ':'; siz += (len + 1); @@ -3264,18 +3329,14 @@ nfsrv_getrefstr(struct nfsrv_descript *n NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); len = fxdr_unsigned(int, *tl); if (len <= 0 || len > 1024) { - free(cp, M_NFSSTRING); - free(cp2, M_NFSSTRING); - return (NFSERR_BADXDR); + error = NFSERR_BADXDR; + goto nfsmout; } lsp = (struct list *)malloc(sizeof (struct list) + len, M_TEMP, M_WAITOK); error = nfsrv_mtostr(nd, lsp->host, len); - if (error) { - free(cp, M_NFSSTRING); - free(cp2, M_NFSSTRING); - return (error); - } + if (error) + goto nfsmout; xdrsum += NFSX_UNSIGNED + NFSM_RNDUP(len); lsp->len = len; SLIST_INSERT_HEAD(&head, lsp, next); @@ -3287,17 +3348,13 @@ nfsrv_getrefstr(struct nfsrv_descript *n NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); len = fxdr_unsigned(int, *tl); if (len <= 0 || len > 1024) { - free(cp, M_NFSSTRING); - free(cp2, M_NFSSTRING); - return (NFSERR_BADXDR); + error = NFSERR_BADXDR; + goto nfsmout; } nfsrv_refstrbigenough(siz + len + 1, &cp2, &cp3, &slen); error = nfsrv_mtostr(nd, cp3, len); - if (error) { - free(cp, M_NFSSTRING); - free(cp2, M_NFSSTRING); - return (error); - } + if (error) + goto nfsmout; xdrsum += NFSX_UNSIGNED + NFSM_RNDUP(len); str = cp3; stringlen = len; @@ -3320,12 +3377,14 @@ nfsrv_getrefstr(struct nfsrv_descript *n *fsrootp = cp; *srvp = cp2; *sump = xdrsum; + NFSEXITCODE2(0, nd); return (0); nfsmout: if (cp != NULL) free(cp, M_NFSSTRING); if (cp2 != NULL) free(cp2, M_NFSSTRING); + NFSEXITCODE2(error, nd); return (error); } Modified: stable/8/sys/fs/nfs/nfsdport.h ============================================================================== --- stable/8/sys/fs/nfs/nfsdport.h Sat Aug 13 17:20:00 2011 (r224850) +++ stable/8/sys/fs/nfs/nfsdport.h Sat Aug 13 17:21:50 2011 (r224851) @@ -57,6 +57,22 @@ struct nfsexstuff { int nes_secflavors[MAXSECFLAVORS]; /* and the flavors */ }; +/* + * These are NO-OPS for BSD until Isilon upstreams EXITCODE support. + * EXITCODE is an in-memory ring buffer that holds the routines failing status. + * This is a valuable tool to use when debugging and analyzing issues. + * In addition to recording a routine's failing status, it offers + * logging of routines for call stack tracing. + * EXITCODE should be used only in routines that return a true errno value, as + * that value will be formatted to a displayable errno string. Routines that + * return regular int status that are not true errno should not set EXITCODE. + * If you want to log routine tracing, you can add EXITCODE(0) to any routine. + * NFS extended the EXITCODE with EXITCODE2 to record either the routine's + * exit errno status or the nd_repstat. + */ +#define NFSEXITCODE(error) +#define NFSEXITCODE2(error, nd) + #define NFSVNO_EXINIT(e) ((e)->nes_exflag = 0) #define NFSVNO_EXPORTED(e) ((e)->nes_exflag & MNT_EXPORTED) #define NFSVNO_EXRDONLY(e) ((e)->nes_exflag & MNT_EXRDONLY) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdcache.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdcache.c Sat Aug 13 17:20:00 2011 (r224850) +++ stable/8/sys/fs/nfsserver/nfs_nfsdcache.c Sat Aug 13 17:21:50 2011 (r224851) @@ -308,6 +308,7 @@ nfsrvd_getcache(struct nfsrv_descript *n ret = nfsrc_gettcp(nd, newrp); } nfsrc_trimcache(nd->nd_sockref, so); + NFSEXITCODE2(0, nd); return (ret); } @@ -373,7 +374,7 @@ loop: } nfsrc_unlock(rp); free((caddr_t)newrp, M_NFSRVCACHE); - return (ret); + goto out; } } newnfsstats.srvcache_misses++; @@ -394,7 +395,11 @@ loop: TAILQ_INSERT_TAIL(&nfsrvudplru, newrp, rc_lru); NFSUNLOCKCACHE(); nd->nd_rp = newrp; - return (RC_DOIT); + ret = RC_DOIT; + +out: + NFSEXITCODE2(0, nd); + return (ret); } /* @@ -436,8 +441,7 @@ nfsrvd_updatecache(struct nfsrv_descript M_COPYALL, M_WAIT); rp->rc_timestamp = NFSD_MONOSEC + NFSRVCACHE_TCPTIMEOUT; nfsrc_unlock(rp); - nfsrc_trimcache(nd->nd_sockref, so); - return (retrp); + goto out; } /* @@ -492,7 +496,10 @@ nfsrvd_updatecache(struct nfsrv_descript nfsrc_freecache(rp); NFSUNLOCKCACHE(); } + +out: nfsrc_trimcache(nd->nd_sockref, so); + NFSEXITCODE2(0, nd); return (retrp); } @@ -656,7 +663,7 @@ tryagain: } nfsrc_unlock(rp); free((caddr_t)newrp, M_NFSRVCACHE); - return (ret); + goto out; } newnfsstats.srvcache_misses++; newnfsstats.srvcache_size++; @@ -670,7 +677,11 @@ tryagain: LIST_INSERT_HEAD(hp, newrp, rc_hash); NFSUNLOCKCACHE(); nd->nd_rp = newrp; - return (RC_DOIT); + ret = RC_DOIT; + +out: + NFSEXITCODE2(0, nd); + return (ret); } /* Modified: stable/8/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdkrpc.c Sat Aug 13 17:20:00 2011 (r224850) +++ stable/8/sys/fs/nfsserver/nfs_nfsdkrpc.c Sat Aug 13 17:21:50 2011 (r224851) @@ -115,7 +115,7 @@ nfssvc_program(struct svc_req *rqst, SVC if (rqst->rq_proc > NFSV2PROC_STATFS) { svcerr_noproc(rqst); svc_freereq(rqst); - return; + goto out; } nd.nd_procnum = newnfs_nfsv3_procid[rqst->rq_proc]; nd.nd_flag = ND_NFSV2; @@ -123,7 +123,7 @@ nfssvc_program(struct svc_req *rqst, SVC if (rqst->rq_proc >= NFS_V3NPROCS) { svcerr_noproc(rqst); svc_freereq(rqst); - return; + goto out; } nd.nd_procnum = rqst->rq_proc; nd.nd_flag = ND_NFSV3; @@ -132,7 +132,7 @@ nfssvc_program(struct svc_req *rqst, SVC rqst->rq_proc != NFSV4PROC_COMPOUND) { svcerr_noproc(rqst); svc_freereq(rqst); - return; + goto out; } nd.nd_procnum = rqst->rq_proc; nd.nd_flag = ND_NFSV4; @@ -192,7 +192,7 @@ nfssvc_program(struct svc_req *rqst, SVC svcerr_weakauth(rqst); svc_freereq(rqst); m_freem(nd.nd_mrep); - return; + goto out; } } @@ -201,7 +201,7 @@ nfssvc_program(struct svc_req *rqst, SVC svcerr_weakauth(rqst); svc_freereq(rqst); m_freem(nd.nd_mrep); - return; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 17:29:38 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BAC3106566C; Sat, 13 Aug 2011 17:29:38 +0000 (UTC) (envelope-from zack@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF6E88FC17; Sat, 13 Aug 2011 17:29:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DHTbbt026335; Sat, 13 Aug 2011 17:29:37 GMT (envelope-from zack@svn.freebsd.org) Received: (from zack@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DHTbVl026333; Sat, 13 Aug 2011 17:29:37 GMT (envelope-from zack@svn.freebsd.org) Message-Id: <201108131729.p7DHTbVl026333@svn.freebsd.org> From: Zack Kirsch Date: Sat, 13 Aug 2011 17:29:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224853 - stable/8/sys/fs/nfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 17:29:38 -0000 Author: zack Date: Sat Aug 13 17:29:37 2011 New Revision: 224853 URL: http://svn.freebsd.org/changeset/base/224853 Log: MFC r224079 and r224121: r224121 was meant to revert r224079, except I accidentally checked in an additional ACL patch in r224121. Committing both of these ends up with just the ACL fix. Here is the real commit note for the ACL patch: Running pynfs verify/nverify tests produces a panic in nfsrv_compareacl(). This patch fixes the panic. Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonsubs.c Sat Aug 13 17:22:16 2011 (r224852) +++ stable/8/sys/fs/nfs/nfs_commonsubs.c Sat Aug 13 17:29:37 2011 (r224853) @@ -1037,7 +1037,8 @@ nfsv4_loadattr(struct nfsrv_descript *nd acl_free(naclp); goto nfsmout; } - if (aceerr || nfsrv_compareacl(aclp, naclp)) + if (aceerr || aclp == NULL || + nfsrv_compareacl(aclp, naclp)) *retcmpp = NFSERR_NOTSAME; acl_free(naclp); } else { From owner-svn-src-stable-8@FreeBSD.ORG Sat Aug 13 21:33:50 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8CDC4106564A; Sat, 13 Aug 2011 21:33:50 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 61E708FC0C; Sat, 13 Aug 2011 21:33:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7DLXoT4033863; Sat, 13 Aug 2011 21:33:50 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7DLXo3m033860; Sat, 13 Aug 2011 21:33:50 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201108132133.p7DLXo3m033860@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 13 Aug 2011 21:33:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224854 - in stable/8: bin/sh tools/regression/bin/sh/expansion X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2011 21:33:50 -0000 Author: jilles Date: Sat Aug 13 21:33:50 2011 New Revision: 224854 URL: http://svn.freebsd.org/changeset/base/224854 Log: MFC r222716: sh: Fix $? in heredocs on simple commands. The patch is slightly different because redirected compound commands are handled differently in stable/8 (no separate function, redirection errors are fatal). PR: bin/41410 Added: stable/8/tools/regression/bin/sh/expansion/heredoc2.0 - copied unchanged from r222716, head/tools/regression/bin/sh/expansion/heredoc2.0 Modified: stable/8/bin/sh/eval.c Directory Properties: stable/8/bin/sh/ (props changed) stable/8/tools/regression/bin/sh/ (props changed) Modified: stable/8/bin/sh/eval.c ============================================================================== --- stable/8/bin/sh/eval.c Sat Aug 13 17:29:37 2011 (r224853) +++ stable/8/bin/sh/eval.c Sat Aug 13 21:33:50 2011 (r224854) @@ -221,6 +221,7 @@ evaltree(union node *n, int flags) evaltree(n->nbinary.ch2, flags); break; case NREDIR: + oexitstatus = exitstatus; expredir(n->nredir.redirect); redirect(n->nredir.redirect, REDIR_PUSH); evaltree(n->nredir.n, flags); @@ -400,6 +401,7 @@ evalsubshell(union node *n, int flags) struct job *jp; int backgnd = (n->type == NBACKGND); + oexitstatus = exitstatus; expredir(n->nredir.redirect); if ((!backgnd && flags & EV_EXIT && !have_traps()) || forkshell(jp = makejob(n, 1), n, backgnd) == 0) { @@ -428,7 +430,6 @@ expredir(union node *n) for (redir = n ; redir ; redir = redir->nfile.next) { struct arglist fn; fn.lastp = &fn.list; - oexitstatus = exitstatus; switch (redir->type) { case NFROM: case NTO: Copied: stable/8/tools/regression/bin/sh/expansion/heredoc2.0 (from r222716, head/tools/regression/bin/sh/expansion/heredoc2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/heredoc2.0 Sat Aug 13 21:33:50 2011 (r224854, copy of r222716, head/tools/regression/bin/sh/expansion/heredoc2.0) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +f() { return $1; } + +[ `f 42; cat <