From owner-svn-src-stable-8@FreeBSD.ORG Mon Jul 1 05:26:30 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0B653827; Mon, 1 Jul 2013 05:26:30 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F22851E47; Mon, 1 Jul 2013 05:26:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r615QT9l079730; Mon, 1 Jul 2013 05:26:29 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r615QTdw079729; Mon, 1 Jul 2013 05:26:29 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201307010526.r615QTdw079729@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 1 Jul 2013 05:26:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252443 - stable/8/sys/dev/usb/net X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 01 Jul 2013 05:26:30 -0000 Author: yongari Date: Mon Jul 1 05:26:29 2013 New Revision: 252443 URL: http://svnweb.freebsd.org/changeset/base/252443 Log: MFC r252143: When RX checksum offloading is active, AX88772B will prepend a checksum header. The header contains a received frame length but the defined length for AX88772B is different with other ASIX controllers. When the RX checksum is off, AX88772B controller does not prepend a checksum header so driver has to use normal header length mask. This change should fix RX errors when RX checksum offloading is off. Modified: stable/8/sys/dev/usb/net/if_axe.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) Modified: stable/8/sys/dev/usb/net/if_axe.c ============================================================================== --- stable/8/sys/dev/usb/net/if_axe.c Mon Jul 1 05:24:58 2013 (r252442) +++ stable/8/sys/dev/usb/net/if_axe.c Mon Jul 1 05:26:29 2013 (r252443) @@ -1355,15 +1355,14 @@ axe_init(struct usb_ether *ue) if (AXE_IS_178_FAMILY(sc)) { sc->sc_flags &= ~(AXE_FLAG_STD_FRAME | AXE_FLAG_CSUM_FRAME); - if ((sc->sc_flags & AXE_FLAG_772B) != 0) - sc->sc_lenmask = AXE_CSUM_HDR_LEN_MASK; - else - sc->sc_lenmask = AXE_HDR_LEN_MASK; if ((sc->sc_flags & AXE_FLAG_772B) != 0 && - (ifp->if_capenable & IFCAP_RXCSUM) != 0) + (ifp->if_capenable & IFCAP_RXCSUM) != 0) { + sc->sc_lenmask = AXE_CSUM_HDR_LEN_MASK; sc->sc_flags |= AXE_FLAG_CSUM_FRAME; - else + } else { + sc->sc_lenmask = AXE_HDR_LEN_MASK; sc->sc_flags |= AXE_FLAG_STD_FRAME; + } } /* Configure TX/RX checksum offloading. */ From owner-svn-src-stable-8@FreeBSD.ORG Mon Jul 1 05:30:38 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C853BBCD; Mon, 1 Jul 2013 05:30:38 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B9FFB1F15; Mon, 1 Jul 2013 05:30:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r615UcUY082045; Mon, 1 Jul 2013 05:30:38 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r615UcgK082043; Mon, 1 Jul 2013 05:30:38 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201307010530.r615UcgK082043@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 1 Jul 2013 05:30:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252445 - in stable/8/sys/dev/usb: . net X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 01 Jul 2013 05:30:38 -0000 Author: yongari Date: Mon Jul 1 05:30:38 2013 New Revision: 252445 URL: http://svnweb.freebsd.org/changeset/base/252445 Log: MFC r252185: Add Lenovo USB 2.0 Ethernet adapter. PR: usb/179920 Modified: stable/8/sys/dev/usb/net/if_axe.c stable/8/sys/dev/usb/usbdevs Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) Modified: stable/8/sys/dev/usb/net/if_axe.c ============================================================================== --- stable/8/sys/dev/usb/net/if_axe.c Mon Jul 1 05:29:42 2013 (r252444) +++ stable/8/sys/dev/usb/net/if_axe.c Mon Jul 1 05:30:38 2013 (r252445) @@ -163,6 +163,7 @@ static const STRUCT_USB_HOST_ID axe_devs AXE_DEV(GOODWAY, GWUSB2E, 0), AXE_DEV(IODATA, ETGUS2, AXE_FLAG_178), AXE_DEV(JVC, MP_PRX1, 0), + AXE_DEV(LENOVO, ETHERNET, AXE_FLAG_772B), AXE_DEV(LINKSYS2, USB200M, 0), AXE_DEV(LINKSYS4, USB1000, AXE_FLAG_178), AXE_DEV(LOGITEC, LAN_GTJU2A, AXE_FLAG_178), Modified: stable/8/sys/dev/usb/usbdevs ============================================================================== --- stable/8/sys/dev/usb/usbdevs Mon Jul 1 05:29:42 2013 (r252444) +++ stable/8/sys/dev/usb/usbdevs Mon Jul 1 05:30:38 2013 (r252445) @@ -677,6 +677,7 @@ vendor ASUS2 0x1761 ASUS vendor SWEEX2 0x177f Sweex vendor METAGEEK 0x1781 MetaGeek vendor KAMSTRUP 0x17a8 Kamstrup A/S +vendor LENOVO 0x17ef Lenovo vendor WAVESENSE 0x17f4 WaveSense vendor VAISALA 0x1843 Vaisala vendor AMIT 0x18c5 AMIT @@ -2421,6 +2422,9 @@ product LARSENBRUSGAARD ALTITRACK 0x0001 /* Leadtek products */ product LEADTEK 9531 0x2101 9531 GPS +/* Lenovo products */ +product LENOVO ETHERNET 0x7203 USB 2.0 Ethernet + /* Lexar products */ product LEXAR JUMPSHOT 0x0001 jumpSHOT CompactFlash Reader product LEXAR CF_READER 0xb002 USB CF Reader From owner-svn-src-stable-8@FreeBSD.ORG Mon Jul 1 05:33:55 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C1517ED4; Mon, 1 Jul 2013 05:33:55 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B39131F37; Mon, 1 Jul 2013 05:33:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r615XtSv082597; Mon, 1 Jul 2013 05:33:55 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r615Xtxn082596; Mon, 1 Jul 2013 05:33:55 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201307010533.r615Xtxn082596@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 1 Jul 2013 05:33:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252448 - stable/8/share/man/man4 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 01 Jul 2013 05:33:55 -0000 Author: yongari Date: Mon Jul 1 05:33:55 2013 New Revision: 252448 URL: http://svnweb.freebsd.org/changeset/base/252448 Log: MFC r252186: Add Lenovo USB 2.0 Ethernet adapter to the list of supported devices. Modified: stable/8/share/man/man4/axe.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/axe.4 ============================================================================== --- stable/8/share/man/man4/axe.4 Mon Jul 1 05:33:53 2013 (r252447) +++ stable/8/share/man/man4/axe.4 Mon Jul 1 05:33:55 2013 (r252448) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 25, 2011 +.Dd June 25, 2013 .Dt AXE 4 .Os .Sh NAME @@ -215,6 +215,8 @@ AX88772B: .Bl -bullet -compact .It ASIX AX88772B +.It +Lenovo USB 2.0 Ethernet .El .Pp AX88760: From owner-svn-src-stable-8@FreeBSD.ORG Mon Jul 1 06:58:36 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1BE97236; Mon, 1 Jul 2013 06:58:36 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0E12511A3; Mon, 1 Jul 2013 06:58:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r616wZvG006824; Mon, 1 Jul 2013 06:58:35 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r616wZr8006823; Mon, 1 Jul 2013 06:58:35 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201307010658.r616wZr8006823@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 1 Jul 2013 06:58:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252453 - stable/8/sys/dev/bge X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 01 Jul 2013 06:58:36 -0000 Author: yongari Date: Mon Jul 1 06:58:35 2013 New Revision: 252453 URL: http://svnweb.freebsd.org/changeset/base/252453 Log: MFC r251481: Do not report current link status if driver is not running. Reporting link status in driver has a side-effect that makes mii(4) check current link status. mii(4) will call link status change callback when it sees link state change. Normally this wouldn't have problems. However, ASF/IPMI firmware can actively access PHY regardless of driver's running state such that reporting link status for not-running interface can generate meaningless link UP/DOWN messages. This change also makes dhclient think driver got a valid link regardless of link establishment so it will bypass dhclient's initial link status check. I think that wouldn't be issue though. Modified: stable/8/sys/dev/bge/if_bge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/bge/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Mon Jul 1 06:58:05 2013 (r252452) +++ stable/8/sys/dev/bge/if_bge.c Mon Jul 1 06:58:35 2013 (r252453) @@ -5621,6 +5621,10 @@ bge_ifmedia_sts(struct ifnet *ifp, struc BGE_LOCK(sc); + if ((ifp->if_flags & IFF_UP) == 0) { + BGE_UNLOCK(sc); + return; + } if (sc->bge_flags & BGE_FLAG_TBI) { ifmr->ifm_status = IFM_AVALID; ifmr->ifm_active = IFM_ETHER; From owner-svn-src-stable-8@FreeBSD.ORG Mon Jul 1 07:03:39 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6777974B; Mon, 1 Jul 2013 07:03:39 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 41B4F11E2; Mon, 1 Jul 2013 07:03:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6173dCS009495; Mon, 1 Jul 2013 07:03:39 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6173cSK009493; Mon, 1 Jul 2013 07:03:38 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201307010703.r6173cSK009493@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 1 Jul 2013 07:03:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252456 - stable/8/sys/dev/bge X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 01 Jul 2013 07:03:39 -0000 Author: yongari Date: Mon Jul 1 07:03:38 2013 New Revision: 252456 URL: http://svnweb.freebsd.org/changeset/base/252456 Log: MFC r251482,251733: r251482: Correct setting TX random backoff register. This register is implemented as a 10 bits linear feedback shift register so only lower 10 bits are valid. Because this register is used to initialize random backoff interval register only when resolved duplex is half-duplex, it wouldn't have caused issues in these days. r251733: Fix a typo introduced in r213280. IFM_OPTIONS macro should see current media word. Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/bge/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Mon Jul 1 07:02:44 2013 (r252455) +++ stable/8/sys/dev/bge/if_bge.c Mon Jul 1 07:03:38 2013 (r252456) @@ -1283,7 +1283,7 @@ bge_miibus_statchg(device_t dev) /* Set MAC flow control behavior to match link flow control settings. */ tx_mode &= ~BGE_TXMODE_FLOWCTL_ENABLE; rx_mode &= ~BGE_RXMODE_FLOWCTL_ENABLE; - if (IFM_OPTIONS(mii->mii_media_active & IFM_FDX) != 0) { + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) { if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0) tx_mode |= BGE_TXMODE_FLOWCTL_ENABLE; if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0) @@ -2279,9 +2279,9 @@ bge_blockinit(struct bge_softc *sc) /* Set random backoff seed for TX */ CSR_WRITE_4(sc, BGE_TX_RANDOM_BACKOFF, - IF_LLADDR(sc->bge_ifp)[0] + IF_LLADDR(sc->bge_ifp)[1] + + (IF_LLADDR(sc->bge_ifp)[0] + IF_LLADDR(sc->bge_ifp)[1] + IF_LLADDR(sc->bge_ifp)[2] + IF_LLADDR(sc->bge_ifp)[3] + - IF_LLADDR(sc->bge_ifp)[4] + IF_LLADDR(sc->bge_ifp)[5] + + IF_LLADDR(sc->bge_ifp)[4] + IF_LLADDR(sc->bge_ifp)[5]) & BGE_TX_BACKOFF_SEED_MASK); /* Set inter-packet gap */ Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Mon Jul 1 07:02:44 2013 (r252455) +++ stable/8/sys/dev/bge/if_bgereg.h Mon Jul 1 07:03:38 2013 (r252456) @@ -797,7 +797,7 @@ #define BGE_LEDCTL_BLINKPERIOD_OVERRIDE 0x80000000 /* TX backoff seed register */ -#define BGE_TX_BACKOFF_SEED_MASK 0x3F +#define BGE_TX_BACKOFF_SEED_MASK 0x3FF /* Autopoll status register */ #define BGE_AUTOPOLLSTS_ERROR 0x00000001 From owner-svn-src-stable-8@FreeBSD.ORG Mon Jul 1 08:25:51 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 237D42D3; Mon, 1 Jul 2013 08:25:51 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 147E916C3; Mon, 1 Jul 2013 08:25:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r618PoFT033280; Mon, 1 Jul 2013 08:25:50 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r618Pos5033279; Mon, 1 Jul 2013 08:25:50 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201307010825.r618Pos5033279@svn.freebsd.org> From: Steven Hartland Date: Mon, 1 Jul 2013 08:25:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252461 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 01 Jul 2013 08:25:51 -0000 Author: smh Date: Mon Jul 1 08:25:50 2013 New Revision: 252461 URL: http://svnweb.freebsd.org/changeset/base/252461 Log: MFC r252390: Remove invalid ASSERT Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Mon Jul 1 08:24:14 2013 (r252460) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Mon Jul 1 08:25:50 2013 (r252461) @@ -1258,8 +1258,6 @@ dsl_dir_rename_sync(void *arg, dmu_tx_t int error; objset_t *mos = dp->dp_meta_objset; - ASSERT(dmu_buf_refcount(dd->dd_dbuf) <= 2); - VERIFY0(dsl_dir_hold(dp, ddra->ddra_oldname, FTAG, &dd, NULL)); VERIFY0(dsl_dir_hold(dp, ddra->ddra_newname, FTAG, &newparent, &mynewname)); From owner-svn-src-stable-8@FreeBSD.ORG Mon Jul 1 08:27:15 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E59D649D; Mon, 1 Jul 2013 08:27:15 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D7E9716F1; Mon, 1 Jul 2013 08:27:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r618RFfK033489; Mon, 1 Jul 2013 08:27:15 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r618RFMj033488; Mon, 1 Jul 2013 08:27:15 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201307010827.r618RFMj033488@svn.freebsd.org> From: Steven Hartland Date: Mon, 1 Jul 2013 08:27:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252462 - stable/8/sys/cddl/compat/opensolaris/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 01 Jul 2013 08:27:16 -0000 Author: smh Date: Mon Jul 1 08:27:15 2013 New Revision: 252462 URL: http://svnweb.freebsd.org/changeset/base/252462 Log: MFC r252392: style(9) fixes Modified: stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) Modified: stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c Mon Jul 1 08:25:50 2013 (r252461) +++ stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c Mon Jul 1 08:27:15 2013 (r252462) @@ -75,7 +75,8 @@ cmn_err(int type, const char *fmt, ...) } int -assfail(const char *a, const char *f, int l) { +assfail(const char *a, const char *f, int l) +{ panic("solaris assert: %s, file: %s, line: %d", a, f, l); @@ -84,7 +85,8 @@ assfail(const char *a, const char *f, in void assfail3(const char *a, uintmax_t lv, const char *op, uintmax_t rv, - const char *f, int l) { + const char *f, int l) +{ panic("solaris assert: %s (0x%jx %s 0x%jx), file: %s, line: %d", a, lv, op, rv, f, l); From owner-svn-src-stable-8@FreeBSD.ORG Mon Jul 1 20:46:35 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DF3E3C53; Mon, 1 Jul 2013 20:46:35 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D13E510F9; Mon, 1 Jul 2013 20:46:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r61KkZZn049737; Mon, 1 Jul 2013 20:46:35 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r61KkZ5n049736; Mon, 1 Jul 2013 20:46:35 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201307012046.r61KkZ5n049736@svn.freebsd.org> From: Xin LI Date: Mon, 1 Jul 2013 20:46:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252478 - stable/8/etc/rc.d X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 01 Jul 2013 20:46:36 -0000 Author: delphij Date: Mon Jul 1 20:46:35 2013 New Revision: 252478 URL: http://svnweb.freebsd.org/changeset/base/252478 Log: MFC r252062: Call sshd_precmd instead of sshd_configtest when the operator requests reload or restart, which, in addition of testing the configuration, will also generate host keys when they are not present (previous behavior). Obtained from: FreeNAS Ok'ed by: bdrewery, des Modified: stable/8/etc/rc.d/sshd Directory Properties: stable/8/etc/rc.d/ (props changed) Modified: stable/8/etc/rc.d/sshd ============================================================================== --- stable/8/etc/rc.d/sshd Mon Jul 1 20:45:55 2013 (r252477) +++ stable/8/etc/rc.d/sshd Mon Jul 1 20:46:35 2013 (r252478) @@ -14,8 +14,8 @@ rcvar="sshd_enable" command="/usr/sbin/${name}" keygen_cmd="sshd_keygen" start_precmd="sshd_precmd" -reload_precmd="sshd_configtest" -restart_precmd="sshd_configtest" +reload_precmd="sshd_precmd" +restart_precmd="sshd_precmd" configtest_cmd="sshd_configtest" pidfile="/var/run/${name}.pid" extra_commands="configtest keygen reload" From owner-svn-src-stable-8@FreeBSD.ORG Mon Jul 1 22:02:41 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2916C90E; Mon, 1 Jul 2013 22:02:41 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 01B201624; Mon, 1 Jul 2013 22:02:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r61M2eDl073102; Mon, 1 Jul 2013 22:02:40 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r61M2eux073098; Mon, 1 Jul 2013 22:02:40 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201307012202.r61M2eux073098@svn.freebsd.org> From: Xin LI Date: Mon, 1 Jul 2013 22:02:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252488 - in stable/8: . share/man/man9 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 01 Jul 2013 22:02:41 -0000 Author: delphij Date: Mon Jul 1 22:02:39 2013 New Revision: 252488 URL: http://svnweb.freebsd.org/changeset/base/252488 Log: MFC r251825,252486: Remove vfs_mount(9), it have been died since 2004. Deleted: stable/8/share/man/man9/vfs_mount.9 Modified: stable/8/ObsoleteFiles.inc (contents, props changed) stable/8/share/man/man9/Makefile stable/8/share/man/man9/kernel_mount.9 stable/8/share/man/man9/vfsconf.9 Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/ObsoleteFiles.inc ============================================================================== --- stable/8/ObsoleteFiles.inc Mon Jul 1 21:59:17 2013 (r252487) +++ stable/8/ObsoleteFiles.inc Mon Jul 1 22:02:39 2013 (r252488) @@ -14,6 +14,8 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20130701: vfs_mount.9 removed +OLD_FILES+=usr/share/man/man9/vfs_mount.9.gz # 20110915: rename congestion control manpages OLD_FILES+=usr/share/man/man4/cc.4.gz OLD_FILES+=usr/share/man/man9/cc.9.gz Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Mon Jul 1 21:59:17 2013 (r252487) +++ stable/8/share/man/man9/Makefile Mon Jul 1 22:02:39 2013 (r252488) @@ -277,7 +277,6 @@ MAN= accept_filter.9 \ vfs_getvfs.9 \ VFS_LOCK_GIANT.9 \ VFS_MOUNT.9 \ - vfs_mount.9 \ vfs_mountedfrom.9 \ VFS_QUOTACTL.9 \ VFS_ROOT.9 \ Modified: stable/8/share/man/man9/kernel_mount.9 ============================================================================== --- stable/8/share/man/man9/kernel_mount.9 Mon Jul 1 21:59:17 2013 (r252487) +++ stable/8/share/man/man9/kernel_mount.9 Mon Jul 1 22:02:39 2013 (r252488) @@ -195,7 +195,6 @@ must come in pairs, e.g., .Sh SEE ALSO .Xr VFS 9 , .Xr VFS_MOUNT 9 , -.Xr vfs_mount 9 .Sh HISTORY The .Fn kernel_mount Modified: stable/8/share/man/man9/vfsconf.9 ============================================================================== --- stable/8/share/man/man9/vfsconf.9 Mon Jul 1 21:59:17 2013 (r252487) +++ stable/8/share/man/man9/vfsconf.9 Mon Jul 1 22:02:39 2013 (r252488) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 21, 2001 +.Dd June 16, 2013 .Dt VFSCONF 9 .Os .Sh NAME @@ -58,7 +58,7 @@ struct vfsconf { .Ed .Pp When a new file system is mounted, -.Xr vfs_mount 9 +.Xr mount 2 does a lookup of the .Vt vfsconf structure by its name, and if it is not already registered, @@ -143,7 +143,7 @@ or .Fn vfs_unregister , whatever the case. .Sh SEE ALSO -.Xr vfs_mount 9 , +.Xr mount 2 , .Xr vfs_rootmountalloc 9 , .Xr VFS_SET 9 .Sh AUTHORS From owner-svn-src-stable-8@FreeBSD.ORG Mon Jul 1 22:07:01 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 93332BED; Mon, 1 Jul 2013 22:07:01 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 862E2164E; Mon, 1 Jul 2013 22:07:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r61M71fq073844; Mon, 1 Jul 2013 22:07:01 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r61M71om073843; Mon, 1 Jul 2013 22:07:01 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201307012207.r61M71om073843@svn.freebsd.org> From: Xin LI Date: Mon, 1 Jul 2013 22:07:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252490 - stable/8/sys/net X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 01 Jul 2013 22:07:01 -0000 Author: delphij Date: Mon Jul 1 22:07:01 2013 New Revision: 252490 URL: http://svnweb.freebsd.org/changeset/base/252490 Log: MFC r251859: Return ENETDOWN instead of ENOENT when all lagg(4) links are inactive when upper layer tries to transmit packet. This gives better feedback and meaningful errors for applications. Reviewed by: thompsa Modified: stable/8/sys/net/if_lagg.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/net/ (props changed) Modified: stable/8/sys/net/if_lagg.c ============================================================================== --- stable/8/sys/net/if_lagg.c Mon Jul 1 22:05:43 2013 (r252489) +++ stable/8/sys/net/if_lagg.c Mon Jul 1 22:07:01 2013 (r252490) @@ -1572,7 +1572,7 @@ lagg_rr_start(struct lagg_softc *sc, str */ if ((lp = lagg_link_active(sc, lp)) == NULL) { m_freem(m); - return (ENOENT); + return (ENETDOWN); } /* Send mbuf */ @@ -1620,7 +1620,7 @@ lagg_fail_start(struct lagg_softc *sc, s /* Use the master port if active or the next available port */ if ((lp = lagg_link_active(sc, sc->sc_primary)) == NULL) { m_freem(m); - return (ENOENT); + return (ENETDOWN); } /* Send mbuf */ @@ -1749,7 +1749,7 @@ lagg_lb_start(struct lagg_softc *sc, str */ if ((lp = lagg_link_active(sc, lp)) == NULL) { m_freem(m); - return (ENOENT); + return (ENETDOWN); } /* Send mbuf */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Jul 2 19:28:17 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9C1089DB; Tue, 2 Jul 2013 19:28:17 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7429710B7; Tue, 2 Jul 2013 19:28:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r62JSHxb057365; Tue, 2 Jul 2013 19:28:17 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r62JSHti057363; Tue, 2 Jul 2013 19:28:17 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201307021928.r62JSHti057363@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 2 Jul 2013 19:28:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252518 - stable/8/sbin/hastd X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 02 Jul 2013 19:28:17 -0000 Author: trociny Date: Tue Jul 2 19:28:16 2013 New Revision: 252518 URL: http://svnweb.freebsd.org/changeset/base/252518 Log: MFC r248294, r248296: r248294 (pjd): Delete requests can be larger than MAXPHYS. r248296 (pjd): Minor corrections. Modified: stable/8/sbin/hastd/hastd.8 stable/8/sbin/hastd/secondary.c Directory Properties: stable/8/sbin/hastd/ (props changed) Modified: stable/8/sbin/hastd/hastd.8 ============================================================================== --- stable/8/sbin/hastd/hastd.8 Tue Jul 2 19:27:07 2013 (r252517) +++ stable/8/sbin/hastd/hastd.8 Tue Jul 2 19:28:16 2013 (r252518) @@ -51,7 +51,7 @@ Only one machine (cluster node) can acti This machine is called primary. The .Nm -daemon operates on block level, which makes it transparent for file +daemon operates on block level, which makes it transparent to file systems and applications. .Pp There is one main @@ -68,7 +68,7 @@ The exact format is: hastd: () .Ed .Pp -When (and only when) +If (and only if) .Nm operates in primary role for the given resource, corresponding .Pa /dev/hast/ @@ -77,8 +77,8 @@ File systems and applications can use th requests to. Every write, delete and flush operation .Dv ( BIO_WRITE , BIO_DELETE , BIO_FLUSH ) -is send to local component and synchronously replicated -to the remote (secondary) node if it is available. +is send to local component and replicated to the remote (secondary) node if it +is available. Read operations .Dv ( BIO_READ ) are handled locally unless I/O error occurs or local version of the data Modified: stable/8/sbin/hastd/secondary.c ============================================================================== --- stable/8/sbin/hastd/secondary.c Tue Jul 2 19:27:07 2013 (r252517) +++ stable/8/sbin/hastd/secondary.c Tue Jul 2 19:28:16 2013 (r252518) @@ -582,7 +582,7 @@ requnpack(struct hast_resource *res, str hio->hio_error = EINVAL; goto end; } - if (hio->hio_length > MAXPHYS) { + if (hio->hio_cmd != HIO_DELETE && hio->hio_length > MAXPHYS) { pjdlog_error("Data length is too large (%ju > %ju).", (uintmax_t)hio->hio_length, (uintmax_t)MAXPHYS); hio->hio_error = EINVAL; From owner-svn-src-stable-8@FreeBSD.ORG Tue Jul 2 19:29:46 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 31444CE5; Tue, 2 Jul 2013 19:29:46 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2378910CE; Tue, 2 Jul 2013 19:29:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r62JTkox057604; Tue, 2 Jul 2013 19:29:46 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r62JTkvR057603; Tue, 2 Jul 2013 19:29:46 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201307021929.r62JTkvR057603@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 2 Jul 2013 19:29:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252520 - stable/8/sbin/hastctl X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 02 Jul 2013 19:29:46 -0000 Author: trociny Date: Tue Jul 2 19:29:45 2013 New Revision: 252520 URL: http://svnweb.freebsd.org/changeset/base/252520 Log: MFC r248286 (pjd): Removed redundant includes. Modified: stable/8/sbin/hastctl/hastctl.c Directory Properties: stable/8/sbin/hastctl/ (props changed) Modified: stable/8/sbin/hastctl/hastctl.c ============================================================================== --- stable/8/sbin/hastctl/hastctl.c Tue Jul 2 19:29:00 2013 (r252519) +++ stable/8/sbin/hastctl/hastctl.c Tue Jul 2 19:29:45 2013 (r252520) @@ -31,21 +31,11 @@ __FBSDID("$FreeBSD$"); #include -#include -#include -#include -#include #include -#include -#include #include -#include -#include #include -#include #include -#include #include #include From owner-svn-src-stable-8@FreeBSD.ORG Tue Jul 2 19:45:15 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2A552A5E; Tue, 2 Jul 2013 19:45:15 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1C8BD11C8; Tue, 2 Jul 2013 19:45:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r62JjEYj063262; Tue, 2 Jul 2013 19:45:15 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r62JjEMd063261; Tue, 2 Jul 2013 19:45:14 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201307021945.r62JjEMd063261@svn.freebsd.org> From: Martin Matuska Date: Tue, 2 Jul 2013 19:45:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252525 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 02 Jul 2013 19:45:15 -0000 Author: mm Date: Tue Jul 2 19:45:14 2013 New Revision: 252525 URL: http://svnweb.freebsd.org/changeset/base/252525 Log: MFC r252380: Unbreak "zfs jail" and "zfs unjail" (broken in stable/8 since r251757) I missed to register zfs_ioc_jail and zfs_ioc_unjail as legacy ioctl's with the new zfs_ioctl_register_legacy() function. These operations do not modify pools or datasets so there is no need to log them to pool history. Reported by: Alexander Leidinger on current@ Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Jul 2 19:44:02 2013 (r252524) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Jul 2 19:45:14 2013 (r252525) @@ -5575,6 +5575,13 @@ zfs_ioctl_init(void) zfs_ioctl_register_dataset_nolog(ZFS_IOC_TMP_SNAPSHOT, zfs_ioc_tmp_snapshot, zfs_secpolicy_tmp_snapshot, POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY); + +#ifdef __FreeBSD__ + zfs_ioctl_register_dataset_nolog(ZFS_IOC_JAIL, zfs_ioc_jail, + zfs_secpolicy_config, POOL_CHECK_NONE); + zfs_ioctl_register_dataset_nolog(ZFS_IOC_UNJAIL, zfs_ioc_unjail, + zfs_secpolicy_config, POOL_CHECK_NONE); +#endif } int From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 3 03:40:06 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C8B0DC1E; Wed, 3 Jul 2013 03:40:06 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BBA5A1951; Wed, 3 Jul 2013 03:40:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r633e6nV005392; Wed, 3 Jul 2013 03:40:06 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r633e6RZ005391; Wed, 3 Jul 2013 03:40:06 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201307030340.r633e6RZ005391@svn.freebsd.org> From: Lawrence Stewart Date: Wed, 3 Jul 2013 03:40:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252533 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 03 Jul 2013 03:40:06 -0000 Author: lstewart Date: Wed Jul 3 03:40:06 2013 New Revision: 252533 URL: http://svnweb.freebsd.org/changeset/base/252533 Log: When a previous call to sbsndptr() leaves sb->sb_sndptroff at the start of an mbuf that was fully consumed by the previous call, the mbuf ptr returned by the current call ends up being the previous mbuf in the sb chain to the one that contains the data we want. This does not cause any observable issues because the mbuf copy routines happily walk the mbuf chain to get to the data at the moff offset, which in this case means they effectively skip over the mbuf returned by sbsndptr(). We can't adjust sb->sb_sndptr during the previous call for this case because the next mbuf in the chain may not exist yet. We therefore need to detect the condition and make the adjustment during the current call. Fix by detecting the special case of moff being at the start of the next mbuf in the chain and adjust the required accounting variables accordingly. Reviewed by: andre Modified: stable/8/sys/kern/uipc_sockbuf.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/uipc_sockbuf.c ============================================================================== --- stable/8/sys/kern/uipc_sockbuf.c Wed Jul 3 03:36:36 2013 (r252532) +++ stable/8/sys/kern/uipc_sockbuf.c Wed Jul 3 03:40:06 2013 (r252533) @@ -939,6 +939,13 @@ sbsndptr(struct sockbuf *sb, u_int off, /* Return closest mbuf in chain for current offset. */ *moff = off - sb->sb_sndptroff; m = ret = sb->sb_sndptr ? sb->sb_sndptr : sb->sb_mb; + if (*moff == m->m_len) { + *moff = 0; + sb->sb_sndptroff += m->m_len; + m = ret = m->m_next; + KASSERT(ret->m_len > 0, + ("mbuf %p in sockbuf %p chain has no valid data", ret, sb)); + } /* Advance by len to be as close as possible for the next transmit. */ for (off = off - sb->sb_sndptroff + len - 1; From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 3 04:21:29 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E0906743; Wed, 3 Jul 2013 04:21:29 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C364B1ABF; Wed, 3 Jul 2013 04:21:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r634LTph017475; Wed, 3 Jul 2013 04:21:29 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r634LTgT017472; Wed, 3 Jul 2013 04:21:29 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201307030421.r634LTgT017472@svn.freebsd.org> From: Lawrence Stewart Date: Wed, 3 Jul 2013 04:21:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252535 - in stable/8/sys: kern sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 03 Jul 2013 04:21:30 -0000 Author: lstewart Date: Wed Jul 3 04:21:29 2013 New Revision: 252535 URL: http://svnweb.freebsd.org/changeset/base/252535 Log: MFC r251732,251752: Add support for non-virtualised hhook points, which are uniquely identified by type and id, as compared to virtualised hook points which are now uniquely identified by type, id and a vid (which for vimage is the pointer to the vnet that the hhook resides in). All hhook_head structs for both virtualised and non-virtualised hook points coexist in hhook_head_list, and a separate list is maintained for hhook points within each vnet to simplify some vimage-related housekeeping. Reviewed by: scottl Modified: stable/8/sys/kern/kern_hhook.c stable/8/sys/sys/hhook.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) stable/8/sys/sys/ (props changed) Modified: stable/8/sys/kern/kern_hhook.c ============================================================================== --- stable/8/sys/kern/kern_hhook.c Wed Jul 3 04:20:36 2013 (r252534) +++ stable/8/sys/kern/kern_hhook.c Wed Jul 3 04:21:29 2013 (r252535) @@ -61,8 +61,9 @@ struct hhook { static MALLOC_DEFINE(M_HHOOK, "hhook", "Helper hooks are linked off hhook_head lists"); LIST_HEAD(hhookheadhead, hhook_head); -VNET_DEFINE(struct hhookheadhead, hhook_head_list); -#define V_hhook_head_list VNET(hhook_head_list) +struct hhookheadhead hhook_head_list; +VNET_DEFINE(struct hhookheadhead, hhook_vhead_list); +#define V_hhook_vhead_list VNET(hhook_vhead_list) static struct mtx hhook_head_list_lock; MTX_SYSINIT(hhookheadlistlock, &hhook_head_list_lock, "hhook_head list lock", @@ -245,13 +246,6 @@ hhook_head_register(int32_t hhook_type, return (EEXIST); } - /* XXXLAS: Need to implement support for non-virtualised hooks. */ - if ((flags & HHOOK_HEADISINVNET) == 0) { - printf("%s: only vnet-style virtualised hooks can be used\n", - __func__); - return (EINVAL); - } - tmphhh = malloc(sizeof(struct hhook_head), M_HHOOK, M_ZERO | ((flags & HHOOK_WAITOK) ? M_WAITOK : M_NOWAIT)); @@ -270,14 +264,17 @@ hhook_head_register(int32_t hhook_type, } else refcount_init(&tmphhh->hhh_refcount, 0); + HHHLIST_LOCK(); if (flags & HHOOK_HEADISINVNET) { tmphhh->hhh_flags |= HHH_ISINVNET; - HHHLIST_LOCK(); - LIST_INSERT_HEAD(&V_hhook_head_list, tmphhh, hhh_next); - HHHLIST_UNLOCK(); - } else { - /* XXXLAS: Add tmphhh to the non-virtualised list. */ +#ifdef VIMAGE + KASSERT(curvnet != NULL, ("curvnet is NULL")); + tmphhh->hhh_vid = (uintptr_t)curvnet; + LIST_INSERT_HEAD(&V_hhook_vhead_list, tmphhh, hhh_vnext); +#endif } + LIST_INSERT_HEAD(&hhook_head_list, tmphhh, hhh_next); + HHHLIST_UNLOCK(); return (0); } @@ -290,6 +287,10 @@ hhook_head_destroy(struct hhook_head *hh HHHLIST_LOCK_ASSERT(); LIST_REMOVE(hhh, hhh_next); +#ifdef VIMAGE + if (hhook_head_is_virtualised(hhh) == HHOOK_HEADISINVNET) + LIST_REMOVE(hhh, hhh_vnext); +#endif HHH_WLOCK(hhh); STAILQ_FOREACH_SAFE(tmp, &hhh->hhh_hooks, hhk_next, tmp2) free(tmp, M_HHOOK); @@ -347,10 +348,17 @@ hhook_head_get(int32_t hhook_type, int32 { struct hhook_head *hhh; - /* XXXLAS: Pick hhook_head_list based on hhook_head flags. */ HHHLIST_LOCK(); - LIST_FOREACH(hhh, &V_hhook_head_list, hhh_next) { + LIST_FOREACH(hhh, &hhook_head_list, hhh_next) { if (hhh->hhh_type == hhook_type && hhh->hhh_id == hhook_id) { +#ifdef VIMAGE + if (hhook_head_is_virtualised(hhh) == + HHOOK_HEADISINVNET) { + KASSERT(curvnet != NULL, ("curvnet is NULL")); + if (hhh->hhh_vid != (uintptr_t)curvnet) + continue; + } +#endif refcount_acquire(&hhh->hhh_refcount); break; } @@ -412,7 +420,7 @@ static void hhook_vnet_init(const void *unused __unused) { - LIST_INIT(&V_hhook_head_list); + LIST_INIT(&V_hhook_vhead_list); } /* @@ -429,7 +437,7 @@ hhook_vnet_uninit(const void *unused __u * subsystem should have already called hhook_head_deregister(). */ HHHLIST_LOCK(); - LIST_FOREACH_SAFE(hhh, &V_hhook_head_list, hhh_next, tmphhh) { + LIST_FOREACH_SAFE(hhh, &V_hhook_vhead_list, hhh_vnext, tmphhh) { printf("%s: hhook_head type=%d, id=%d cleanup required\n", __func__, hhh->hhh_type, hhh->hhh_id); hhook_head_destroy(hhh); @@ -439,7 +447,7 @@ hhook_vnet_uninit(const void *unused __u /* - * When a vnet is created and being initialised, init the V_hhook_head_list. + * When a vnet is created and being initialised, init the V_hhook_vhead_list. */ VNET_SYSINIT(hhook_vnet_init, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, hhook_vnet_init, NULL); Modified: stable/8/sys/sys/hhook.h ============================================================================== --- stable/8/sys/sys/hhook.h Wed Jul 3 04:20:36 2013 (r252534) +++ stable/8/sys/sys/hhook.h Wed Jul 3 04:21:29 2013 (r252535) @@ -91,12 +91,14 @@ struct hookinfo { struct hhook_head { STAILQ_HEAD(hhook_list, hhook) hhh_hooks; struct rmlock hhh_lock; + uintptr_t hhh_vid; int32_t hhh_id; int32_t hhh_nhooks; int32_t hhh_type; uint32_t hhh_flags; volatile uint32_t hhh_refcount; LIST_ENTRY(hhook_head) hhh_next; + LIST_ENTRY(hhook_head) hhh_vnext; }; /* Public KPI functions. */ From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 3 04:26:06 2013 Return-Path: Delivered-To: svn-src-stable-8@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BD0609FC; Wed, 3 Jul 2013 04:26:06 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id 84F8A1AE1; Wed, 3 Jul 2013 04:26:03 +0000 (UTC) Received: from lstewart.caia.swin.edu.au (lstewart.caia.swin.edu.au [136.186.229.95]) by lauren.room52.net (Postfix) with ESMTPSA id 224A67E84A; Wed, 3 Jul 2013 14:26:02 +1000 (EST) Message-ID: <51D3A7D9.8030200@freebsd.org> Date: Wed, 03 Jul 2013 14:26:01 +1000 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130521 Thunderbird/17.0.6 MIME-Version: 1.0 To: src-committers@FreeBSD.org Subject: Re: svn commit: r252533 - stable/8/sys/kern References: <201307030340.r633e6RZ005391@svn.freebsd.org> In-Reply-To: <201307030340.r633e6RZ005391@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lauren.room52.net Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable-8@FreeBSD.org X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 03 Jul 2013 04:26:06 -0000 On 07/03/13 13:40, Lawrence Stewart wrote: > Author: lstewart > Date: Wed Jul 3 03:40:06 2013 > New Revision: 252533 > URL: http://svnweb.freebsd.org/changeset/base/252533 > > Log: MFC r251984: > When a previous call to sbsndptr() leaves sb->sb_sndptroff at the start of an > mbuf that was fully consumed by the previous call, the mbuf ptr returned by the > current call ends up being the previous mbuf in the sb chain to the one that > contains the data we want. > > This does not cause any observable issues because the mbuf copy routines happily > walk the mbuf chain to get to the data at the moff offset, which in this case > means they effectively skip over the mbuf returned by sbsndptr(). > > We can't adjust sb->sb_sndptr during the previous call for this case because the > next mbuf in the chain may not exist yet. We therefore need to detect the > condition and make the adjustment during the current call. > > Fix by detecting the special case of moff being at the start of the next mbuf in > the chain and adjust the required accounting variables accordingly. > > Reviewed by: andre From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 3 05:29:22 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 95A018C0; Wed, 3 Jul 2013 05:29:22 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 78A071DD6; Wed, 3 Jul 2013 05:29:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r635TMH1035709; Wed, 3 Jul 2013 05:29:22 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r635TLje035704; Wed, 3 Jul 2013 05:29:21 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201307030529.r635TLje035704@svn.freebsd.org> From: Lawrence Stewart Date: Wed, 3 Jul 2013 05:29:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252537 - in stable/8/sys: kern sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 03 Jul 2013 05:29:22 -0000 Author: lstewart Date: Wed Jul 3 05:29:21 2013 New Revision: 252537 URL: http://svnweb.freebsd.org/changeset/base/252537 Log: MFC r251770: Internalise handling of virtualised hook points inside hhook_{add|remove}_hook_lookup() so that khelp (and other potential API consumers) do not have to care when they attempt to (un)hook a particular hook point identified by id and type. Reviewed by: scottl Modified: stable/8/sys/kern/kern_hhook.c stable/8/sys/kern/kern_khelp.c stable/8/sys/sys/hhook.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) stable/8/sys/sys/ (props changed) Modified: stable/8/sys/kern/kern_hhook.c ============================================================================== --- stable/8/sys/kern/kern_hhook.c Wed Jul 3 05:28:22 2013 (r252536) +++ stable/8/sys/kern/kern_hhook.c Wed Jul 3 05:29:21 2013 (r252537) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010 Lawrence Stewart + * Copyright (c) 2010,2013 Lawrence Stewart * Copyright (c) 2010 The FreeBSD Foundation * All rights reserved. * @@ -69,6 +69,9 @@ static struct mtx hhook_head_list_lock; MTX_SYSINIT(hhookheadlistlock, &hhook_head_list_lock, "hhook_head list lock", MTX_DEF); +/* Protected by hhook_head_list_lock. */ +static uint32_t n_hhookheads; + /* Private function prototypes. */ static void hhook_head_destroy(struct hhook_head *hhh); @@ -165,21 +168,71 @@ hhook_add_hook(struct hhook_head *hhh, s } /* - * Lookup a helper hook point and register a new helper hook function with it. + * Register a helper hook function with a helper hook point (including all + * virtual instances of the hook point if it is virtualised). + * + * The logic is unfortunately far more complex than for + * hhook_remove_hook_lookup() because hhook_add_hook() can call malloc() with + * M_WAITOK and thus we cannot call hhook_add_hook() with the + * hhook_head_list_lock held. + * + * The logic assembles an array of hhook_head structs that correspond to the + * helper hook point being hooked and bumps the refcount on each (all done with + * the hhook_head_list_lock held). The hhook_head_list_lock is then dropped, and + * hhook_add_hook() is called and the refcount dropped for each hhook_head + * struct in the array. */ int hhook_add_hook_lookup(struct hookinfo *hki, uint32_t flags) { - struct hhook_head *hhh; - int error; + struct hhook_head **heads_to_hook, *hhh; + int error, i, n_heads_to_hook; - hhh = hhook_head_get(hki->hook_type, hki->hook_id); +tryagain: + error = i = 0; + /* + * Accessing n_hhookheads without hhook_head_list_lock held opens up a + * race with hhook_head_register() which we are unlikely to lose, but + * nonetheless have to cope with - hence the complex goto logic. + */ + n_heads_to_hook = n_hhookheads; + heads_to_hook = malloc(n_heads_to_hook * sizeof(struct hhook_head *), + M_HHOOK, flags & HHOOK_WAITOK ? M_WAITOK : M_NOWAIT); + if (heads_to_hook == NULL) + return (ENOMEM); - if (hhh == NULL) - return (ENOENT); + HHHLIST_LOCK(); + LIST_FOREACH(hhh, &hhook_head_list, hhh_next) { + if (hhh->hhh_type == hki->hook_type && + hhh->hhh_id == hki->hook_id) { + if (i < n_heads_to_hook) { + heads_to_hook[i] = hhh; + refcount_acquire(&heads_to_hook[i]->hhh_refcount); + i++; + } else { + /* + * We raced with hhook_head_register() which + * inserted a hhook_head that we need to hook + * but did not malloc space for. Abort this run + * and try again. + */ + for (i--; i >= 0; i--) + refcount_release(&heads_to_hook[i]->hhh_refcount); + free(heads_to_hook, M_HHOOK); + HHHLIST_UNLOCK(); + goto tryagain; + } + } + } + HHHLIST_UNLOCK(); - error = hhook_add_hook(hhh, hki, flags); - hhook_head_release(hhh); + for (i--; i >= 0; i--) { + if (!error) + error = hhook_add_hook(heads_to_hook[i], hki, flags); + refcount_release(&heads_to_hook[i]->hhh_refcount); + } + + free(heads_to_hook, M_HHOOK); return (error); } @@ -211,20 +264,21 @@ hhook_remove_hook(struct hhook_head *hhh } /* - * Lookup a helper hook point and remove a helper hook function from it. + * Remove a helper hook function from a helper hook point (including all + * virtual instances of the hook point if it is virtualised). */ int hhook_remove_hook_lookup(struct hookinfo *hki) { struct hhook_head *hhh; - hhh = hhook_head_get(hki->hook_type, hki->hook_id); - - if (hhh == NULL) - return (ENOENT); - - hhook_remove_hook(hhh, hki); - hhook_head_release(hhh); + HHHLIST_LOCK(); + LIST_FOREACH(hhh, &hhook_head_list, hhh_next) { + if (hhh->hhh_type == hki->hook_type && + hhh->hhh_id == hki->hook_id) + hhook_remove_hook(hhh, hki); + } + HHHLIST_UNLOCK(); return (0); } @@ -274,6 +328,7 @@ hhook_head_register(int32_t hhook_type, #endif } LIST_INSERT_HEAD(&hhook_head_list, tmphhh, hhh_next); + n_hhookheads++; HHHLIST_UNLOCK(); return (0); @@ -285,6 +340,7 @@ hhook_head_destroy(struct hhook_head *hh struct hhook *tmp, *tmp2; HHHLIST_LOCK_ASSERT(); + KASSERT(n_hhookheads > 0, ("n_hhookheads should be > 0")); LIST_REMOVE(hhh, hhh_next); #ifdef VIMAGE @@ -297,6 +353,7 @@ hhook_head_destroy(struct hhook_head *hh HHH_WUNLOCK(hhh); HHH_LOCK_DESTROY(hhh); free(hhh, M_HHOOK); + n_hhookheads--; } /* Modified: stable/8/sys/kern/kern_khelp.c ============================================================================== --- stable/8/sys/kern/kern_khelp.c Wed Jul 3 05:28:22 2013 (r252536) +++ stable/8/sys/kern/kern_khelp.c Wed Jul 3 05:29:21 2013 (r252537) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010 Lawrence Stewart + * Copyright (c) 2010,2013 Lawrence Stewart * Copyright (c) 2010 The FreeBSD Foundation * All rights reserved. * @@ -84,12 +84,13 @@ khelp_register_helper(struct helper *h) for (i = 0; i < h->h_nhooks && !error; i++) { /* We don't require the module to assign hook_helper. */ h->h_hooks[i].hook_helper = h; - error = khelp_add_hhook(&h->h_hooks[i], HHOOK_NOWAIT); + error = hhook_add_hook_lookup(&h->h_hooks[i], + HHOOK_WAITOK); } if (error) { for (i--; i >= 0; i--) - khelp_remove_hhook(&h->h_hooks[i]); + hhook_remove_hook_lookup(&h->h_hooks[i]); osd_deregister(OSD_KHELP, h->h_id); } @@ -144,7 +145,7 @@ khelp_deregister_helper(struct helper *h if (!error) { if (h->h_nhooks > 0) { for (i = 0; i < h->h_nhooks; i++) - khelp_remove_hhook(&h->h_hooks[i]); + hhook_remove_hook_lookup(&h->h_hooks[i]); } osd_deregister(OSD_KHELP, h->h_id); } @@ -263,28 +264,13 @@ khelp_get_id(char *hname) int khelp_add_hhook(struct hookinfo *hki, uint32_t flags) { - VNET_ITERATOR_DECL(vnet_iter); int error; - error = 0; - /* - * XXXLAS: If a helper is dynamically adding a helper hook function at - * runtime using this function, we should update the helper's h_hooks - * struct member to include the additional hookinfo struct. + * XXXLAS: Should probably include the functionality to update the + * helper's h_hooks struct member. */ - - VNET_LIST_RLOCK_NOSLEEP(); - VNET_FOREACH(vnet_iter) { - CURVNET_SET(vnet_iter); - error = hhook_add_hook_lookup(hki, flags); - CURVNET_RESTORE(); -#ifdef VIMAGE - if (error) - break; -#endif - } - VNET_LIST_RUNLOCK_NOSLEEP(); + error = hhook_add_hook_lookup(hki, flags); return (error); } @@ -292,28 +278,13 @@ khelp_add_hhook(struct hookinfo *hki, ui int khelp_remove_hhook(struct hookinfo *hki) { - VNET_ITERATOR_DECL(vnet_iter); int error; - error = 0; - /* - * XXXLAS: If a helper is dynamically removing a helper hook function at - * runtime using this function, we should update the helper's h_hooks - * struct member to remove the defunct hookinfo struct. + * XXXLAS: Should probably include the functionality to update the + * helper's h_hooks struct member. */ - - VNET_LIST_RLOCK_NOSLEEP(); - VNET_FOREACH(vnet_iter) { - CURVNET_SET(vnet_iter); - error = hhook_remove_hook_lookup(hki); - CURVNET_RESTORE(); -#ifdef VIMAGE - if (error) - break; -#endif - } - VNET_LIST_RUNLOCK_NOSLEEP(); + error = hhook_remove_hook_lookup(hki); return (error); } Modified: stable/8/sys/sys/hhook.h ============================================================================== --- stable/8/sys/sys/hhook.h Wed Jul 3 05:28:22 2013 (r252536) +++ stable/8/sys/sys/hhook.h Wed Jul 3 05:29:21 2013 (r252537) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010 Lawrence Stewart + * Copyright (c) 2010,2013 Lawrence Stewart * Copyright (c) 2010 The FreeBSD Foundation * All rights reserved. * From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 3 05:47:29 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 34BA2BB3; Wed, 3 Jul 2013 05:47:29 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 274FE1E30; Wed, 3 Jul 2013 05:47:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r635lTd0041240; Wed, 3 Jul 2013 05:47:29 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r635lS9o041236; Wed, 3 Jul 2013 05:47:28 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201307030547.r635lS9o041236@svn.freebsd.org> From: Lawrence Stewart Date: Wed, 3 Jul 2013 05:47:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252538 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 03 Jul 2013 05:47:29 -0000 Author: lstewart Date: Wed Jul 3 05:47:28 2013 New Revision: 252538 URL: http://svnweb.freebsd.org/changeset/base/252538 Log: MFC r251774: Add a private KPI between hhook and khelp that allows khelp modules to insert hook functions into hhook points which register after the modules were loaded - potentially useful during boot or if hhook points are dynamically registered. Modified: stable/8/sys/kern/kern_hhook.c stable/8/sys/kern/kern_khelp.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/kern_hhook.c ============================================================================== --- stable/8/sys/kern/kern_hhook.c Wed Jul 3 05:29:21 2013 (r252537) +++ stable/8/sys/kern/kern_hhook.c Wed Jul 3 05:47:28 2013 (r252538) @@ -74,6 +74,7 @@ static uint32_t n_hhookheads; /* Private function prototypes. */ static void hhook_head_destroy(struct hhook_head *hhh); +void khelp_new_hhook_registered(struct hhook_head *hhh, uint32_t flags); #define HHHLIST_LOCK() mtx_lock(&hhook_head_list_lock) #define HHHLIST_UNLOCK() mtx_unlock(&hhook_head_list_lock) @@ -311,12 +312,7 @@ hhook_head_register(int32_t hhook_type, tmphhh->hhh_nhooks = 0; STAILQ_INIT(&tmphhh->hhh_hooks); HHH_LOCK_INIT(tmphhh); - - if (hhh != NULL) { - refcount_init(&tmphhh->hhh_refcount, 1); - *hhh = tmphhh; - } else - refcount_init(&tmphhh->hhh_refcount, 0); + refcount_init(&tmphhh->hhh_refcount, 1); HHHLIST_LOCK(); if (flags & HHOOK_HEADISINVNET) { @@ -331,6 +327,13 @@ hhook_head_register(int32_t hhook_type, n_hhookheads++; HHHLIST_UNLOCK(); + khelp_new_hhook_registered(tmphhh, flags); + + if (hhh != NULL) + *hhh = tmphhh; + else + refcount_release(&tmphhh->hhh_refcount); + return (0); } Modified: stable/8/sys/kern/kern_khelp.c ============================================================================== --- stable/8/sys/kern/kern_khelp.c Wed Jul 3 05:29:21 2013 (r252537) +++ stable/8/sys/kern/kern_khelp.c Wed Jul 3 05:47:28 2013 (r252538) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -52,8 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - static struct rwlock khelp_list_lock; RW_SYSINIT(khelplistlock, &khelp_list_lock, "helper list lock"); @@ -61,6 +58,7 @@ static TAILQ_HEAD(helper_head, helper) h /* Private function prototypes. */ static inline void khelp_remove_osd(struct helper *h, struct osd *hosd); +void khelp_new_hhook_registered(struct hhook_head *hhh, uint32_t flags); #define KHELP_LIST_WLOCK() rw_wlock(&khelp_list_lock) #define KHELP_LIST_WUNLOCK() rw_wunlock(&khelp_list_lock) @@ -289,6 +287,36 @@ khelp_remove_hhook(struct hookinfo *hki) return (error); } +/* + * Private KPI between hhook and khelp that allows khelp modules to insert hook + * functions into hhook points which register after the modules were loaded. + */ +void +khelp_new_hhook_registered(struct hhook_head *hhh, uint32_t flags) +{ + struct helper *h; + int error, i; + + KHELP_LIST_RLOCK(); + TAILQ_FOREACH(h, &helpers, h_next) { + for (i = 0; i < h->h_nhooks; i++) { + if (hhh->hhh_type != h->h_hooks[i].hook_type || + hhh->hhh_id != h->h_hooks[i].hook_id) + continue; + error = hhook_add_hook(hhh, &h->h_hooks[i], flags); + if (error) { + printf("%s: \"%s\" khelp module unable to " + "hook type %d id %d due to error %d\n", + __func__, h->h_name, + h->h_hooks[i].hook_type, + h->h_hooks[i].hook_id, error); + error = 0; + } + } + } + KHELP_LIST_RUNLOCK(); +} + int khelp_modevent(module_t mod, int event_type, void *data) { @@ -348,95 +376,3 @@ khelp_modevent(module_t mod, int event_t return (error); } - -/* - * This function is called in two separate situations: - * - * - When the kernel is booting, it is called directly by the SYSINIT framework - * to allow Khelp modules which were compiled into the kernel or loaded by the - * boot loader to insert their non-virtualised hook functions into the kernel. - * - * - When the kernel is booting or a vnet is created, this function is also - * called indirectly through khelp_vnet_init() by the vnet initialisation code. - * In this situation, Khelp modules are able to insert their virtualised hook - * functions into the virtualised hook points in the vnet which is being - * initialised. In the case where the kernel is not compiled with "options - * VIMAGE", this step is still run once at boot, but the hook functions get - * transparently inserted into the standard unvirtualised network stack. - */ -static void -khelp_init(const void *vnet) -{ - struct helper *h; - int error, i, vinit; - int32_t htype, hid; - - error = 0; - vinit = vnet != NULL; - - KHELP_LIST_RLOCK(); - TAILQ_FOREACH(h, &helpers, h_next) { - for (i = 0; i < h->h_nhooks && !error; i++) { - htype = h->h_hooks[i].hook_type; - hid = h->h_hooks[i].hook_id; - - /* - * If we're doing a virtualised init (vinit != 0) and - * the hook point is virtualised, or we're doing a plain - * sysinit at boot and the hook point is not - * virtualised, insert the hook. - */ - if ((hhook_head_is_virtualised_lookup(htype, hid) == - HHOOK_HEADISINVNET && vinit) || - (!hhook_head_is_virtualised_lookup(htype, hid) && - !vinit)) { - error = hhook_add_hook_lookup(&h->h_hooks[i], - HHOOK_NOWAIT); - } - } - - if (error) { - /* Remove any helper's hooks we successfully added. */ - for (i--; i >= 0; i--) - hhook_remove_hook_lookup(&h->h_hooks[i]); - - printf("%s: Failed to add hooks for helper \"%s\" (%p)", - __func__, h->h_name, h); - if (vinit) - printf(" to vnet %p.\n", vnet); - else - printf(".\n"); - - error = 0; - } - } - KHELP_LIST_RUNLOCK(); -} - -/* - * Vnet created and being initialised. - */ -static void -khelp_vnet_init(const void *unused __unused) -{ - - khelp_init(TD_TO_VNET(curthread)); -} - - -/* - * As the kernel boots, allow Khelp modules which were compiled into the kernel - * or loaded by the boot loader to insert their non-virtualised hook functions - * into the kernel. - */ -SYSINIT(khelp_init, SI_SUB_PROTO_END, SI_ORDER_FIRST, khelp_init, NULL); - -/* - * When a vnet is created and being initialised, we need to insert the helper - * hook functions for all currently registered Khelp modules into the vnet's - * helper hook points. The hhook KPI provides a mechanism for subsystems which - * export helper hook points to clean up on vnet shutdown, so we don't need a - * VNET_SYSUNINIT for Khelp. - */ -VNET_SYSINIT(khelp_vnet_init, SI_SUB_PROTO_END, SI_ORDER_FIRST, - khelp_vnet_init, NULL); From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 3 05:59:49 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2C2774D6; Wed, 3 Jul 2013 05:59:49 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 04AA91EBA; Wed, 3 Jul 2013 05:59:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r635xm9v044525; Wed, 3 Jul 2013 05:59:48 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r635xmYq044524; Wed, 3 Jul 2013 05:59:48 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201307030559.r635xmYq044524@svn.freebsd.org> From: Lawrence Stewart Date: Wed, 3 Jul 2013 05:59:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252542 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 03 Jul 2013 05:59:49 -0000 Author: lstewart Date: Wed Jul 3 05:59:48 2013 New Revision: 252542 URL: http://svnweb.freebsd.org/changeset/base/252542 Log: MFC r251778: Cleanup and simplification in khelp_{register|deregister}_helper(). No functional changes. Modified: stable/8/sys/kern/kern_khelp.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/kern_khelp.c ============================================================================== --- stable/8/sys/kern/kern_khelp.c Wed Jul 3 05:58:51 2013 (r252541) +++ stable/8/sys/kern/kern_khelp.c Wed Jul 3 05:59:48 2013 (r252542) @@ -72,34 +72,32 @@ khelp_register_helper(struct helper *h) struct helper *tmph; int error, i, inserted; - error = 0; - inserted = 0; + error = inserted = 0; refcount_init(&h->h_refcount, 0); h->h_id = osd_register(OSD_KHELP, NULL, NULL); /* It's only safe to add the hooks after osd_register(). */ - if (h->h_nhooks > 0) { - for (i = 0; i < h->h_nhooks && !error; i++) { - /* We don't require the module to assign hook_helper. */ - h->h_hooks[i].hook_helper = h; - error = hhook_add_hook_lookup(&h->h_hooks[i], - HHOOK_WAITOK); - } - - if (error) { - for (i--; i >= 0; i--) - hhook_remove_hook_lookup(&h->h_hooks[i]); - - osd_deregister(OSD_KHELP, h->h_id); - } + for (i = 0; i < h->h_nhooks && !error; i++) { + /* We don't require the module to assign hook_helper. */ + h->h_hooks[i].hook_helper = h; + error = hhook_add_hook_lookup(&h->h_hooks[i], HHOOK_WAITOK); + if (error) + printf("%s: \"%s\" khelp module unable to " + "hook type %d id %d due to error %d\n", __func__, + h->h_name, h->h_hooks[i].hook_type, + h->h_hooks[i].hook_id, error); } - if (!error) { + if (error) { + for (i--; i >= 0; i--) + hhook_remove_hook_lookup(&h->h_hooks[i]); + osd_deregister(OSD_KHELP, h->h_id); + } else { KHELP_LIST_WLOCK(); /* * Keep list of helpers sorted in descending h_id order. Due to * the way osd_set() works, a sorted list ensures - * init_helper_osd() will operate with improved efficiency. + * khelp_init_osd() will operate with improved efficiency. */ TAILQ_FOREACH(tmph, &helpers, h_next) { if (tmph->h_id < h->h_id) { @@ -123,8 +121,6 @@ khelp_deregister_helper(struct helper *h struct helper *tmph; int error, i; - error = 0; - KHELP_LIST_WLOCK(); if (h->h_refcount > 0) error = EBUSY; @@ -141,10 +137,8 @@ khelp_deregister_helper(struct helper *h KHELP_LIST_WUNLOCK(); if (!error) { - if (h->h_nhooks > 0) { - for (i = 0; i < h->h_nhooks; i++) - hhook_remove_hook_lookup(&h->h_hooks[i]); - } + for (i = 0; i < h->h_nhooks; i++) + hhook_remove_hook_lookup(&h->h_hooks[i]); osd_deregister(OSD_KHELP, h->h_id); } From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 3 06:23:47 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9B7D5AE8; Wed, 3 Jul 2013 06:23:47 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7464E1F72; Wed, 3 Jul 2013 06:23:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r636NlDP053026; Wed, 3 Jul 2013 06:23:47 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r636NlcJ053025; Wed, 3 Jul 2013 06:23:47 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201307030623.r636NlcJ053025@svn.freebsd.org> From: Lawrence Stewart Date: Wed, 3 Jul 2013 06:23:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252544 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 03 Jul 2013 06:23:47 -0000 Author: lstewart Date: Wed Jul 3 06:23:46 2013 New Revision: 252544 URL: http://svnweb.freebsd.org/changeset/base/252544 Log: MFC r251787: Move hhook's per-vnet initialisation to an earlier SYSINIT SI_SUB stage to ensure all per-vnet related hhook initialisation is completed prior to any virtualised hhook points attempting registration. vnet_register_sysinit() requires that a stage later than SI_SUB_VNET be chosen. There are no per-vnet initialisors in the source tree at this time which run earlier than SI_SUB_INIT_IF. A quick audit of non-virtualised SYSINITs indicates there are no subsystems pre SI_SUB_MBUF that would likely be interested in registering a virtualised hhook point. Settle on SI_SUB_MBUF as hhook's per-vnet initialisation stage as it's the first overtly network-related initilisation stage to run after SI_SUB_VNET. If a subsystem that initialises earlier than SI_SUB_MBUF ends up wanting to register virtualised hhook points in future, hhook's use of SI_SUB_MBUF will need to be revisited and would probably warrant creating a dedicated SI_SUB_HHOOK which runs immediately after SI_SUB_VNET. Modified: stable/8/sys/kern/kern_hhook.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/kern_hhook.c ============================================================================== --- stable/8/sys/kern/kern_hhook.c Wed Jul 3 06:20:47 2013 (r252543) +++ stable/8/sys/kern/kern_hhook.c Wed Jul 3 06:23:46 2013 (r252544) @@ -509,7 +509,7 @@ hhook_vnet_uninit(const void *unused __u /* * When a vnet is created and being initialised, init the V_hhook_vhead_list. */ -VNET_SYSINIT(hhook_vnet_init, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, +VNET_SYSINIT(hhook_vnet_init, SI_SUB_MBUF, SI_ORDER_FIRST, hhook_vnet_init, NULL); /* @@ -517,5 +517,5 @@ VNET_SYSINIT(hhook_vnet_init, SI_SUB_PRO * points to clean up on vnet tear down, but in case the KPI is misused, * provide a function to clean up and free memory for a vnet being destroyed. */ -VNET_SYSUNINIT(hhook_vnet_uninit, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, +VNET_SYSUNINIT(hhook_vnet_uninit, SI_SUB_MBUF, SI_ORDER_ANY, hhook_vnet_uninit, NULL); From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 3 07:58:15 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 526B7ED; Wed, 3 Jul 2013 07:58:15 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 44C361274; Wed, 3 Jul 2013 07:58:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r637wFui079597; Wed, 3 Jul 2013 07:58:15 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r637wFWW079596; Wed, 3 Jul 2013 07:58:15 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201307030758.r637wFWW079596@svn.freebsd.org> From: Lawrence Stewart Date: Wed, 3 Jul 2013 07:58:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252550 - stable/8/sys/sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 03 Jul 2013 07:58:15 -0000 Author: lstewart Date: Wed Jul 3 07:58:14 2013 New Revision: 252550 URL: http://svnweb.freebsd.org/changeset/base/252550 Log: MFC r251789: Now that the necessary infrastructure is in place to ensure hhook points which register after a khelp module will get hooked, move khelp module initialisation to the earlier SI_SUB_KLD stage. Modified: stable/8/sys/sys/module_khelp.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/sys/ (props changed) Modified: stable/8/sys/sys/module_khelp.h ============================================================================== --- stable/8/sys/sys/module_khelp.h Wed Jul 3 07:57:22 2013 (r252549) +++ stable/8/sys/sys/module_khelp.h Wed Jul 3 07:58:14 2013 (r252550) @@ -85,8 +85,7 @@ struct khelp_modevent_data { .evhand = khelp_modevent, \ .priv = &kmd_##hname \ }; \ - DECLARE_MODULE(hname, h_##hname, SI_SUB_PROTO_IFATTACHDOMAIN, \ - SI_ORDER_ANY); \ + DECLARE_MODULE(hname, h_##hname, SI_SUB_KLD, SI_ORDER_ANY); \ MODULE_VERSION(hname, version) #define KHELP_DECLARE_MOD(hname, hdata, hhooks, version) \ From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 3 08:21:05 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D04E76AF; Wed, 3 Jul 2013 08:21:05 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C2B161342; Wed, 3 Jul 2013 08:21:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r638L5rb088107; Wed, 3 Jul 2013 08:21:05 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r638L5Ri088106; Wed, 3 Jul 2013 08:21:05 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201307030821.r638L5Ri088106@svn.freebsd.org> From: Lawrence Stewart Date: Wed, 3 Jul 2013 08:21:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252552 - stable/8/share/man/man9 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 03 Jul 2013 08:21:05 -0000 Author: lstewart Date: Wed Jul 3 08:21:05 2013 New Revision: 252552 URL: http://svnweb.freebsd.org/changeset/base/252552 Log: MFC r252052: Non-virtualised hhook points are supported as of r251732. Modified: stable/8/share/man/man9/hhook.9 Directory Properties: stable/8/share/man/ (props changed) stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/hhook.9 ============================================================================== --- stable/8/share/man/man9/hhook.9 Wed Jul 3 08:20:40 2013 (r252551) +++ stable/8/share/man/man9/hhook.9 Wed Jul 3 08:21:05 2013 (r252552) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2011 +.Dd June 21, 2013 .Dt HHOOK 9 .Os .Sh NAME @@ -380,9 +380,3 @@ This manual page was written by .An David Hayes Aq david.hayes@ieee.org and .An Lawrence Stewart Aq lstewart@FreeBSD.org . -.Sh BUGS -The framework does not currently support registering hook points in subsystems -which have not been virtualised with VIMAGE. -Fairly minimal internal changes to the -.Nm -implementation are required to address this. From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 3 08:35:14 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C6550B64; Wed, 3 Jul 2013 08:35:14 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B82B91447; Wed, 3 Jul 2013 08:35:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r638ZE1d091548; Wed, 3 Jul 2013 08:35:14 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r638ZEkL091547; Wed, 3 Jul 2013 08:35:14 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201307030835.r638ZEkL091547@svn.freebsd.org> From: Steven Hartland Date: Wed, 3 Jul 2013 08:35:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252553 - stable/8/sys/dev/mfi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 03 Jul 2013 08:35:14 -0000 Author: smh Date: Wed Jul 3 08:35:14 2013 New Revision: 252553 URL: http://svnweb.freebsd.org/changeset/base/252553 Log: MFC r252471: Remove forced timeout of in-flight commands from mfi_timeout. While this prevents commands getting stuck forever there is no way to guarantee that data from the command hasn't been committed to the device. In addition older mfi firmware has a bug that would cause the controller to frequently stall IO for over our timeout value, which when combined with a forced timeout often resulted in panics in UFS; which would otherwise be avoided when the command eventually completed if left alone. For reference this timeout issue is resolved in Dell FW package 21.2.1-0000. Fixed FW package version for none Dell controller will likely vary. Modified: stable/8/sys/dev/mfi/mfi.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/mfi/ (props changed) Modified: stable/8/sys/dev/mfi/mfi.c ============================================================================== --- stable/8/sys/dev/mfi/mfi.c Wed Jul 3 08:21:05 2013 (r252552) +++ stable/8/sys/dev/mfi/mfi.c Wed Jul 3 08:35:14 2013 (r252553) @@ -3762,12 +3762,15 @@ mfi_timeout(void *data) MFI_PRINT_CMD(cm); MFI_VALIDATE_CMD(sc, cm); /* - * Fail the command instead of leaving it on - * the queue where it could remain stuck forever + * While commands can get stuck forever we do + * not fail them as there is no way to tell if + * the controller has actually processed them + * or not. + * + * In addition its very likely that force + * failing a command here would cause a panic + * e.g. in UFS. */ - mfi_remove_busy(cm); - cm->cm_error = ETIMEDOUT; - mfi_complete(sc, cm); timedout++; } } From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 3 20:55:49 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B85BB7FA; Wed, 3 Jul 2013 20:55:49 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AA11717C6; Wed, 3 Jul 2013 20:55:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r63KtnKG012856; Wed, 3 Jul 2013 20:55:49 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r63KtnMM012855; Wed, 3 Jul 2013 20:55:49 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201307032055.r63KtnMM012855@svn.freebsd.org> From: Devin Teske Date: Wed, 3 Jul 2013 20:55:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252601 - stable/8/usr.sbin/sysinstall X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 03 Jul 2013 20:55:49 -0000 Author: dteske Date: Wed Jul 3 20:55:49 2013 New Revision: 252601 URL: http://svnweb.freebsd.org/changeset/base/252601 Log: MFC r252600: Fix grammar in a comment. Modified: stable/8/usr.sbin/sysinstall/package.c Modified: stable/8/usr.sbin/sysinstall/package.c ============================================================================== --- stable/8/usr.sbin/sysinstall/package.c Wed Jul 3 20:54:25 2013 (r252600) +++ stable/8/usr.sbin/sysinstall/package.c Wed Jul 3 20:55:49 2013 (r252601) @@ -106,7 +106,7 @@ package_installed(char *name) /* XXX KLUDGE ALERT! This makes evil assumptions about how XXX * packages register themselves and should *really be done with - * `pkg_info -e ' except that this it's too slow for an + * `pkg_info -e ' except that this is too slow for an * item check routine.. :-( */ snprintf(fname, FILENAME_MAX, "/var/db/pkg/%s", name); From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 3 22:59:47 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 87833225; Wed, 3 Jul 2013 22:59:47 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5F2991D11; Wed, 3 Jul 2013 22:59:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r63Mxlsi050781; Wed, 3 Jul 2013 22:59:47 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r63MxkdY050778; Wed, 3 Jul 2013 22:59:46 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201307032259.r63MxkdY050778@svn.freebsd.org> From: "David E. O'Brien" Date: Wed, 3 Jul 2013 22:59:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252639 - in stable/8/usr.sbin/pkg_install: add create lib X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 03 Jul 2013 22:59:47 -0000 Author: obrien Date: Wed Jul 3 22:59:46 2013 New Revision: 252639 URL: http://svnweb.freebsd.org/changeset/base/252639 Log: MF9: r252635, r252638: MFC: r252348, r252363: sysconf(3) returns a long, not an int. Modified: stable/8/usr.sbin/pkg_install/add/extract.c stable/8/usr.sbin/pkg_install/create/pl.c stable/8/usr.sbin/pkg_install/lib/exec.c Directory Properties: stable/8/ (props changed) stable/8/usr.sbin/ (props changed) stable/8/usr.sbin/pkg_install/ (props changed) stable/8/usr.sbin/pkg_install/add/ (props changed) Modified: stable/8/usr.sbin/pkg_install/add/extract.c ============================================================================== --- stable/8/usr.sbin/pkg_install/add/extract.c Wed Jul 3 22:57:20 2013 (r252638) +++ stable/8/usr.sbin/pkg_install/add/extract.c Wed Jul 3 22:59:46 2013 (r252639) @@ -110,7 +110,8 @@ extract_plist(const char *home, Package PackingList p = pkg->head; char *last_file, *prefix = NULL; char *where_args, *perm_args, *last_chdir; - int maxargs, where_count = 0, perm_count = 0, add_count; + long maxargs; + int where_count = 0, perm_count = 0, add_count; Boolean preserve; maxargs = sysconf(_SC_ARG_MAX) / 2; /* Just use half the argument space */ Modified: stable/8/usr.sbin/pkg_install/create/pl.c ============================================================================== --- stable/8/usr.sbin/pkg_install/create/pl.c Wed Jul 3 22:57:20 2013 (r252638) +++ stable/8/usr.sbin/pkg_install/create/pl.c Wed Jul 3 22:59:46 2013 (r252639) @@ -140,7 +140,8 @@ copy_plist(const char *home, Package *pl const char *there = NULL, *mythere; char *where_args, *prefix = NULL; const char *last_chdir, *root = "/"; - int maxargs, where_count = 0, add_count; + long maxargs; + int where_count = 0, add_count; struct stat stb; dev_t curdir; Modified: stable/8/usr.sbin/pkg_install/lib/exec.c ============================================================================== --- stable/8/usr.sbin/pkg_install/lib/exec.c Wed Jul 3 22:57:20 2013 (r252638) +++ stable/8/usr.sbin/pkg_install/lib/exec.c Wed Jul 3 22:59:46 2013 (r252639) @@ -34,7 +34,8 @@ vsystem(const char *fmt, ...) { va_list args; char *cmd; - int ret, maxargs; + long maxargs; + int ret; maxargs = sysconf(_SC_ARG_MAX); maxargs -= 32; /* some slop for the sh -c */ @@ -64,7 +65,7 @@ vpipe(const char *fmt, ...) { FILE *fp; char *cmd, *rp; - int maxargs; + long maxargs; va_list args; rp = malloc(MAXPATHLEN); From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 3 23:16:34 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7A334AFF; Wed, 3 Jul 2013 23:16:34 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5C7131DC5; Wed, 3 Jul 2013 23:16:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r63NGYeA057003; Wed, 3 Jul 2013 23:16:34 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r63NGXux057000; Wed, 3 Jul 2013 23:16:33 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201307032316.r63NGXux057000@svn.freebsd.org> From: Mark Johnston Date: Wed, 3 Jul 2013 23:16:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252644 - stable/8/sys/dev/mfi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 03 Jul 2013 23:16:34 -0000 Author: markj Date: Wed Jul 3 23:16:33 2013 New Revision: 252644 URL: http://svnweb.freebsd.org/changeset/base/252644 Log: MFC r242726 (ambrisko): Add support for SCSI pass through devices to be attached and detached. MFC r251172 (sbruno): xpt_create_path() requires mfi_io_lock to be held, so do it. mfi(4) doesn't panic on host startup now. Modified: stable/8/sys/dev/mfi/mfi.c stable/8/sys/dev/mfi/mfi_cam.c stable/8/sys/dev/mfi/mfivar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/mfi/ (props changed) Modified: stable/8/sys/dev/mfi/mfi.c ============================================================================== --- stable/8/sys/dev/mfi/mfi.c Wed Jul 3 23:15:30 2013 (r252643) +++ stable/8/sys/dev/mfi/mfi.c Wed Jul 3 23:16:33 2013 (r252644) @@ -1628,6 +1628,11 @@ mfi_decode_evt(struct mfi_softc *sc, str sx_xunlock(&sc->mfi_config_lock); } } + if (sc->mfi_cam_rescan_cb != NULL && + (detail->code == MR_EVT_PD_INSERTED || + detail->code == MR_EVT_PD_REMOVED)) { + sc->mfi_cam_rescan_cb(sc, detail->args.pd.device_id); + } break; } } Modified: stable/8/sys/dev/mfi/mfi_cam.c ============================================================================== --- stable/8/sys/dev/mfi/mfi_cam.c Wed Jul 3 23:15:30 2013 (r252643) +++ stable/8/sys/dev/mfi/mfi_cam.c Wed Jul 3 23:16:33 2013 (r252644) @@ -50,7 +50,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #include @@ -66,12 +68,19 @@ __FBSDID("$FreeBSD$"); #include #include +enum mfip_state { + MFIP_STATE_NONE, + MFIP_STATE_DETACH, + MFIP_STATE_RESCAN +}; + struct mfip_softc { device_t dev; struct mfi_softc *mfi_sc; struct cam_devq *devq; struct cam_sim *sim; struct cam_path *path; + enum mfip_state state; }; static int mfip_probe(device_t); @@ -79,6 +88,7 @@ static int mfip_attach(device_t); static int mfip_detach(device_t); static void mfip_cam_action(struct cam_sim *, union ccb *); static void mfip_cam_poll(struct cam_sim *); +static void mfip_cam_rescan(struct mfi_softc *, uint32_t tid); static struct mfi_command * mfip_start(void *); static void mfip_done(struct mfi_command *cm); @@ -125,6 +135,7 @@ mfip_attach(device_t dev) mfisc = device_get_softc(device_get_parent(dev)); sc->dev = dev; + sc->state = MFIP_STATE_NONE; sc->mfi_sc = mfisc; mfisc->mfi_cam_start = mfip_start; @@ -141,6 +152,8 @@ mfip_attach(device_t dev) return (EINVAL); } + mfisc->mfi_cam_rescan_cb = mfip_cam_rescan; + mtx_lock(&mfisc->mfi_io_lock); if (xpt_bus_register(sc->sim, dev, 0) != 0) { device_printf(dev, "XPT bus registration failed\n"); @@ -165,6 +178,16 @@ mfip_detach(device_t dev) if (sc == NULL) return (EINVAL); + mtx_lock(&sc->mfi_sc->mfi_io_lock); + if (sc->state == MFIP_STATE_RESCAN) { + mtx_unlock(&sc->mfi_sc->mfi_io_lock); + return (EBUSY); + } + sc->state = MFIP_STATE_DETACH; + mtx_unlock(&sc->mfi_sc->mfi_io_lock); + + sc->mfi_sc->mfi_cam_rescan_cb = NULL; + if (sc->sim != NULL) { mtx_lock(&sc->mfi_sc->mfi_io_lock); xpt_bus_deregister(cam_sim_path(sc->sim)); @@ -275,6 +298,57 @@ mfip_cam_action(struct cam_sim *sim, uni return; } +static void +mfip_cam_rescan(struct mfi_softc *sc, uint32_t tid) +{ + union ccb *ccb; + struct mfip_softc *camsc; + struct cam_sim *sim; + device_t mfip_dev; + + mtx_lock(&Giant); + mfip_dev = device_find_child(sc->mfi_dev, "mfip", -1); + mtx_unlock(&Giant); + if (mfip_dev == NULL) { + device_printf(sc->mfi_dev, "Couldn't find mfip child device!\n"); + return; + } + + mtx_lock(&sc->mfi_io_lock); + camsc = device_get_softc(mfip_dev); + if (camsc->state == MFIP_STATE_DETACH) { + mtx_unlock(&sc->mfi_io_lock); + return; + } + camsc->state = MFIP_STATE_RESCAN; + mtx_unlock(&sc->mfi_io_lock); + + ccb = xpt_alloc_ccb_nowait(); + if (ccb == NULL) { + device_printf(sc->mfi_dev, + "Cannot allocate ccb for bus rescan.\n"); + return; + } + + sim = camsc->sim; + mtx_lock(&sc->mfi_io_lock); + if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(sim), + tid, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + xpt_free_ccb(ccb); + mtx_unlock(&sc->mfi_io_lock); + device_printf(sc->mfi_dev, + "Cannot create path for bus rescan.\n"); + return; + } + mtx_unlock(&sc->mfi_io_lock); + + xpt_rescan(ccb); + + mtx_lock(&sc->mfi_io_lock); + camsc->state = MFIP_STATE_NONE; + mtx_unlock(&sc->mfi_io_lock); +} + static struct mfi_command * mfip_start(void *data) { Modified: stable/8/sys/dev/mfi/mfivar.h ============================================================================== --- stable/8/sys/dev/mfi/mfivar.h Wed Jul 3 23:15:30 2013 (r252643) +++ stable/8/sys/dev/mfi/mfivar.h Wed Jul 3 23:16:33 2013 (r252644) @@ -313,6 +313,8 @@ struct mfi_softc { TAILQ_HEAD(, ccb_hdr) mfi_cam_ccbq; struct mfi_command * (* mfi_cam_start)(void *); + void (*mfi_cam_rescan_cb)(struct mfi_softc *, + uint32_t); struct callout mfi_watchdog_callout; struct mtx mfi_io_lock; struct sx mfi_config_lock; From owner-svn-src-stable-8@FreeBSD.ORG Wed Jul 3 23:28:07 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B2E384C5; Wed, 3 Jul 2013 23:28:07 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A4C671E65; Wed, 3 Jul 2013 23:28:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r63NS7gm060496; Wed, 3 Jul 2013 23:28:07 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r63NS7Yu060495; Wed, 3 Jul 2013 23:28:07 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201307032328.r63NS7Yu060495@svn.freebsd.org> From: Jim Harris Date: Wed, 3 Jul 2013 23:28:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252650 - stable/8/sys/dev/isci/scil X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 03 Jul 2013 23:28:07 -0000 Author: jimharris Date: Wed Jul 3 23:28:07 2013 New Revision: 252650 URL: http://svnweb.freebsd.org/changeset/base/252650 Log: MFC r252262: For ATA_PASSTHROUGH commands, pretend isci(4) supports multiword DMA by treating it as UDMA. This fixes a problem introduced in r249933/r249939, where CAM sends ATA_DSM_TRIM to SATA devices using ATA_PASSTHROUGH_16. scsi_ata_trim() sets protocol as DMA (not UDMA) which is for multi-word DMA, even though no such mode is selected for the device. isci(4) would fail these commands which is the correct behavior but not consistent with other HBAs, namely LSI's. smh@ did some further testing on an LSI controller, which rejected ATA_PASSTHROUGH_16 commands with mode=UDMA_OUT, even though only a UDMA mode was selected on the device. So this precludes adding any kind of mode detection in CAM to determine which mode to use on a per-device basis. Sponsored by: Intel Modified: stable/8/sys/dev/isci/scil/sati_passthrough.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/isci/ (props changed) Modified: stable/8/sys/dev/isci/scil/sati_passthrough.c ============================================================================== --- stable/8/sys/dev/isci/scil/sati_passthrough.c Wed Jul 3 23:27:59 2013 (r252649) +++ stable/8/sys/dev/isci/scil/sati_passthrough.c Wed Jul 3 23:28:07 2013 (r252650) @@ -85,6 +85,7 @@ __FBSDID("$FreeBSD$"); // Protocols #define PASSTHROUGH_PIO_DATA_IN 0x4 #define PASSTHROUGH_PIO_DATA_OUT 0x5 +#define PASSTHROUGH_DMA 0x6 #define PASSTHROUGH_UDMA_DATA_IN 0xA #define PASSTHROUGH_UDMA_DATA_OUT 0xB #define PASSTHROUGH_RETURN_RESPONSE 0xF @@ -252,8 +253,8 @@ SATI_STATUS sati_passthrough_check_direc U8 * cdb ) { - if ((PASSTHROUGH_CDB_PROTOCOL(cdb) == PASSTHROUGH_PIO_DATA_IN) || - (PASSTHROUGH_CDB_PROTOCOL(cdb) == PASSTHROUGH_UDMA_DATA_IN)) + if ((sequence->protocol == PASSTHROUGH_PIO_DATA_IN) || + (sequence->protocol == PASSTHROUGH_UDMA_DATA_IN)) { if (PASSTHROUGH_CDB_T_DIR(cdb) == 0x0) { @@ -264,8 +265,8 @@ SATI_STATUS sati_passthrough_check_direc sequence->data_direction = SATI_DATA_DIRECTION_IN; } } - else if ((PASSTHROUGH_CDB_PROTOCOL(cdb) == PASSTHROUGH_PIO_DATA_OUT) || - (PASSTHROUGH_CDB_PROTOCOL(cdb) == PASSTHROUGH_UDMA_DATA_OUT)) + else if ((sequence->protocol == PASSTHROUGH_PIO_DATA_OUT) || + (sequence->protocol == PASSTHROUGH_UDMA_DATA_OUT)) { if (PASSTHROUGH_CDB_T_DIR(cdb) == 0x1) { @@ -318,6 +319,26 @@ SATI_STATUS sati_passthrough_12_translat sequence->protocol = PASSTHROUGH_CDB_PROTOCOL (cdb); register_fis = sati_cb_get_h2d_register_fis_address(ata_io); + /* + * CAM will send passthrough commands with protocol set to multiword + * DMA even though no multiword DMA mode is selected on the device. + * This is because some controllers (LSI) will only accept + * ATA_PASSTHROUGH commands with DMA mode - not UDMA_IN/OUT. + * + * Since isci does not support multiword DMA, fix this up here. + */ + if (sequence->protocol == PASSTHROUGH_DMA) + { + if (PASSTHROUGH_CDB_T_DIR(cdb) == 0x1) + { + sequence->protocol = PASSTHROUGH_UDMA_DATA_IN; + } + else + { + sequence->protocol = PASSTHROUGH_UDMA_DATA_OUT; + } + } + if (sati_passthrough_check_direction(sequence, cdb) != SATI_COMPLETE || sati_passthrough_multiple_count_error(cdb) ) @@ -376,6 +397,26 @@ SATI_STATUS sati_passthrough_16_translat sequence->protocol = PASSTHROUGH_CDB_PROTOCOL(cdb); register_fis = sati_cb_get_h2d_register_fis_address(ata_io); + /* + * CAM will send passthrough commands with protocol set to multiword + * DMA even though no multiword DMA mode is selected on the device. + * This is because some controllers (LSI) will only accept + * ATA_PASSTHROUGH commands with DMA mode - not UDMA_IN/OUT. + * + * Since isci does not support multiword DMA, fix this up here. + */ + if (sequence->protocol == PASSTHROUGH_DMA) + { + if (PASSTHROUGH_CDB_T_DIR(cdb) == 0x1) + { + sequence->protocol = PASSTHROUGH_UDMA_DATA_IN; + } + else + { + sequence->protocol = PASSTHROUGH_UDMA_DATA_OUT; + } + } + if (sati_passthrough_check_direction(sequence, cdb) != SATI_COMPLETE || sati_passthrough_multiple_count_error(cdb) ) From owner-svn-src-stable-8@FreeBSD.ORG Thu Jul 4 08:00:42 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 07810899; Thu, 4 Jul 2013 08:00:42 +0000 (UTC) (envelope-from bsd-lists@1command.com) Received: from udns.ultimateDNS.NET (ultimatedns.net [209.180.214.225]) by mx1.freebsd.org (Postfix) with ESMTP id CF4941561; Thu, 4 Jul 2013 08:00:41 +0000 (UTC) Received: from udns.ultimateDNS.NET (localhost [127.0.0.1]) by udns.ultimateDNS.NET (8.14.5/8.14.5) with ESMTP id r6480U23067433; Thu, 4 Jul 2013 01:00:36 -0700 (PDT) (envelope-from bsd-lists@1command.com) Received: (from www@localhost) by udns.ultimateDNS.NET (8.14.5/8.14.5/Submit) id r6480PHp067432; Thu, 4 Jul 2013 01:00:25 -0700 (PDT) (envelope-from bsd-lists@1command.com) Received: from udns.ultimatedns.net ([209.180.214.225]) (UDNSMS authenticated user chrish) by ultimatedns.net with HTTP; Thu, 4 Jul 2013 01:00:25 -0700 (PDT) Message-ID: Date: Thu, 4 Jul 2013 01:00:25 -0700 (PDT) Subject: Where's the docs for FreeBSD maintenance with Subversion? From: "Chris H" To: "freebsd-stable" , "svn-src-stable-8" User-Agent: UDNSMS/2.0.3 MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 04 Jul 2013 08:00:42 -0000 Greetings, I've _finally_ managed to get a break in my work schedule that coincides with a period where pointyhat isn't barfing on my ARCH. So I was able to (cv)sup src && ports. Update the kernel successfully, and (after hours of work), managed to upgrade ports. But as (cv)sup was discontinued ~3 months ago, the ports aren't well synced, and I'm now working on a fairly wobbly system. I'm on RELENG_8 (8.4), and would like to sync my src && ports via the (now defacto) subversion method. My previous experience is with the client meerly for the sake of obtaining the src, and building -- _not_ maintaining a tree. I've read what little is available in the handbook, and much of the Subversion book. But there are clearly different procedures/nuances where FreeBSD maintenance is concerned, both in the building of Subversion, and it's usage, where FreeBSD is concerned. The biggest questions in this regard, is; 1) what to do with my current INDEX-8 && INDEX-8.db files? 2) what of the "distfiles" directory Do I simply copy them over, and "check them in"? Surely I'm not the only one that still has questions in this regard. Thank you for all your time, and consideration. --chris From owner-svn-src-stable-8@FreeBSD.ORG Thu Jul 4 08:42:24 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 47A1A703 for ; Thu, 4 Jul 2013 08:42:24 +0000 (UTC) (envelope-from matthew@freebsd.org) Received: from smtp.infracaninophile.co.uk (smtp6.infracaninophile.co.uk [IPv6:2001:8b0:151:1:3cd3:cd67:fafa:3d78]) by mx1.freebsd.org (Postfix) with ESMTP id DA966179D for ; Thu, 4 Jul 2013 08:42:23 +0000 (UTC) Received: from rufus.webfusion.com (mail.heartinternet.co.uk [79.170.40.31]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.7/8.14.7) with ESMTP id r648g4x3040789 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 4 Jul 2013 09:42:09 +0100 (BST) (envelope-from matthew@freebsd.org) DKIM-Filter: OpenDKIM Filter v2.8.3 smtp.infracaninophile.co.uk r648g4x3040789 Authentication-Results: smtp.infracaninophile.co.uk/r648g4x3040789; dkim=none reason="no signature"; dkim-adsp=none (unprotected policy) X-Authentication-Warning: lucid-nonsense.infracaninophile.co.uk: Host mail.heartinternet.co.uk [79.170.40.31] claimed to be rufus.webfusion.com Message-ID: <51D5355B.7060800@freebsd.org> Date: Thu, 04 Jul 2013 09:42:03 +0100 From: Matthew Seaman User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130701 Thunderbird/17.0.7 MIME-Version: 1.0 To: svn-src-stable-8@freebsd.org Subject: Re: Where's the docs for FreeBSD maintenance with Subversion? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.8 at lucid-nonsense.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00, RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lucid-nonsense.infracaninophile.co.uk Cc: bsd-lists@1command.com X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 04 Jul 2013 08:42:24 -0000 On 04/07/2013 09:00, Chris H wrote: > 1) what to do with my current INDEX-8 && INDEX-8.db files? When you grab the latest ports via SVN, your INDEX files will be quite out of date. Delete them, and grab an up to date version by 'make fetchindex' (or by building your own) IIRC INDEX-8.db is something generated by portupgrade automatically from INDEX-8. > 2) what of the "distfiles" directory Save this. Move it aside when you do your initial SVN checkout, and then copy the content back into place under /usr/ports/distfiles It won't interfere with subsequent SVN updates. Cheers, Matthew From owner-svn-src-stable-8@FreeBSD.ORG Thu Jul 4 09:21:38 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CBE0F40E for ; Thu, 4 Jul 2013 09:21:38 +0000 (UTC) (envelope-from njm@njm.me.uk) Received: from smtp004.apm-internet.net (smtp004.apm-internet.net [85.119.248.54]) by mx1.freebsd.org (Postfix) with ESMTP id 49FBC19D8 for ; Thu, 4 Jul 2013 09:21:37 +0000 (UTC) Received: (qmail 46199 invoked from network); 4 Jul 2013 09:14:55 -0000 Received: from unknown (HELO meld.njm.me.uk) (109.148.231.82) by smtp004.apm-internet.net with SMTP; 4 Jul 2013 09:14:55 -0000 Received: from titania.njm.me.uk (titania.njm.me.uk [192.168.144.130]) by meld.njm.me.uk (8.14.7/8.14.7) with ESMTP id r649EtRL017804; Thu, 4 Jul 2013 10:14:55 +0100 (BST) (envelope-from njm@njm.me.uk) Received: from titania.njm.me.uk (localhost [127.0.0.1]) by titania.njm.me.uk (8.14.7/8.14.7) with ESMTP id r649Et8a061298; Thu, 4 Jul 2013 10:14:55 +0100 (BST) (envelope-from njm@njm.me.uk) Received: (from njm@localhost) by titania.njm.me.uk (8.14.7/8.14.7/Submit) id r649Esai061297; Thu, 4 Jul 2013 10:14:54 +0100 (BST) (envelope-from njm@njm.me.uk) Date: Thu, 4 Jul 2013 10:14:54 +0100 From: "N.J. Mann" To: Chris H Subject: Re: Where's the docs for FreeBSD maintenance with Subversion? Message-ID: <20130704091454.GA61237@titania.njm.me.uk> Mail-Followup-To: Chris H , freebsd-stable , svn-src-stable-8 References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 8.4-STABLE User-Agent: mutt-NJM (2010-10-31) Cc: svn-src-stable-8 , freebsd-stable X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 04 Jul 2013 09:21:38 -0000 In message , Chris H (bsd-lists@1command.com) wrote: > Greetings, > I've _finally_ managed to get a break in my work schedule that coincides with > a period where pointyhat isn't barfing on my ARCH. So I was able to (cv)sup src && ports. > Update the kernel successfully, and (after hours of work), managed to upgrade ports. But > as (cv)sup was discontinued ~3 months ago, the ports aren't well synced, and I'm now > working on a fairly wobbly system. I'm on RELENG_8 (8.4), and would like to sync my src && > ports via the (now defacto) subversion method. My previous experience is with the client > meerly for the sake of obtaining the src, and building -- _not_ maintaining a tree. I've > read what little is available in the handbook, and much of the Subversion book. But there are > clearly different procedures/nuances where FreeBSD maintenance is concerned, both in the > building of Subversion, and it's usage, where FreeBSD is concerned. The biggest questions > in this regard, is; > 1) what to do with my current INDEX-8 && INDEX-8.db files? > 2) what of the "distfiles" directory > Do I simply copy them over, and "check them in"? When I converted from csup to svn I did the following - which seems to work. :-) 1. mv /usr/ports /usr/ports.old 2. mkdir /usr/ports 3. svn checkout into /usr/ports 4. mv /usr/ports.old/distfiles /usr/ports When I do a svn update it ignores distfiles. I hope this terse reply helps. Cheers, Nick. -- From owner-svn-src-stable-8@FreeBSD.ORG Thu Jul 4 09:24:43 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9B25E538; Thu, 4 Jul 2013 09:24:43 +0000 (UTC) (envelope-from bsd-lists@1command.com) Received: from udns.ultimateDNS.NET (ultimatedns.net [209.180.214.225]) by mx1.freebsd.org (Postfix) with ESMTP id 6A49919FF; Thu, 4 Jul 2013 09:24:43 +0000 (UTC) Received: from udns.ultimateDNS.NET (localhost [127.0.0.1]) by udns.ultimateDNS.NET (8.14.5/8.14.5) with ESMTP id r649Obhj072234; Thu, 4 Jul 2013 02:24:43 -0700 (PDT) (envelope-from bsd-lists@1command.com) Received: (from www@localhost) by udns.ultimateDNS.NET (8.14.5/8.14.5/Submit) id r649OW1o072218; Thu, 4 Jul 2013 02:24:32 -0700 (PDT) (envelope-from bsd-lists@1command.com) Received: from udns.ultimatedns.net ([209.180.214.225]) (UDNSMS authenticated user chrish) by ultimatedns.net with HTTP; Thu, 4 Jul 2013 02:24:32 -0700 (PDT) Message-ID: <08bc031c63ab5d08a8e6ec1b87f65a26.authenticated@ultimatedns.net> In-Reply-To: <51D5355B.7060800@freebsd.org> References: <51D5355B.7060800@freebsd.org> Date: Thu, 4 Jul 2013 02:24:32 -0700 (PDT) Subject: Re: Where's the docs for FreeBSD maintenance with Subversion? From: "Chris H" To: "Matthew Seaman" User-Agent: UDNSMS/2.0.3 MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Cc: bsd-lists@1command.com, svn-src-stable-8@freebsd.org X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 04 Jul 2013 09:24:43 -0000 > On 04/07/2013 09:00, Chris H wrote: >> 1) what to do with my current INDEX-8 && INDEX-8.db files? > > When you grab the latest ports via SVN, your INDEX files will be quite > out of date. Delete them, and grab an up to date version by 'make > fetchindex' (or by building your own) IIRC INDEX-8.db is something > generated by portupgrade automatically from INDEX-8. Yep -- actually as a product of portupgrade(1). It's actually portsdb(1) that creates it. > >> 2) what of the "distfiles" directory > > Save this. Move it aside when you do your initial SVN checkout, and > then copy the content back into place under /usr/ports/distfiles > It won't interfere with subsequent SVN updates. Thank you Matthew, that clears it all up for me. :) --chris > > Cheers, > > Matthew > _______________________________________________ > svn-src-stable-8@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable-8 > To unsubscribe, send any mail to "svn-src-stable-8-unsubscribe@freebsd.org" > From owner-svn-src-stable-8@FreeBSD.ORG Thu Jul 4 09:26:52 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CAB49561; Thu, 4 Jul 2013 09:26:52 +0000 (UTC) (envelope-from bsd-lists@1command.com) Received: from udns.ultimateDNS.NET (ultimatedns.net [209.180.214.225]) by mx1.freebsd.org (Postfix) with ESMTP id 7F3721A14; Thu, 4 Jul 2013 09:26:52 +0000 (UTC) Received: from udns.ultimateDNS.NET (localhost [127.0.0.1]) by udns.ultimateDNS.NET (8.14.5/8.14.5) with ESMTP id r649QjSV072435; Thu, 4 Jul 2013 02:26:51 -0700 (PDT) (envelope-from bsd-lists@1command.com) Received: (from www@localhost) by udns.ultimateDNS.NET (8.14.5/8.14.5/Submit) id r649QeY8072432; Thu, 4 Jul 2013 02:26:40 -0700 (PDT) (envelope-from bsd-lists@1command.com) Received: from udns.ultimatedns.net ([209.180.214.225]) (UDNSMS authenticated user chrish) by ultimatedns.net with HTTP; Thu, 4 Jul 2013 02:26:40 -0700 (PDT) Message-ID: <953a43cc7f49927cdfdfc7f1b697bb19.authenticated@ultimatedns.net> In-Reply-To: <20130704091454.GA61237@titania.njm.me.uk> References: <20130704091454.GA61237@titania.njm.me.uk> Date: Thu, 4 Jul 2013 02:26:40 -0700 (PDT) Subject: Re: Where's the docs for FreeBSD maintenance with Subversion? From: "Chris H" To: "freebsd-stable" , "svn-src-stable-8" User-Agent: UDNSMS/2.0.3 MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 04 Jul 2013 09:26:52 -0000 > In message , > Chris H (bsd-lists@1command.com) wrote: >> Greetings, >> I've _finally_ managed to get a break in my work schedule that coincides with >> a period where pointyhat isn't barfing on my ARCH. So I was able to (cv)sup src && ports. >> Update the kernel successfully, and (after hours of work), managed to upgrade ports. But >> as (cv)sup was discontinued ~3 months ago, the ports aren't well synced, and I'm now >> working on a fairly wobbly system. I'm on RELENG_8 (8.4), and would like to sync my src && >> ports via the (now defacto) subversion method. My previous experience is with the client >> meerly for the sake of obtaining the src, and building -- _not_ maintaining a tree. I've >> read what little is available in the handbook, and much of the Subversion book. But there >> are >> clearly different procedures/nuances where FreeBSD maintenance is concerned, both in the >> building of Subversion, and it's usage, where FreeBSD is concerned. The biggest questions >> in this regard, is; >> 1) what to do with my current INDEX-8 && INDEX-8.db files? >> 2) what of the "distfiles" directory >> Do I simply copy them over, and "check them in"? > > When I converted from csup to svn I did the following - which seems to > work. :-) > > 1. mv /usr/ports /usr/ports.old > 2. mkdir /usr/ports > 3. svn checkout into /usr/ports > 4. mv /usr/ports.old/distfiles /usr/ports > > When I do a svn update it ignores distfiles. > > I hope this terse reply helps. Perfect! Thanks. --chris > > > Cheers, > Nick. > -- > > > _______________________________________________ > svn-src-stable-8@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable-8 > To unsubscribe, send any mail to "svn-src-stable-8-unsubscribe@freebsd.org" > From owner-svn-src-stable-8@FreeBSD.ORG Thu Jul 4 22:09:15 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3FF50CA0; Thu, 4 Jul 2013 22:09:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3165B1171; Thu, 4 Jul 2013 22:09:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r64M9F1V062873; Thu, 4 Jul 2013 22:09:15 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r64M9Fcx062872; Thu, 4 Jul 2013 22:09:15 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201307042209.r64M9Fcx062872@svn.freebsd.org> From: Dimitry Andric Date: Thu, 4 Jul 2013 22:09:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252731 - in stable: 7/contrib/libstdc++/libsupc++ 8/contrib/libstdc++/libsupc++ 9/contrib/libstdc++/libsupc++ X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 04 Jul 2013 22:09:15 -0000 Author: dim Date: Thu Jul 4 22:09:14 2013 New Revision: 252731 URL: http://svnweb.freebsd.org/changeset/base/252731 Log: MFC r252387: Make libsupc++'s __cxa_call_terminate() prototype consistent with the definition. Submitted by: dt71@gmx.com Modified: stable/8/contrib/libstdc++/libsupc++/unwind-cxx.h Directory Properties: stable/8/contrib/libstdc++/ (props changed) Changes in other areas also in this revision: Modified: stable/7/contrib/libstdc++/libsupc++/unwind-cxx.h stable/9/contrib/libstdc++/libsupc++/unwind-cxx.h Directory Properties: stable/7/contrib/libstdc++/ (props changed) stable/9/contrib/libstdc++/ (props changed) Modified: stable/8/contrib/libstdc++/libsupc++/unwind-cxx.h ============================================================================== --- stable/8/contrib/libstdc++/libsupc++/unwind-cxx.h Thu Jul 4 21:57:09 2013 (r252730) +++ stable/8/contrib/libstdc++/libsupc++/unwind-cxx.h Thu Jul 4 22:09:14 2013 (r252731) @@ -133,7 +133,7 @@ extern "C" void __cxa_bad_typeid (); // throws, and if bad_exception needs to be thrown. Called from the // compiler. extern "C" void __cxa_call_unexpected (void *) __attribute__((noreturn)); -extern "C" void __cxa_call_terminate (void*) __attribute__((noreturn)); +extern "C" void __cxa_call_terminate (_Unwind_Exception*) __attribute__((noreturn)); #ifdef __ARM_EABI_UNWINDER__ // Arm EABI specified routines. From owner-svn-src-stable-8@FreeBSD.ORG Fri Jul 5 03:02:22 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4F353C52; Fri, 5 Jul 2013 03:02:22 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 324B91C4B; Fri, 5 Jul 2013 03:02:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6532MGf055311; Fri, 5 Jul 2013 03:02:22 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6532J5H055296; Fri, 5 Jul 2013 03:02:19 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201307050302.r6532J5H055296@svn.freebsd.org> From: Xin LI Date: Fri, 5 Jul 2013 03:02:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252750 - in stable/8: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 05 Jul 2013 03:02:22 -0000 Author: delphij Date: Fri Jul 5 03:02:19 2013 New Revision: 252750 URL: http://svnweb.freebsd.org/changeset/base/252750 Log: MFC r251629: 3741 zfs needs better comments Embellish the comments in various components of ZFS. Move some comments around closer to what they describe. Specifically, answer the questions: - What are some of the edge cases of the dbuf state machine? - What does a txg quiesce do? - When does the DMU notify threads waiting on txg's that they may proceed? - How do the calculations for RAIDZ map allocations work? - What process do the RAIDZ I/O start and done callbacks follow? While here, adjust the function prototype of dmu_zfetch.c:dmu_zfetch_colinear() to match its comment which describes its return as a boolean. Submitted by: asomers, gibbs, will Reviewed by: Matthew Ahrens , Eric Schrock , Christopher Siden Sponsored by: Spectra Logic Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/cddl/contrib/opensolaris/lib/libzfs/ (props changed) stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Fri Jul 5 03:01:35 2013 (r252749) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Fri Jul 5 03:02:19 2013 (r252750) @@ -4538,6 +4538,11 @@ zfs_get_holds(zfs_handle_t *zhp, nvlist_ return (err); } +/* + * Convert the zvol's volume size to an appropriate reservation. + * Note: If this routine is updated, it is necessary to update the ZFS test + * suite's shell version in reservation.kshlib. + */ uint64_t zvol_volsize_to_reservation(uint64_t volsize, nvlist_t *props) { Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Jul 5 03:01:35 2013 (r252749) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Jul 5 03:02:19 2013 (r252750) @@ -287,7 +287,18 @@ typedef struct arc_stats { kstat_named_t arcstat_deleted; kstat_named_t arcstat_stolen; kstat_named_t arcstat_recycle_miss; + /* + * Number of buffers that could not be evicted because the hash lock + * was held by another thread. The lock may not necessarily be held + * by something using the same buffer, since hash locks are shared + * by multiple buffers. + */ kstat_named_t arcstat_mutex_miss; + /* + * Number of buffers skipped because they have I/O in progress, are + * indrect prefetch buffers that have not lived long enough, or are + * not from the spa we're trying to evict from. + */ kstat_named_t arcstat_evict_skip; kstat_named_t arcstat_evict_l2_cached; kstat_named_t arcstat_evict_l2_eligible; @@ -3211,6 +3222,10 @@ top: mutex_exit(hash_lock); + /* + * At this point, we have a level 1 cache miss. Try again in + * L2ARC if possible. + */ ASSERT3U(hdr->b_size, ==, size); DTRACE_PROBE4(arc__miss, arc_buf_hdr_t *, hdr, blkptr_t *, bp, uint64_t, size, zbookmark_t *, zb); @@ -3408,8 +3423,8 @@ arc_buf_evict(arc_buf_t *buf) } /* - * Release this buffer from the cache. This must be done - * after a read and prior to modifying the buffer contents. + * Release this buffer from the cache, making it an anonymous buffer. This + * must be done after a read and prior to modifying the buffer contents. * If the buffer has more than one reference, we must make * a new hdr for the buffer. */ Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Jul 5 03:01:35 2013 (r252749) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Jul 5 03:02:19 2013 (r252750) @@ -638,6 +638,14 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio if (!havepzio) err = zio_wait(zio); } else { + /* + * Another reader came in while the dbuf was in flight + * between UNCACHED and CACHED. Either a writer will finish + * writing the buffer (sending the dbuf to CACHED) or the + * first reader's request will reach the read_done callback + * and send the dbuf to CACHED. Otherwise, a failure + * occurred and the dbuf went to UNCACHED. + */ mutex_exit(&db->db_mtx); if (prefetch) dmu_zfetch(&dn->dn_zfetch, db->db.db_offset, @@ -646,6 +654,7 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio rw_exit(&dn->dn_struct_rwlock); DB_DNODE_EXIT(db); + /* Skip the wait per the caller's request. */ mutex_enter(&db->db_mtx); if ((flags & DB_RF_NEVERWAIT) == 0) { while (db->db_state == DB_READ || @@ -1261,7 +1270,8 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t } /* - * Return TRUE if this evicted the dbuf. + * Undirty a buffer in the transaction group referenced by the given + * transaction. Return whether this evicted the dbuf. */ static boolean_t dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx) @@ -2222,6 +2232,7 @@ dbuf_sync_indirect(dbuf_dirty_record_t * ASSERT(db->db_level > 0); DBUF_VERIFY(db); + /* Read the block if it hasn't been read yet. */ if (db->db_buf == NULL) { mutex_exit(&db->db_mtx); (void) dbuf_read(db, NULL, DB_RF_MUST_SUCCEED); @@ -2232,10 +2243,12 @@ dbuf_sync_indirect(dbuf_dirty_record_t * DB_DNODE_ENTER(db); dn = DB_DNODE(db); + /* Indirect block size must match what the dnode thinks it is. */ ASSERT3U(db->db.db_size, ==, 1<dn_phys->dn_indblkshift); dbuf_check_blkptr(dn, db); DB_DNODE_EXIT(db); + /* Provide the pending dirty record to child dbufs */ db->db_data_pending = dr; mutex_exit(&db->db_mtx); @@ -2626,6 +2639,7 @@ dbuf_write_override_done(zio_t *zio) dbuf_write_done(zio, NULL, db); } +/* Issue I/O to commit a dirty buffer to disk. */ static void dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx) { @@ -2660,11 +2674,19 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ } if (parent != dn->dn_dbuf) { + /* Our parent is an indirect block. */ + /* We have a dirty parent that has been scheduled for write. */ ASSERT(parent && parent->db_data_pending); + /* Our parent's buffer is one level closer to the dnode. */ ASSERT(db->db_level == parent->db_level-1); + /* + * We're about to modify our parent's db_data by modifying + * our block pointer, so the parent must be released. + */ ASSERT(arc_released(parent->db_buf)); zio = parent->db_data_pending->dr_zio; } else { + /* Our parent is the dnode itself. */ ASSERT((db->db_level == dn->dn_phys->dn_nlevels-1 && db->db_blkid != DMU_SPILL_BLKID) || (db->db_blkid == DMU_SPILL_BLKID && db->db_level == 0)); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Fri Jul 5 03:01:35 2013 (r252749) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Fri Jul 5 03:02:19 2013 (r252750) @@ -1837,7 +1837,7 @@ dmu_init(void) void dmu_fini(void) { - arc_fini(); + arc_fini(); /* arc depends on l2arc, so arc must go first */ l2arc_fini(); zfetch_fini(); dbuf_fini(); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Fri Jul 5 03:01:35 2013 (r252749) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Fri Jul 5 03:02:19 2013 (r252750) @@ -1014,6 +1014,10 @@ dmu_tx_unassign(dmu_tx_t *tx) txg_rele_to_quiesce(&tx->tx_txgh); + /* + * Walk the transaction's hold list, removing the hold on the + * associated dnode, and notifying waiters if the refcount drops to 0. + */ for (txh = list_head(&tx->tx_holds); txh != tx->tx_needassign_txh; txh = list_next(&tx->tx_holds, txh)) { dnode_t *dn = txh->txh_dnode; @@ -1126,6 +1130,10 @@ dmu_tx_commit(dmu_tx_t *tx) ASSERT(tx->tx_txg != 0); + /* + * Go through the transaction's hold list and remove holds on + * associated dnodes, notifying waiters if no holds remain. + */ while (txh = list_head(&tx->tx_holds)) { dnode_t *dn = txh->txh_dnode; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Fri Jul 5 03:01:35 2013 (r252749) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Fri Jul 5 03:02:19 2013 (r252750) @@ -66,11 +66,11 @@ SYSCTL_QUAD(_vfs_zfs_zfetch, OID_AUTO, a "Number of bytes in a array_read at which we stop prefetching"); /* forward decls for static routines */ -static int dmu_zfetch_colinear(zfetch_t *, zstream_t *); +static boolean_t dmu_zfetch_colinear(zfetch_t *, zstream_t *); static void dmu_zfetch_dofetch(zfetch_t *, zstream_t *); static uint64_t dmu_zfetch_fetch(dnode_t *, uint64_t, uint64_t); static uint64_t dmu_zfetch_fetchsz(dnode_t *, uint64_t, uint64_t); -static int dmu_zfetch_find(zfetch_t *, zstream_t *, int); +static boolean_t dmu_zfetch_find(zfetch_t *, zstream_t *, int); static int dmu_zfetch_stream_insert(zfetch_t *, zstream_t *); static zstream_t *dmu_zfetch_stream_reclaim(zfetch_t *); static void dmu_zfetch_stream_remove(zfetch_t *, zstream_t *); @@ -122,9 +122,9 @@ kstat_t *zfetch_ksp; * last stream, then we are probably in a strided access pattern. So * combine the two sequential streams into a single strided stream. * - * If no co-linear streams are found, return NULL. + * Returns whether co-linear streams were found. */ -static int +static boolean_t dmu_zfetch_colinear(zfetch_t *zf, zstream_t *zh) { zstream_t *z_walk; @@ -344,7 +344,7 @@ dmu_zfetch_fetchsz(dnode_t *dn, uint64_t * for this block read. If so, it starts a prefetch for the stream it * located and returns true, otherwise it returns false */ -static int +static boolean_t dmu_zfetch_find(zfetch_t *zf, zstream_t *zh, int prefetched) { zstream_t *zs; @@ -669,7 +669,7 @@ dmu_zfetch(zfetch_t *zf, uint64_t offset { zstream_t zst; zstream_t *newstream; - int fetched; + boolean_t fetched; int inserted; unsigned int blkshft; uint64_t blksz; @@ -695,7 +695,8 @@ dmu_zfetch(zfetch_t *zf, uint64_t offset ZFETCHSTAT_BUMP(zfetchstat_hits); } else { ZFETCHSTAT_BUMP(zfetchstat_misses); - if (fetched = dmu_zfetch_colinear(zf, &zst)) { + fetched = dmu_zfetch_colinear(zf, &zst); + if (fetched) { ZFETCHSTAT_BUMP(zfetchstat_colinear_hits); } else { ZFETCHSTAT_BUMP(zfetchstat_colinear_misses); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Jul 5 03:01:35 2013 (r252749) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Jul 5 03:02:19 2013 (r252750) @@ -27,6 +27,8 @@ */ /* + * SPA: Storage Pool Allocator + * * This file contains all the routines used when modifying on-disk SPA state. * This includes opening, importing, destroying, exporting a pool, and syncing a * pool. Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Fri Jul 5 03:01:35 2013 (r252749) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Fri Jul 5 03:02:19 2013 (r252750) @@ -411,6 +411,8 @@ void dmu_write_policy(objset_t *os, stru * object must be held in an assigned transaction before calling * dmu_buf_will_dirty. You may use dmu_buf_set_user() on the bonus * buffer as well. You must release your hold with dmu_buf_rele(). + * + * Returns ENOENT, EIO, or 0. */ int dmu_bonus_hold(objset_t *os, uint64_t object, void *tag, dmu_buf_t **); int dmu_bonus_max(void); @@ -666,8 +668,14 @@ extern const dmu_object_byteswap_info_t * If doi is NULL, just indicates whether the object exists. */ int dmu_object_info(objset_t *os, uint64_t object, dmu_object_info_t *doi); +/* Like dmu_object_info, but faster if you have a held dnode in hand. */ void dmu_object_info_from_dnode(struct dnode *dn, dmu_object_info_t *doi); +/* Like dmu_object_info, but faster if you have a held dbuf in hand. */ void dmu_object_info_from_db(dmu_buf_t *db, dmu_object_info_t *doi); +/* + * Like dmu_object_info_from_db, but faster still when you only care about + * the size. This is specifically optimized for zfs_getattr(). + */ void dmu_object_size_from_db(dmu_buf_t *db, uint32_t *blksize, u_longlong_t *nblk512); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Fri Jul 5 03:01:35 2013 (r252749) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Fri Jul 5 03:02:19 2013 (r252750) @@ -279,6 +279,12 @@ txg_rele_to_sync(txg_handle_t *th) th->th_cpu = NULL; /* defensive */ } +/* + * Blocks until all transactions in the group are committed. + * + * On return, the transaction group has reached a stable state in which it can + * then be passed off to the syncing context. + */ static void txg_quiesce(dsl_pool_t *dp, uint64_t txg) { @@ -328,6 +334,9 @@ txg_do_callbacks(void *arg) /* * Dispatch the commit callbacks registered on this txg to worker threads. + * + * If no callbacks are registered for a given TXG, nothing happens. + * This function creates a taskq for the associated pool, if needed. */ static void txg_dispatch_callbacks(dsl_pool_t *dp, uint64_t txg) @@ -338,7 +347,10 @@ txg_dispatch_callbacks(dsl_pool_t *dp, u for (c = 0; c < max_ncpus; c++) { tx_cpu_t *tc = &tx->tx_cpu[c]; - /* No need to lock tx_cpu_t at this point */ + /* + * No need to lock tx_cpu_t at this point, since this can + * only be called once a txg has been synced. + */ int g = txg & TXG_MASK; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Fri Jul 5 03:01:35 2013 (r252749) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Fri Jul 5 03:02:19 2013 (r252750) @@ -1044,6 +1044,7 @@ vdev_uberblock_sync(zio_t *zio, uberbloc zio_buf_free(ubbuf, VDEV_UBERBLOCK_SIZE(vd)); } +/* Sync the uberblocks to all vdevs in svd[] */ int vdev_uberblock_sync_list(vdev_t **svd, int svdcount, uberblock_t *ub, int flags) { Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Fri Jul 5 03:01:35 2013 (r252749) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Fri Jul 5 03:02:19 2013 (r252750) @@ -433,23 +433,50 @@ static const zio_vsd_ops_t vdev_raidz_vs vdev_raidz_cksum_report }; +/* + * Divides the IO evenly across all child vdevs; usually, dcols is + * the number of children in the target vdev. + */ static raidz_map_t * vdev_raidz_map_alloc(zio_t *zio, uint64_t unit_shift, uint64_t dcols, uint64_t nparity) { raidz_map_t *rm; + /* The starting RAIDZ (parent) vdev sector of the block. */ uint64_t b = zio->io_offset >> unit_shift; + /* The zio's size in units of the vdev's minimum sector size. */ uint64_t s = zio->io_size >> unit_shift; + /* The first column for this stripe. */ uint64_t f = b % dcols; + /* The starting byte offset on each child vdev. */ uint64_t o = (b / dcols) << unit_shift; uint64_t q, r, c, bc, col, acols, scols, coff, devidx, asize, tot; + /* + * "Quotient": The number of data sectors for this stripe on all but + * the "big column" child vdevs that also contain "remainder" data. + */ q = s / (dcols - nparity); + + /* + * "Remainder": The number of partial stripe data sectors in this I/O. + * This will add a sector to some, but not all, child vdevs. + */ r = s - q * (dcols - nparity); + + /* The number of "big columns" - those which contain remainder data. */ bc = (r == 0 ? 0 : r + nparity); + + /* + * The total number of data and parity sectors associated with + * this I/O. + */ tot = s + nparity * (q + (r == 0 ? 0 : 1)); + /* acols: The columns that will be accessed. */ + /* scols: The columns that will be accessed or skipped. */ if (q == 0) { + /* Our I/O request doesn't span all child vdevs. */ acols = bc; scols = MIN(dcols, roundup(bc, nparity + 1)); } else { @@ -1529,6 +1556,23 @@ vdev_raidz_child_done(zio_t *zio) rc->rc_skipped = 0; } +/* + * Start an IO operation on a RAIDZ VDev + * + * Outline: + * - For write operations: + * 1. Generate the parity data + * 2. Create child zio write operations to each column's vdev, for both + * data and parity. + * 3. If the column skips any sectors for padding, create optional dummy + * write zio children for those areas to improve aggregation continuity. + * - For read operations: + * 1. Create child zio read operations to each data column's vdev to read + * the range of data required for zio. + * 2. If this is a scrub or resilver operation, or if any of the data + * vdevs have had errors, then create zio read operations to the parity + * columns' VDevs as well. + */ static int vdev_raidz_io_start(zio_t *zio) { @@ -1881,6 +1925,27 @@ done: return (ret); } +/* + * Complete an IO operation on a RAIDZ VDev + * + * Outline: + * - For write operations: + * 1. Check for errors on the child IOs. + * 2. Return, setting an error code if too few child VDevs were written + * to reconstruct the data later. Note that partial writes are + * considered successful if they can be reconstructed at all. + * - For read operations: + * 1. Check for errors on the child IOs. + * 2. If data errors occurred: + * a. Try to reassemble the data from the parity available. + * b. If we haven't yet read the parity drives, read them now. + * c. If all parity drives have been read but the data still doesn't + * reassemble with a correct checksum, then try combinatorial + * reconstruction. + * d. If that doesn't work, return an error. + * 3. If there were unexpected errors or this is a resilver operation, + * rewrite the vdevs that had errors. + */ static void vdev_raidz_io_done(zio_t *zio) { Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Fri Jul 5 03:01:35 2013 (r252749) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Fri Jul 5 03:02:19 2013 (r252750) @@ -633,6 +633,11 @@ static struct vop_vector zfsctl_ops_root .vop_fid = zfsctl_common_fid, }; +/* + * Gets the full dataset name that corresponds to the given snapshot name + * Example: + * zfsctl_snapshot_zname("snap1") -> "mypool/myfs@snap1" + */ static int zfsctl_snapshot_zname(vnode_t *vp, const char *name, int len, char *zname) { From owner-svn-src-stable-8@FreeBSD.ORG Fri Jul 5 03:06:44 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8371AFAC; Fri, 5 Jul 2013 03:06:44 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 71C7B1CB4; Fri, 5 Jul 2013 03:06:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6536i89056140; Fri, 5 Jul 2013 03:06:44 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6536b50056092; Fri, 5 Jul 2013 03:06:37 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201307050306.r6536b50056092@svn.freebsd.org> From: Xin LI Date: Fri, 5 Jul 2013 03:06:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252752 - in stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 05 Jul 2013 03:06:44 -0000 Author: delphij Date: Fri Jul 5 03:06:36 2013 New Revision: 252752 URL: http://svnweb.freebsd.org/changeset/base/252752 Log: MFC r251631: illumos #3742 zfs comments need cleaner, more consistent style - Make more of ZFS's comments use a natural English writing flow. - Break up long paragraphs, fix various typos and spelling errors. - Don't prefix a function description with its name when the function definition immediately follows. - Remove useless comments. - Add extra whitespace where it makes the comments more readable. New comments were separated from this change and added in r251629. Submitted by: asomers, gibbs, will Reviewed by: Matthew Ahrens , George Wilson , Eric Schrock , Christopher Siden Sponsored by: Spectra Logic Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/unique.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_leaf.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_rlock.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Jul 5 03:06:36 2013 (r252752) @@ -57,11 +57,11 @@ * tight. * * 3. The Megiddo and Modha model assumes a fixed page size. All - * elements of the cache are therefor exactly the same size. So + * elements of the cache are therefore exactly the same size. So * when adjusting the cache size following a cache miss, its simply * a matter of choosing a single page to evict. In our model, we * have variable sized cache blocks (rangeing from 512 bytes to - * 128K bytes). We therefor choose a set of blocks to evict to make + * 128K bytes). We therefore choose a set of blocks to evict to make * space for a cache miss that approximates as closely as possible * the space used by the new block. * @@ -76,7 +76,7 @@ * ways: 1) via a hash table lookup using the DVA as a key, * or 2) via one of the ARC lists. The arc_read() interface * uses method 1, while the internal arc algorithms for - * adjusting the cache use method 2. We therefor provide two + * adjusting the cache use method 2. We therefore provide two * types of locks: 1) the hash table lock array, and 2) the * arc list locks. * @@ -428,7 +428,7 @@ static arc_stats_t arc_stats = { #define ARCSTAT(stat) (arc_stats.stat.value.ui64) #define ARCSTAT_INCR(stat, val) \ - atomic_add_64(&arc_stats.stat.value.ui64, (val)); + atomic_add_64(&arc_stats.stat.value.ui64, (val)) #define ARCSTAT_BUMP(stat) ARCSTAT_INCR(stat, 1) #define ARCSTAT_BUMPDOWN(stat) ARCSTAT_INCR(stat, -1) @@ -654,9 +654,7 @@ uint64_t zfs_crc64_table[256]; #define l2arc_writes_sent ARCSTAT(arcstat_l2_writes_sent) #define l2arc_writes_done ARCSTAT(arcstat_l2_writes_done) -/* - * L2ARC Performance Tunables - */ +/* L2ARC Performance Tunables */ uint64_t l2arc_write_max = L2ARC_WRITE_SIZE; /* default max write size */ uint64_t l2arc_write_boost = L2ARC_WRITE_SIZE; /* extra write during warmup */ uint64_t l2arc_headroom = L2ARC_HEADROOM; /* number of dev writes */ @@ -3817,7 +3815,7 @@ arc_tempreserve_space(uint64_t reserve, /* * Writes will, almost always, require additional memory allocations - * in order to compress/encrypt/etc the data. We therefor need to + * in order to compress/encrypt/etc the data. We therefore need to * make sure that there is sufficient available memory for this. */ if (error = arc_memory_throttle(reserve, anon_size, txg)) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c Fri Jul 5 03:06:36 2013 (r252752) @@ -43,7 +43,7 @@ * dsl_scan_sync. This allows the delete operation to finish without traversing * all the dataset's blocks. * - * Note that while bt_begin and bt_end are only ever incremented in this code + * Note that while bt_begin and bt_end are only ever incremented in this code, * they are effectively reset to 0 every time the entire bptree is freed because * the bptree's object is destroyed and re-created. */ Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Fri Jul 5 03:06:36 2013 (r252752) @@ -1808,14 +1808,16 @@ dnode_willuse_space(dnode_t *dn, int64_t } /* - * This function scans a block at the indicated "level" looking for - * a hole or data (depending on 'flags'). If level > 0, then we are - * scanning an indirect block looking at its pointers. If level == 0, - * then we are looking at a block of dnodes. If we don't find what we - * are looking for in the block, we return ESRCH. Otherwise, return - * with *offset pointing to the beginning (if searching forwards) or - * end (if searching backwards) of the range covered by the block - * pointer we matched on (or dnode). + * Scans a block at the indicated "level" looking for a hole or data, + * depending on 'flags'. + * + * If level > 0, then we are scanning an indirect block looking at its + * pointers. If level == 0, then we are looking at a block of dnodes. + * + * If we don't find what we are looking for in the block, we return ESRCH. + * Otherwise, return with *offset pointing to the beginning (if searching + * forwards) or end (if searching backwards) of the range covered by the + * block pointer we matched on (or dnode). * * The basic search algorithm used below by dnode_next_offset() is to * use this function to search up the block tree (widen the search) until Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Fri Jul 5 03:06:36 2013 (r252752) @@ -302,7 +302,7 @@ free_children(dmu_buf_impl_t *db, uint64 } /* - * free_range: Traverse the indicated range of the provided file + * Traverse the indicated range of the provided file * and "free" all the blocks contained there. */ static void @@ -370,7 +370,7 @@ dnode_sync_free_range(dnode_t *dn, uint6 } /* - * Try to kick all the dnodes dbufs out of the cache... + * Try to kick all the dnode's dbufs out of the cache... */ void dnode_evict_dbufs(dnode_t *dn) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Fri Jul 5 03:06:36 2013 (r252752) @@ -379,7 +379,7 @@ dsl_prop_predict(dsl_dir_t *dd, const ch /* * Unregister this callback. Return 0 on success, ENOENT if ddname is - * invalid, ENOMSG if no matching callback registered. + * invalid, or ENOMSG if no matching callback registered. */ int dsl_prop_unregister(dsl_dataset_t *ds, const char *propname, Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c Fri Jul 5 03:06:36 2013 (r252752) @@ -111,6 +111,7 @@ * location. * * Byteswap implications: + * * Since the SA attributes are not entirely self describing we can't do * the normal byteswap processing. The special ZAP layout attribute and * attribute registration attributes define the byteswap function and the @@ -189,7 +190,6 @@ sa_attr_reg_t sa_legacy_attrs[] = { }; /* - * ZPL legacy layout * This is only used for objects of type DMU_OT_ZNODE */ sa_attr_type_t sa_legacy_zpl_layout[] = { @@ -199,7 +199,6 @@ sa_attr_type_t sa_legacy_zpl_layout[] = /* * Special dummy layout used for buffers with no attributes. */ - sa_attr_type_t sa_dummy_zpl_layout[] = { 0 }; static int sa_legacy_attr_count = 16; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Jul 5 03:06:36 2013 (r252752) @@ -4698,6 +4698,7 @@ spa_vdev_attach(spa_t *spa, uint64_t gui /* * Detach a device from a mirror or replacing vdev. + * * If 'replace_done' is specified, only detach if the parent * is a replacing vdev. */ @@ -5359,11 +5360,9 @@ spa_vdev_remove_from_namespace(spa_t *sp * the spa_vdev_config_[enter/exit] functions which allow us to * grab and release the spa_config_lock while still holding the namespace * lock. During each step the configuration is synced out. - */ - -/* - * Remove a device from the pool. Currently, this supports removing only hot - * spares, slogs, and level 2 ARC devices. + * + * Currently, this supports removing only hot spares, slogs, and level 2 ARC + * devices. */ int spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare) @@ -5473,7 +5472,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui /* * Find any device that's done replacing, or a vdev marked 'unspare' that's - * current spared, so we can detach it. + * currently spared, so we can detach it. */ static vdev_t * spa_vdev_resilver_done_hunt(vdev_t *vd) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Fri Jul 5 03:06:36 2013 (r252752) @@ -307,6 +307,7 @@ spa_config_set(spa_t *spa, nvlist_t *con /* * Generate the pool's configuration based on the current in-core state. + * * We infer whether to generate a complete config or just one top-level config * based on whether vd is the root vdev. */ Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Fri Jul 5 03:06:36 2013 (r252752) @@ -1369,7 +1369,7 @@ zfs_panic_recover(const char *fmt, ...) /* * This is a stripped-down version of strtoull, suitable only for converting - * lowercase hexidecimal numbers that don't overflow. + * lowercase hexadecimal numbers that don't overflow. */ uint64_t zfs_strtonum(const char *str, char **nptr) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h Fri Jul 5 03:06:36 2013 (r252752) @@ -63,16 +63,15 @@ enum ddt_class { */ typedef struct ddt_key { zio_cksum_t ddk_cksum; /* 256-bit block checksum */ - uint64_t ddk_prop; /* LSIZE, PSIZE, compression */ + /* + * Encoded with logical & physical size, and compression, as follows: + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * | 0 | 0 | 0 | comp | PSIZE | LSIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + */ + uint64_t ddk_prop; } ddt_key_t; -/* - * ddk_prop layout: - * - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * | 0 | 0 | 0 | comp | PSIZE | LSIZE | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - */ #define DDK_GET_LSIZE(ddk) \ BF64_GET_SB((ddk)->ddk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1) #define DDK_SET_LSIZE(ddk, x) \ Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Fri Jul 5 03:06:36 2013 (r252752) @@ -145,9 +145,8 @@ typedef struct dnode_phys { typedef struct dnode { /* - * dn_struct_rwlock protects the structure of the dnode, - * including the number of levels of indirection (dn_nlevels), - * dn_maxblkid, and dn_next_* + * Protects the structure of the dnode, including the number of levels + * of indirection (dn_nlevels), dn_maxblkid, and dn_next_* */ krwlock_t dn_struct_rwlock; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Fri Jul 5 03:06:36 2013 (r252752) @@ -110,6 +110,7 @@ typedef struct dsl_pool { /* * Protects administrative changes (properties, namespace) + * * It is only held for write in syncing context. Therefore * syncing context does not need to ever have it for read, since * nobody else could possibly have it for write. Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa_impl.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa_impl.h Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa_impl.h Fri Jul 5 03:06:36 2013 (r252752) @@ -150,6 +150,7 @@ struct sa_os { /* * header for all bonus and spill buffers. + * * The header has a fixed portion with a variable number * of "lengths" depending on the number of variable sized * attribues which are determined by the "layout number" @@ -158,29 +159,27 @@ struct sa_os { #define SA_MAGIC 0x2F505A /* ZFS SA */ typedef struct sa_hdr_phys { uint32_t sa_magic; - uint16_t sa_layout_info; /* Encoded with hdrsize and layout number */ + /* + * Encoded with hdrsize and layout number as follows: + * 16 10 0 + * +--------+-------+ + * | hdrsz |layout | + * +--------+-------+ + * + * Bits 0-10 are the layout number + * Bits 11-16 are the size of the header. + * The hdrsize is the number * 8 + * + * For example. + * hdrsz of 1 ==> 8 byte header + * 2 ==> 16 byte header + * + */ + uint16_t sa_layout_info; uint16_t sa_lengths[1]; /* optional sizes for variable length attrs */ /* ... Data follows the lengths. */ } sa_hdr_phys_t; -/* - * sa_hdr_phys -> sa_layout_info - * - * 16 10 0 - * +--------+-------+ - * | hdrsz |layout | - * +--------+-------+ - * - * Bits 0-10 are the layout number - * Bits 11-16 are the size of the header. - * The hdrsize is the number * 8 - * - * For example. - * hdrsz of 1 ==> 8 byte header - * 2 ==> 16 byte header - * - */ - #define SA_HDR_LAYOUT_NUM(hdr) BF32_GET(hdr->sa_layout_info, 0, 10) #define SA_HDR_SIZE(hdr) BF32_GET_SB(hdr->sa_layout_info, 10, 6, 3, 0) #define SA_HDR_LAYOUT_INFO_ENCODE(x, num, size) \ Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Fri Jul 5 03:06:36 2013 (r252752) @@ -242,7 +242,7 @@ struct spa { uint64_t spa_sync_starttime; /* starting time fo spa_sync */ uint64_t spa_deadman_synctime; /* deadman expiration timer */ /* - * spa_refcnt & spa_config_lock must be the last elements + * spa_refcount & spa_config_lock must be the last elements * because refcount_t changes size based on compilation options. * In order for the MDB module to function correctly, the other * fields must remain in the same location. Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h Fri Jul 5 03:06:36 2013 (r252752) @@ -94,7 +94,6 @@ struct space_map_ops { * 63 62 60 59 50 49 0 * * - * * non-debug entry * * 1 47 1 15 Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/unique.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/unique.h Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/unique.h Fri Jul 5 03:06:36 2013 (r252752) @@ -26,8 +26,6 @@ #ifndef _SYS_UNIQUE_H #define _SYS_UNIQUE_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include #ifdef __cplusplus @@ -42,7 +40,7 @@ void unique_fini(void); /* * Return a new unique value (which will not be uniquified against until - * it is unique_insert()-ed. + * it is unique_insert()-ed). */ uint64_t unique_create(void); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Fri Jul 5 03:06:36 2013 (r252752) @@ -247,12 +247,13 @@ typedef struct vdev_label { #define VDD_METASLAB 0x01 #define VDD_DTL 0x02 +/* Offset of embedded boot loader region on each label */ +#define VDEV_BOOT_OFFSET (2 * sizeof (vdev_label_t)) /* - * Size and offset of embedded boot loader region on each label. + * Size of embedded boot loader region on each label. * The total size of the first two labels plus the boot area is 4MB. */ -#define VDEV_BOOT_OFFSET (2 * sizeof (vdev_label_t)) -#define VDEV_BOOT_SIZE (7ULL << 19) /* 3.5M */ +#define VDEV_BOOT_SIZE (7ULL << 19) /* 3.5M */ /* * Size of label regions at the start and end of each leaf device. @@ -323,8 +324,9 @@ extern uint64_t vdev_get_min_asize(vdev_ extern void vdev_set_min_asize(vdev_t *vd); /* - * zdb uses this tunable, so it must be declared here to make lint happy. + * Global variables */ +/* zdb uses this tunable, so it must be declared here to make lint happy. */ extern int zfs_vdev_cache_size; #ifdef __cplusplus Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h Fri Jul 5 03:06:36 2013 (r252752) @@ -86,18 +86,22 @@ extern "C" { #endif /* - * The matchtype specifies which entry will be accessed. - * MT_EXACT: only find an exact match (non-normalized) - * MT_FIRST: find the "first" normalized (case and Unicode - * form) match; the designated "first" match will not change as long - * as the set of entries with this normalization doesn't change - * MT_BEST: if there is an exact match, find that, otherwise find the - * first normalized match + * Specifies matching criteria for ZAP lookups. */ typedef enum matchtype { + /* Only find an exact match (non-normalized) */ MT_EXACT, + /* + * If there is an exact match, find that, otherwise find the + * first normalized match. + */ MT_BEST, + /* + * Find the "first" normalized (case and Unicode form) match; + * the designated "first" match will not change as long as the + * set of entries with this normalization doesn't change. + */ MT_FIRST } matchtype_t; @@ -174,16 +178,21 @@ int zap_destroy(objset_t *ds, uint64_t z * call will fail and return EINVAL. * * If 'integer_size' is equal to or larger than the attribute's integer - * size, the call will succeed and return 0. * When converting to a - * larger integer size, the integers will be treated as unsigned (ie. no - * sign-extension will be performed). + * size, the call will succeed and return 0. + * + * When converting to a larger integer size, the integers will be treated as + * unsigned (ie. no sign-extension will be performed). * * 'num_integers' is the length (in integers) of 'buf'. * * If the attribute is longer than the buffer, as many integers as will * fit will be transferred to 'buf'. If the entire attribute was not * transferred, the call will return EOVERFLOW. - * + */ +int zap_lookup(objset_t *ds, uint64_t zapobj, const char *name, + uint64_t integer_size, uint64_t num_integers, void *buf); + +/* * If rn_len is nonzero, realname will be set to the name of the found * entry (which may be different from the requested name if matchtype is * not MT_EXACT). @@ -191,8 +200,6 @@ int zap_destroy(objset_t *ds, uint64_t z * If normalization_conflictp is not NULL, it will be set if there is * another name with the same case/unicode normalized form. */ -int zap_lookup(objset_t *ds, uint64_t zapobj, const char *name, - uint64_t integer_size, uint64_t num_integers, void *buf); int zap_lookup_norm(objset_t *ds, uint64_t zapobj, const char *name, uint64_t integer_size, uint64_t num_integers, void *buf, matchtype_t mt, char *realname, int rn_len, Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_leaf.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_leaf.h Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_leaf.h Fri Jul 5 03:06:36 2013 (r252752) @@ -101,6 +101,7 @@ typedef enum zap_chunk_type { */ typedef struct zap_leaf_phys { struct zap_leaf_header { + /* Public to ZAP */ uint64_t lh_block_type; /* ZBT_LEAF */ uint64_t lh_pad1; uint64_t lh_prefix; /* hash prefix of this leaf */ @@ -109,8 +110,7 @@ typedef struct zap_leaf_phys { uint16_t lh_nentries; /* number of entries */ uint16_t lh_prefix_len; /* num bits used to id this */ -/* above is accessable to zap, below is zap_leaf private */ - + /* Private to zap_leaf */ uint16_t lh_freelist; /* chunk head of free list */ uint8_t lh_flags; /* ZLF_* flags */ uint8_t lh_pad2[11]; @@ -161,13 +161,13 @@ typedef struct zap_leaf { typedef struct zap_entry_handle { - /* below is set by zap_leaf.c and is public to zap.c */ + /* Set by zap_leaf and public to ZAP */ uint64_t zeh_num_integers; uint64_t zeh_hash; uint32_t zeh_cd; uint8_t zeh_integer_size; - /* below is private to zap_leaf.c */ + /* Private to zap_leaf */ uint16_t zeh_fakechunk; uint16_t *zeh_chunkp; zap_leaf_t *zeh_leaf; @@ -202,7 +202,7 @@ extern int zap_entry_read_name(struct za /* * Replace the value of an existing entry. * - * zap_entry_update may fail if it runs out of space (ENOSPC). + * May fail if it runs out of space (ENOSPC). */ extern int zap_entry_update(zap_entry_handle_t *zeh, uint8_t integer_size, uint64_t num_integers, const void *buf); @@ -221,10 +221,7 @@ extern int zap_entry_create(zap_leaf_t * uint8_t integer_size, uint64_t num_integers, const void *buf, zap_entry_handle_t *zeh); -/* - * Return true if there are additional entries with the same normalized - * form. - */ +/* Determine whether there is another entry with the same normalized form. */ extern boolean_t zap_entry_normalization_conflict(zap_entry_handle_t *zeh, struct zap_name *zn, const char *name, struct zap *zap); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h Fri Jul 5 03:06:36 2013 (r252752) @@ -45,7 +45,8 @@ struct znode_phys; #define ZFS_ACL_VERSION ZFS_ACL_VERSION_FUID /* - * ZFS ACLs are store in various forms. + * ZFS ACLs (Access Control Lists) are stored in various forms. + * * Files created with ACL version ZFS_ACL_VERSION_INITIAL * will all be created with fixed length ACEs of type * zfs_oldace_t. @@ -135,8 +136,8 @@ typedef struct acl_ops { size_t (*ace_size)(void *acep); /* how big is this ace */ size_t (*ace_abstract_size)(void); /* sizeof abstract entry */ int (*ace_mask_off)(void); /* off of access mask in ace */ + /* ptr to data if any */ int (*ace_data)(void *acep, void **datap); - /* ptr to data if any */ } acl_ops_t; /* Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_rlock.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_rlock.h Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_rlock.h Fri Jul 5 03:06:36 2013 (r252752) @@ -26,8 +26,6 @@ #ifndef _SYS_FS_ZFS_RLOCK_H #define _SYS_FS_ZFS_RLOCK_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -57,16 +55,14 @@ typedef struct rl { } rl_t; /* - * Lock a range (offset, length) as either shared (READER) - * or exclusive (WRITER or APPEND). APPEND is a special type that - * is converted to WRITER that specified to lock from the start of the - * end of file. zfs_range_lock() returns the range lock structure. + * Lock a range (offset, length) as either shared (RL_READER) + * or exclusive (RL_WRITER or RL_APPEND). RL_APPEND is a special type that + * is converted to RL_WRITER that specified to lock from the start of the + * end of file. Returns the range lock structure. */ rl_t *zfs_range_lock(znode_t *zp, uint64_t off, uint64_t len, rl_type_t type); -/* - * Unlock range and destroy range lock structure. - */ +/* Unlock range and destroy range lock structure. */ void zfs_range_unlock(rl_t *rl); /* @@ -76,7 +72,8 @@ void zfs_range_unlock(rl_t *rl); void zfs_range_reduce(rl_t *rl, uint64_t off, uint64_t len); /* - * AVL comparison function used to compare range locks + * AVL comparison function used to order range locks + * Locks are ordered on the start offset of the range. */ int zfs_range_compare(const void *arg1, const void *arg2); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Fri Jul 5 03:06:36 2013 (r252752) @@ -135,8 +135,9 @@ extern "C" { #define ZFS_MAX_BLOCKSIZE (SPA_MAXBLOCKSIZE) -/* Path component length */ /* + * Path component length + * * The generic fs code uses MAXNAMELEN to represent * what the largest component length is. Unfortunately, * this length includes the terminating NULL. ZFS needs @@ -252,12 +253,7 @@ VTOZ(vnode_t *vp) #define VTOZ(VP) ((znode_t *)(VP)->v_data) #endif -/* - * ZFS_ENTER() is called on entry to each ZFS vnode and vfs operation. - * ZFS_ENTER_NOERROR() is called when we can't return EIO. - * ZFS_EXIT() must be called before exitting the vop. - * ZFS_VERIFY_ZP() verifies the znode is valid. - */ +/* Called on entry to each ZFS vnode and vfs operation */ #define ZFS_ENTER(zfsvfs) \ { \ rrw_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ @@ -267,11 +263,14 @@ VTOZ(vnode_t *vp) } \ } +/* Called on entry to each ZFS vnode and vfs operation that can not return EIO */ #define ZFS_ENTER_NOERROR(zfsvfs) \ rrw_enter(&(zfsvfs)->z_teardown_lock, RW_READER, FTAG) +/* Must be called before exiting the vop */ #define ZFS_EXIT(zfsvfs) rrw_exit(&(zfsvfs)->z_teardown_lock, FTAG) +/* Verifies the znode is valid */ #define ZFS_VERIFY_ZP(zp) \ if ((zp)->z_sa_hdl == NULL) { \ ZFS_EXIT((zp)->z_zfsvfs); \ @@ -291,15 +290,14 @@ VTOZ(vnode_t *vp) #define ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num) \ mutex_exit(ZFS_OBJ_MUTEX((zfsvfs), (obj_num))) -/* - * Macros to encode/decode ZFS stored time values from/to struct timespec - */ +/* Encode ZFS stored time values from a struct timespec */ #define ZFS_TIME_ENCODE(tp, stmp) \ { \ (stmp)[0] = (uint64_t)(tp)->tv_sec; \ (stmp)[1] = (uint64_t)(tp)->tv_nsec; \ } +/* Decode ZFS stored time values to a struct timespec */ #define ZFS_TIME_DECODE(tp, stmp) \ { \ (tp)->tv_sec = (time_t)(stmp)[0]; \ Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h Fri Jul 5 03:06:36 2013 (r252752) @@ -242,6 +242,12 @@ typedef struct { * information needed for replaying the create. If the * file doesn't have any actual ACEs then the lr_aclcnt * would be zero. + * + * After lr_acl_flags, there are a lr_acl_bytes number of variable sized ace's. + * If create is also setting xvattr's, then acl data follows xvattr. + * If ACE FUIDs are needed then they will follow the xvattr_t. Following + * the FUIDs will be the domain table information. The FUIDs for the owner + * and group will be in lr_create. Name follows ACL data. */ typedef struct { lr_create_t lr_create; /* common create portion */ @@ -250,13 +256,6 @@ typedef struct { uint64_t lr_fuidcnt; /* number of real fuids */ uint64_t lr_acl_bytes; /* number of bytes in ACL */ uint64_t lr_acl_flags; /* ACL flags */ - /* lr_acl_bytes number of variable sized ace's follows */ - /* if create is also setting xvattr's, then acl data follows xvattr */ - /* if ACE FUIDs are needed then they will follow the xvattr_t */ - /* Following the FUIDs will be the domain table information. */ - /* The FUIDs for the owner and group will be in the lr_create */ - /* portion of the record. */ - /* name follows ACL data */ } lr_acl_create_t; typedef struct { Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h Fri Jul 5 03:06:36 2013 (r252752) @@ -36,11 +36,10 @@ extern "C" { #endif -/* - * Common signature for all zio compress/decompress functions. - */ +/* Common signature for all zio compress functions. */ typedef size_t zio_compress_func_t(void *src, void *dst, size_t s_len, size_t d_len, int); +/* Common signature for all zio decompress functions. */ typedef int zio_decompress_func_t(void *src, void *dst, size_t s_len, size_t d_len, int); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Fri Jul 5 03:06:36 2013 (r252752) @@ -501,8 +501,8 @@ txg_quiesce_thread(void *arg) /* * Delay this thread by 'ticks' if we are still in the open transaction - * group and there is already a waiting txg quiesing or quiesced. Abort - * the delay if this txg stalls or enters the quiesing state. + * group and there is already a waiting txg quiescing or quiesced. + * Abort the delay if this txg stalls or enters the quiescing state. */ void txg_delay(dsl_pool_t *dp, uint64_t txg, int ticks) @@ -510,7 +510,7 @@ txg_delay(dsl_pool_t *dp, uint64_t txg, tx_state_t *tx = &dp->dp_tx; clock_t timeout = ddi_get_lbolt() + ticks; - /* don't delay if this txg could transition to quiesing immediately */ + /* don't delay if this txg could transition to quiescing immediately */ if (tx->tx_open_txg > txg || tx->tx_syncing_txg == txg-1 || tx->tx_synced_txg == txg-1) return; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Fri Jul 5 03:06:36 2013 (r252752) @@ -963,9 +963,11 @@ vdev_probe_done(zio_t *zio) } /* - * Determine whether this device is accessible by reading and writing - * to several known locations: the pad regions of each vdev label - * but the first (which we leave alone in case it contains a VTOC). + * Determine whether this device is accessible. + * + * Read and write to several known locations: the pad regions of each + * vdev label but the first, which we leave alone in case it contains + * a VTOC. */ zio_t * vdev_probe(vdev_t *vd, zio_t *zio) @@ -2191,10 +2193,12 @@ vdev_degrade(spa_t *spa, uint64_t guid, } /* - * Online the given vdev. If 'unspare' is set, it implies two things. First, - * any attached spare device should be detached when the device finishes - * resilvering. Second, the online should be treated like a 'test' online case, - * so no FMA events are generated if the device fails to open. + * Online the given vdev. + * + * If 'ZFS_ONLINE_UNSPARE' is set, it implies two things. First, any attached + * spare device should be detached when the device finishes resilvering. + * Second, the online should be treated like a 'test' online case, so no FMA + * events are generated if the device fails to open. */ int vdev_online(spa_t *spa, uint64_t guid, uint64_t flags, vdev_state_t *newstate) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Fri Jul 5 03:06:36 2013 (r252752) @@ -35,13 +35,14 @@ /* * These tunables are for performance analysis. */ + +/* The maximum number of I/Os concurrently pending to each device. */ +int zfs_vdev_max_pending = 10; + /* - * zfs_vdev_max_pending is the maximum number of i/os concurrently - * pending to each device. zfs_vdev_min_pending is the initial number - * of i/os pending to each device (before it starts ramping up to - * max_pending). + * The initial number of I/Os pending to each device, before it starts ramping + * up to zfs_vdev_max_pending. */ -int zfs_vdev_max_pending = 10; int zfs_vdev_min_pending = 4; /* Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Fri Jul 5 03:06:36 2013 (r252752) @@ -60,6 +60,7 @@ * o addition (+) is represented by a bitwise XOR * o subtraction (-) is therefore identical to addition: A + B = A - B * o multiplication of A by 2 is defined by the following bitwise expression: + * * (A * 2)_7 = A_6 * (A * 2)_6 = A_5 * (A * 2)_5 = A_4 @@ -118,7 +119,7 @@ typedef struct raidz_map { uint64_t rm_missingparity; /* Count of missing parity devices */ uint64_t rm_firstdatacol; /* First data column/parity count */ uint64_t rm_nskip; /* Skipped sectors for padding */ - uint64_t rm_skipstart; /* Column index of padding start */ + uint64_t rm_skipstart; /* Column index of padding start */ void *rm_datacopy; /* rm_asize-buffer of copied data */ uintptr_t rm_reports; /* # of referencing checksum reports */ uint8_t rm_freed; /* map no longer has referencing ZIO */ @@ -158,10 +159,7 @@ typedef struct raidz_map { */ int vdev_raidz_default_to_general; -/* - * These two tables represent powers and logs of 2 in the Galois field defined - * above. These values were computed by repeatedly multiplying by 2 as above. - */ +/* Powers of 2 in the Galois field defined above. */ static const uint8_t vdev_raidz_pow2[256] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26, @@ -196,6 +194,7 @@ static const uint8_t vdev_raidz_pow2[256 0x2c, 0x58, 0xb0, 0x7d, 0xfa, 0xe9, 0xcf, 0x83, 0x1b, 0x36, 0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x01 }; +/* Logs of 2 in the Galois field defined above. */ static const uint8_t vdev_raidz_log2[256] = { 0x00, 0x00, 0x01, 0x19, 0x02, 0x32, 0x1a, 0xc6, 0x03, 0xdf, 0x33, 0xee, 0x1b, 0x68, 0xc7, 0x4b, Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Fri Jul 5 03:06:36 2013 (r252752) @@ -1359,7 +1359,8 @@ zfs_acl_chmod(vtype_t vtype, uint64_t mo zacep = (void *)((uintptr_t)zacep + abstract_size); new_count++; new_bytes += abstract_size; - } if (masks.deny1) { + } + if (masks.deny1) { zfs_set_ace(aclp, zacep, masks.deny1, DENY, -1, ACE_OWNER); zacep = (void *)((uintptr_t)zacep + abstract_size); new_count++; @@ -1767,7 +1768,7 @@ zfs_acl_ids_overquota(zfsvfs_t *zfsvfs, } /* - * Retrieve a files ACL + * Retrieve a file's ACL */ int zfs_getacl(znode_t *zp, vsecattr_t *vsecp, boolean_t skipaclchk, cred_t *cr) @@ -1922,7 +1923,7 @@ zfs_vsec_2_aclp(zfsvfs_t *zfsvfs, vtype_ } /* - * Set a files ACL + * Set a file's ACL */ int zfs_setacl(znode_t *zp, vsecattr_t *vsecp, boolean_t skipaclchk, cred_t *cr) @@ -2355,6 +2356,7 @@ slow: /* * Determine whether Access should be granted/denied. + * * The least priv subsytem is always consulted as a basic privilege * can define any form of access. */ @@ -2560,7 +2562,6 @@ zfs_delete_final_check(znode_t *zp, znod * Determine whether Access should be granted/deny, without * consulting least priv subsystem. * - * * The following chart is the recommended NFSv4 enforcement for * ability to delete an object. * Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Fri Jul 5 03:06:36 2013 (r252752) @@ -1234,6 +1234,7 @@ zfsctl_shares_readdir(ap) /* * pvp is the '.zfs' directory (zfsctl_node_t). + * * Creates vp, which is '.zfs/snapshot' (zfsctl_snapdir_t). * * This function is the callback to create a GFS vnode for '.zfs/snapshot' Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Jul 5 03:06:36 2013 (r252752) @@ -335,9 +335,7 @@ zfs_is_bootfs(const char *name) } /* - * zfs_earlier_version - * - * Return non-zero if the spa version is less than requested version. + * Return non-zero if the spa version is less than requested version. */ static int zfs_earlier_version(const char *name, int version) @@ -355,8 +353,6 @@ zfs_earlier_version(const char *name, in } /* - * zpl_earlier_version - * * Return TRUE if the ZPL version is less than requested version. */ static boolean_t @@ -3000,10 +2996,10 @@ zfs_create_cb(objset_t *os, void *arg, c /* * inputs: - * createprops list of properties requested by creator - * default_zplver zpl version to use if unspecified in createprops - * fuids_ok fuids allowed in this version of the spa? * os parent objset pointer (NULL if root fs) + * fuids_ok fuids allowed in this version of the spa? + * sa_ok SAs allowed in this version of the spa? + * createprops list of properties requested by creator * * outputs: * zplprops values for the zplprops we attach to the master node object Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c Fri Jul 5 03:06:36 2013 (r252752) @@ -216,9 +216,8 @@ zfs_log_fuid_domains(zfs_fuid_info_t *fu } /* - * zfs_log_create() is used to handle TX_CREATE, TX_CREATE_ATTR, TX_MKDIR, - * TX_MKDIR_ATTR and TX_MKXATTR - * transactions. + * Handles TX_CREATE, TX_CREATE_ATTR, TX_MKDIR, TX_MKDIR_ATTR and + * TK_MKXATTR transactions. * * TX_CREATE and TX_MKDIR are standard creates, but they may have FUID * domain information appended prior to the name. In this case the @@ -345,7 +344,7 @@ zfs_log_create(zilog_t *zilog, dmu_tx_t } /* - * zfs_log_remove() handles both TX_REMOVE and TX_RMDIR transactions. + * Handles both TX_REMOVE and TX_RMDIR transactions. */ void zfs_log_remove(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, @@ -369,7 +368,7 @@ zfs_log_remove(zilog_t *zilog, dmu_tx_t } /* - * zfs_log_link() handles TX_LINK transactions. + * Handles TX_LINK transactions. */ void zfs_log_link(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, @@ -392,7 +391,7 @@ zfs_log_link(zilog_t *zilog, dmu_tx_t *t } /* - * zfs_log_symlink() handles TX_SYMLINK transactions. + * Handles TX_SYMLINK transactions. */ void zfs_log_symlink(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, @@ -424,7 +423,7 @@ zfs_log_symlink(zilog_t *zilog, dmu_tx_t } /* - * zfs_log_rename() handles TX_RENAME transactions. + * Handles TX_RENAME transactions. */ void zfs_log_rename(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype, @@ -450,7 +449,7 @@ zfs_log_rename(zilog_t *zilog, dmu_tx_t } /* - * zfs_log_write() handles TX_WRITE transactions. + * Handles TX_WRITE transactions. */ ssize_t zfs_immediate_write_sz = 32768; @@ -529,7 +528,7 @@ zfs_log_write(zilog_t *zilog, dmu_tx_t * } /* - * zfs_log_truncate() handles TX_TRUNCATE transactions. + * Handles TX_TRUNCATE transactions. */ void zfs_log_truncate(zilog_t *zilog, dmu_tx_t *tx, int txtype, @@ -552,7 +551,7 @@ zfs_log_truncate(zilog_t *zilog, dmu_tx_ } /* - * zfs_log_setattr() handles TX_SETATTR transactions. + * Handles TX_SETATTR transactions. */ void zfs_log_setattr(zilog_t *zilog, dmu_tx_t *tx, int txtype, @@ -614,7 +613,7 @@ zfs_log_setattr(zilog_t *zilog, dmu_tx_t } /* - * zfs_log_acl() handles TX_ACL transactions. + * Handles TX_ACL transactions. */ void zfs_log_acl(zilog_t *zilog, dmu_tx_t *tx, znode_t *zp, Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c Fri Jul 5 03:06:36 2013 (r252752) @@ -28,7 +28,7 @@ /* * This file contains the code to implement file range locking in - * ZFS, although there isn't much specific to ZFS (all that comes to mind + * ZFS, although there isn't much specific to ZFS (all that comes to mind is * support for growing the blocksize). * * Interface Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c Fri Jul 5 03:06:36 2013 (r252752) @@ -187,7 +187,7 @@ zfs_sa_set_scanstamp(znode_t *zp, xvattr /* * I'm not convinced we should do any of this upgrade. * since the SA code can read both old/new znode formats - * with probably little to know performance difference. + * with probably little to no performance difference. * * All new files will be created with the new format. */ Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Fri Jul 5 03:05:59 2013 (r252751) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Fri Jul 5 03:06:36 2013 (r252752) @@ -1340,13 +1340,12 @@ zfs_parse_bootfs(char *bpath, char *outp } /* - * zfs_check_global_label: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Fri Jul 5 03:38:55 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 10E29B02; Fri, 5 Jul 2013 03:38:55 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E6EE71E49; Fri, 5 Jul 2013 03:38:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r653cstB065126; Fri, 5 Jul 2013 03:38:54 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r653csJ2065123; Fri, 5 Jul 2013 03:38:54 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201307050338.r653csJ2065123@svn.freebsd.org> From: Xin LI Date: Fri, 5 Jul 2013 03:38:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252755 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 05 Jul 2013 03:38:55 -0000 Author: delphij Date: Fri Jul 5 03:38:53 2013 New Revision: 252755 URL: http://svnweb.freebsd.org/changeset/base/252755 Log: MFC r251632: illumos #3743 zfs needs a refcount audit Audit zap cursor usage and correct missing calls to zap_cursor_fini(). sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c: Correct early exit handling of several functions that previously failed to close a cursor prior to returning. Submitted by: gibbs Audit holders of dmu_bufs and correct missing calls to dmu_buf_rele(). sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c: Correct early exit handling of several functions that previously failed to release a dmu_buf prior to returning. Submitted by: will Reviewed by: Matthew Ahrens , Eric Schrock , George Wilson , Christopher Siden Sponsored by: Spectra Logic Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Fri Jul 5 03:38:06 2013 (r252754) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Fri Jul 5 03:38:53 2013 (r252755) @@ -361,8 +361,10 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uin /* Make sure dsobj has the correct object type. */ dmu_object_info_from_db(dbuf, &doi); - if (doi.doi_type != DMU_OT_DSL_DATASET) + if (doi.doi_type != DMU_OT_DSL_DATASET) { + dmu_buf_rele(dbuf, tag); return (SET_ERROR(EINVAL)); + } ds = dmu_buf_get_user(dbuf); if (ds == NULL) { Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c Fri Jul 5 03:38:06 2013 (r252754) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c Fri Jul 5 03:38:53 2013 (r252755) @@ -183,8 +183,10 @@ process_error_log(spa_t *spa, uint64_t o if (copyout(&zb, (char *)addr + (*count - 1) * sizeof (zbookmark_t), - sizeof (zbookmark_t)) != 0) + sizeof (zbookmark_t)) != 0) { + zap_cursor_fini(&zc); return (SET_ERROR(EFAULT)); + } *count -= 1; } Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c Fri Jul 5 03:38:06 2013 (r252754) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c Fri Jul 5 03:38:53 2013 (r252755) @@ -295,7 +295,8 @@ zap_table_load(zap_t *zap, zap_table_phy err = dmu_buf_hold(zap->zap_objset, zap->zap_object, (tbl->zt_nextblk + blk) << bs, FTAG, &db, DMU_READ_NO_PREFETCH); - dmu_buf_rele(db, FTAG); + if (err == 0) + dmu_buf_rele(db, FTAG); } return (err); } @@ -992,18 +993,21 @@ zap_join(objset_t *os, uint64_t fromobj, zap_attribute_t za; int err; + err = 0; for (zap_cursor_init(&zc, os, fromobj); zap_cursor_retrieve(&zc, &za) == 0; (void) zap_cursor_advance(&zc)) { - if (za.za_integer_length != 8 || za.za_num_integers != 1) - return (SET_ERROR(EINVAL)); + if (za.za_integer_length != 8 || za.za_num_integers != 1) { + err = SET_ERROR(EINVAL); + break; + } err = zap_add(os, intoobj, za.za_name, 8, 1, &za.za_first_integer, tx); if (err) - return (err); + break; } zap_cursor_fini(&zc); - return (0); + return (err); } int @@ -1014,18 +1018,21 @@ zap_join_key(objset_t *os, uint64_t from zap_attribute_t za; int err; + err = 0; for (zap_cursor_init(&zc, os, fromobj); zap_cursor_retrieve(&zc, &za) == 0; (void) zap_cursor_advance(&zc)) { - if (za.za_integer_length != 8 || za.za_num_integers != 1) - return (SET_ERROR(EINVAL)); + if (za.za_integer_length != 8 || za.za_num_integers != 1) { + err = SET_ERROR(EINVAL); + break; + } err = zap_add(os, intoobj, za.za_name, 8, 1, &value, tx); if (err) - return (err); + break; } zap_cursor_fini(&zc); - return (0); + return (err); } int @@ -1036,24 +1043,27 @@ zap_join_increment(objset_t *os, uint64_ zap_attribute_t za; int err; + err = 0; for (zap_cursor_init(&zc, os, fromobj); zap_cursor_retrieve(&zc, &za) == 0; (void) zap_cursor_advance(&zc)) { uint64_t delta = 0; - if (za.za_integer_length != 8 || za.za_num_integers != 1) - return (SET_ERROR(EINVAL)); + if (za.za_integer_length != 8 || za.za_num_integers != 1) { + err = SET_ERROR(EINVAL); + break; + } err = zap_lookup(os, intoobj, za.za_name, 8, 1, &delta); if (err != 0 && err != ENOENT) - return (err); + break; delta += za.za_first_integer; err = zap_update(os, intoobj, za.za_name, 8, 1, &delta, tx); if (err) - return (err); + break; } zap_cursor_fini(&zc); - return (0); + return (err); } int From owner-svn-src-stable-8@FreeBSD.ORG Fri Jul 5 03:44:50 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A2D82D99; Fri, 5 Jul 2013 03:44:50 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 859AA1E78; Fri, 5 Jul 2013 03:44:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r653ioa8067536; Fri, 5 Jul 2013 03:44:50 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r653in9E067531; Fri, 5 Jul 2013 03:44:49 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201307050344.r653in9E067531@svn.freebsd.org> From: Xin LI Date: Fri, 5 Jul 2013 03:44:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252757 - in stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 05 Jul 2013 03:44:50 -0000 Author: delphij Date: Fri Jul 5 03:44:49 2013 New Revision: 252757 URL: http://svnweb.freebsd.org/changeset/base/252757 Log: MFC r251633: illumos #3744 zfs shouldn't ignore errors unmounting snapshots Propagate errors from zfs_unmount_snap() up to its callers wherever feasible. Submitted by: will Reviewed by: Matthew Ahrens , Christopher Siden Sponsored by: Spectra Logic Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c Fri Jul 5 03:44:08 2013 (r252756) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c Fri Jul 5 03:44:49 2013 (r252757) @@ -433,7 +433,7 @@ dsl_dataset_user_release_tmp(dsl_pool_t dsl_dataset_name(ds, name); dsl_dataset_rele(ds, FTAG); dsl_pool_config_exit(dp, FTAG); - zfs_unmount_snap(name); + (void) zfs_unmount_snap(name); } else { dsl_pool_config_exit(dp, FTAG); } Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Fri Jul 5 03:44:08 2013 (r252756) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h Fri Jul 5 03:44:49 2013 (r252757) @@ -360,7 +360,7 @@ extern int zfs_secpolicy_rename_perms(co const char *to, cred_t *cr); extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr); extern int zfs_busy(void); -extern void zfs_unmount_snap(const char *); +extern int zfs_unmount_snap(const char *); extern void zfs_destroy_unmount_origin(const char *); /* Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Jul 5 03:44:08 2013 (r252756) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Jul 5 03:44:49 2013 (r252757) @@ -3405,28 +3405,31 @@ zfs_ioc_log_history(const char *unused, * * This function is best-effort. Callers must deal gracefully if it * remains mounted (or is remounted after this call). + * + * Returns 0 if the argument is not a snapshot, or it is not currently a + * filesystem, or we were able to unmount it. Returns error code otherwise. */ -void +int zfs_unmount_snap(const char *snapname) { vfs_t *vfsp; zfsvfs_t *zfsvfs; + int err; if (strchr(snapname, '@') == NULL) - return; + return (0); vfsp = zfs_get_vfs(snapname); if (vfsp == NULL) - return; + return (0); zfsvfs = vfsp->vfs_data; ASSERT(!dsl_pool_config_held(dmu_objset_pool(zfsvfs->z_os))); - if (vn_vfswlock(vfsp->vfs_vnodecovered) != 0) { - VFS_RELE(vfsp); - return; - } + err = vn_vfswlock(vfsp->vfs_vnodecovered); VFS_RELE(vfsp); + if (err != 0) + return (SET_ERROR(err)); /* * Always force the unmount for snapshots. @@ -3436,17 +3439,17 @@ zfs_unmount_snap(const char *snapname) (void) dounmount(vfsp, MS_FORCE, kcred); #else mtx_lock(&Giant); /* dounmount() */ - dounmount(vfsp, MS_FORCE, curthread); + (void) dounmount(vfsp, MS_FORCE, curthread); mtx_unlock(&Giant); /* dounmount() */ #endif + return (0); } /* ARGSUSED */ static int zfs_unmount_snap_cb(const char *snapname, void *arg) { - zfs_unmount_snap(snapname); - return (0); + return (zfs_unmount_snap(snapname)); } /* @@ -3469,7 +3472,7 @@ zfs_destroy_unmount_origin(const char *f char originname[MAXNAMELEN]; dsl_dataset_name(ds->ds_prev, originname); dmu_objset_rele(os, FTAG); - zfs_unmount_snap(originname); + (void) zfs_unmount_snap(originname); } else { dmu_objset_rele(os, FTAG); } @@ -3487,7 +3490,7 @@ zfs_destroy_unmount_origin(const char *f static int zfs_ioc_destroy_snaps(const char *poolname, nvlist_t *innvl, nvlist_t *outnvl) { - int poollen; + int error, poollen; nvlist_t *snaps; nvpair_t *pair; boolean_t defer; @@ -3508,7 +3511,9 @@ zfs_ioc_destroy_snaps(const char *poolna (name[poollen] != '/' && name[poollen] != '@')) return (SET_ERROR(EXDEV)); - zfs_unmount_snap(name); + error = zfs_unmount_snap(name); + if (error != 0) + return (error); (void) zvol_remove_minor(name); } @@ -3527,8 +3532,12 @@ static int zfs_ioc_destroy(zfs_cmd_t *zc) { int err; - if (strchr(zc->zc_name, '@') && zc->zc_objset_type == DMU_OST_ZFS) - zfs_unmount_snap(zc->zc_name); + + if (zc->zc_objset_type == DMU_OST_ZFS) { + err = zfs_unmount_snap(zc->zc_name); + if (err != 0) + return (err); + } if (strchr(zc->zc_name, '@')) err = dsl_destroy_snapshot(zc->zc_name, zc->zc_defer_destroy); @@ -3574,8 +3583,7 @@ recursive_unmount(const char *fsname, vo char fullname[MAXNAMELEN]; (void) snprintf(fullname, sizeof (fullname), "%s@%s", fsname, snapname); - zfs_unmount_snap(fullname); - return (0); + return (zfs_unmount_snap(fullname)); } /* @@ -5071,14 +5079,18 @@ static int zfs_ioc_release(const char *pool, nvlist_t *holds, nvlist_t *errlist) { nvpair_t *pair; + int err; /* * The release may cause the snapshot to be destroyed; make sure it * is not mounted. */ for (pair = nvlist_next_nvpair(holds, NULL); pair != NULL; - pair = nvlist_next_nvpair(holds, pair)) - zfs_unmount_snap(nvpair_name(pair)); + pair = nvlist_next_nvpair(holds, pair)) { + err = zfs_unmount_snap(nvpair_name(pair)); + if (err != 0) + return (err); + } return (dsl_dataset_user_release(holds, errlist)); } From owner-svn-src-stable-8@FreeBSD.ORG Fri Jul 5 03:50:12 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4BB0C7E; Fri, 5 Jul 2013 03:50:12 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2D95D1E97; Fri, 5 Jul 2013 03:50:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r653oCkw068325; Fri, 5 Jul 2013 03:50:12 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r653oB7P068321; Fri, 5 Jul 2013 03:50:11 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201307050350.r653oB7P068321@svn.freebsd.org> From: Xin LI Date: Fri, 5 Jul 2013 03:50:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252759 - in stable/8/cddl/contrib/opensolaris: cmd/zpool lib/libzfs/common X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 05 Jul 2013 03:50:12 -0000 Author: delphij Date: Fri Jul 5 03:50:11 2013 New Revision: 252759 URL: http://svnweb.freebsd.org/changeset/base/252759 Log: MFC r251634: illumos #3745 zpool create should treat -O mountpoint and -m the same cddl/contrib/opensolaris/cmd/zpool/zpool_main.c: (change 644608) This allows specifying a mountpoint using the latter form and having its value checked and used as it would be using the former form. As a consequence of this change: 1. The mountpoint property is set in the fsprops nvlist prior to creating the pool, rather than being set after creating the pool. To me, this is the proper approach, since it avoids creating the pool if the mountpoint setting would cause the command to fail. 2. The mountpoint property, unlike all others, can be specified more than once. Only the last setting takes effect. This is to avoid breaking potential existing users that specify -m more than once. Submitted by: will cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Fix "zpool create -R -m ". Ever since change 644608, this has been broken. The problem is that some old code in libzfs_pool.c would force a pool's mountpoint to "/" when creating a pool with an altroot. That probably implemented some old policy decision regarding altroots, but it conflicts with the current manpage. It also had no effect until 644608, because the zpool command would _always_ change the pool's mountpoint after creating it. The solution is to delete the old code from libzfs_pool.c. Submitted by: asomers Reviewed by: Matthew Ahrens , Christopher Siden Sponsored by: Spectra Logic Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Fri Jul 5 03:49:52 2013 (r252758) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Fri Jul 5 03:50:11 2013 (r252759) @@ -804,6 +804,7 @@ zpool_do_create(int argc, char **argv) goto errout; break; case 'm': + /* Equivalent to -O mountpoint=optarg */ mountpoint = optarg; break; case 'o': @@ -842,8 +843,18 @@ zpool_do_create(int argc, char **argv) *propval = '\0'; propval++; - if (add_prop_list(optarg, propval, &fsprops, B_FALSE)) + /* + * Mountpoints are checked and then added later. + * Uniquely among properties, they can be specified + * more than once, to avoid conflict with -m. + */ + if (0 == strcmp(optarg, + zfs_prop_to_name(ZFS_PROP_MOUNTPOINT))) { + mountpoint = propval; + } else if (add_prop_list(optarg, propval, &fsprops, + B_FALSE)) { goto errout; + } break; case ':': (void) fprintf(stderr, gettext("missing argument for " @@ -970,6 +981,18 @@ zpool_do_create(int argc, char **argv) } } + /* + * Now that the mountpoint's validity has been checked, ensure that + * the property is set appropriately prior to creating the pool. + */ + if (mountpoint != NULL) { + ret = add_prop_list(zfs_prop_to_name(ZFS_PROP_MOUNTPOINT), + mountpoint, &fsprops, B_FALSE); + if (ret != 0) + goto errout; + } + + ret = 1; if (dryrun) { /* * For a dry run invocation, print out a basic message and run @@ -1004,21 +1027,19 @@ zpool_do_create(int argc, char **argv) if (nvlist_exists(props, propname)) continue; - if (add_prop_list(propname, ZFS_FEATURE_ENABLED, - &props, B_TRUE) != 0) + ret = add_prop_list(propname, + ZFS_FEATURE_ENABLED, &props, B_TRUE); + if (ret != 0) goto errout; } } + + ret = 1; if (zpool_create(g_zfs, poolname, nvroot, props, fsprops) == 0) { zfs_handle_t *pool = zfs_open(g_zfs, poolname, ZFS_TYPE_FILESYSTEM); if (pool != NULL) { - if (mountpoint != NULL) - verify(zfs_prop_set(pool, - zfs_prop_to_name( - ZFS_PROP_MOUNTPOINT), - mountpoint) == 0); if (zfs_mount(pool, NULL, 0) == 0) ret = zfs_shareall(pool); zfs_close(pool); Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Fri Jul 5 03:49:52 2013 (r252758) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Fri Jul 5 03:50:11 2013 (r252759) @@ -1112,7 +1112,6 @@ zpool_create(libzfs_handle_t *hdl, const nvlist_t *zc_fsprops = NULL; nvlist_t *zc_props = NULL; char msg[1024]; - char *altroot; int ret = -1; (void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN, @@ -1211,21 +1210,6 @@ zpool_create(libzfs_handle_t *hdl, const } } - /* - * If this is an alternate root pool, then we automatically set the - * mountpoint of the root dataset to be '/'. - */ - if (nvlist_lookup_string(props, zpool_prop_to_name(ZPOOL_PROP_ALTROOT), - &altroot) == 0) { - zfs_handle_t *zhp; - - verify((zhp = zfs_open(hdl, pool, ZFS_TYPE_DATASET)) != NULL); - verify(zfs_prop_set(zhp, zfs_prop_to_name(ZFS_PROP_MOUNTPOINT), - "/") == 0); - - zfs_close(zhp); - } - create_failed: zcmd_free_nvlists(&zc); nvlist_free(zc_props); From owner-svn-src-stable-8@FreeBSD.ORG Fri Jul 5 03:55:14 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2A24631A; Fri, 5 Jul 2013 03:55:14 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 021561EB9; Fri, 5 Jul 2013 03:55:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r653tDGP070614; Fri, 5 Jul 2013 03:55:13 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r653tDWg070612; Fri, 5 Jul 2013 03:55:13 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201307050355.r653tDWg070612@svn.freebsd.org> From: Xin LI Date: Fri, 5 Jul 2013 03:55:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252761 - in stable/8: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 05 Jul 2013 03:55:14 -0000 Author: delphij Date: Fri Jul 5 03:55:13 2013 New Revision: 252761 URL: http://svnweb.freebsd.org/changeset/base/252761 Log: MFC r251635: illumos #3747 txg commit callbacks don't work sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c: Fix commit callbacks by moving them to the task's list. Previously, list_move_tail() returned without doing anything because the task list was passed as the source rather than destination. cddl/contrib/opensolaris/cmd/ztest/ztest.c: Check the commit callback threshold correctly. Submitted by: will Reviewed by: Matthew Ahrens , Christopher Siden Sponsored by: Spectra Logic Modified: stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c Fri Jul 5 03:54:13 2013 (r252760) +++ stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c Fri Jul 5 03:55:13 2013 (r252761) @@ -4509,7 +4509,7 @@ ztest_dmu_commit_callbacks(ztest_ds_t *z */ tmp_cb = list_head(&zcl.zcl_callbacks); if (tmp_cb != NULL && - tmp_cb->zcd_txg > txg - ZTEST_COMMIT_CALLBACK_THRESH) { + (txg - ZTEST_COMMIT_CALLBACK_THRESH) > tmp_cb->zcd_txg) { fatal(0, "Commit callback threshold exceeded, oldest txg: %" PRIu64 ", open txg: %" PRIu64 "\n", tmp_cb->zcd_txg, txg); } Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Fri Jul 5 03:54:13 2013 (r252760) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Fri Jul 5 03:55:13 2013 (r252761) @@ -370,7 +370,7 @@ txg_dispatch_callbacks(dsl_pool_t *dp, u list_create(cb_list, sizeof (dmu_tx_callback_t), offsetof(dmu_tx_callback_t, dcb_node)); - list_move_tail(&tc->tc_callbacks[g], cb_list); + list_move_tail(cb_list, &tc->tc_callbacks[g]); (void) taskq_dispatch(tx->tx_commit_cb_taskq, (task_func_t *) txg_do_callbacks, cb_list, TQ_SLEEP); From owner-svn-src-stable-8@FreeBSD.ORG Fri Jul 5 04:02:16 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5E52B5B5; Fri, 5 Jul 2013 04:02:16 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4F1E71EEC; Fri, 5 Jul 2013 04:02:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6542GtH073384; Fri, 5 Jul 2013 04:02:16 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6542FrE073379; Fri, 5 Jul 2013 04:02:15 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201307050402.r6542FrE073379@svn.freebsd.org> From: Xin LI Date: Fri, 5 Jul 2013 04:02:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252763 - in stable/8/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fm/fs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 05 Jul 2013 04:02:16 -0000 Author: delphij Date: Fri Jul 5 04:02:15 2013 New Revision: 252763 URL: http://svnweb.freebsd.org/changeset/base/252763 Log: MFC r251636: illumos #3749 zfs event processing should work on R/O root filesystems This log is a modified version of the original one written by gibbs@, to account for changes made during the illumos RTI process. Allow ZFS asynchronous event handling to proceed even if the root file system is mounted read-only. This restriction appears to have been put in place to avoid errors with updating the configuration cache file. However: o The majority of asynchronous event handling does not involve configuration cache file updates. o The configuration cache file need not be on the root file system, so the check was not complete. o Other classes of errors (e.g. file system full) can also prevent a successful update yet do not prevent asynchronous event processing. o Configurations such as NanoBSD never have a read-write root, so ZFS event processing is permanently disabled in these systems. o Failure to handle asynchronous events promptly can extend the window of time that a pool is in a critical state. At worst, a missed configuration cache update will force the operator to perform a manual "zfs import" (note -f is not required) to inform the system about a newly created pool. To minimize the likelihood of this rare occurrence, configuration cache write failures now emit FMA events (via devctl) so the operator can take corrective action, and the write is retried every 5 minutes. The retry interval, in seconds, is tunable via the sysctl "vfs.zfs.ccw_retry_interval". As a side effect of reporting configuration cache events, other sysevents, such as re-silver start/stop, are now also reported via devctl. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c: o As is done in zfs_fm.c, provide a manual declaration for devctl_notify(). Both declarations could be combined into spa_impl.h, but the declaration is fault management related, not spa specific. sys/fm/fs/zfs.h would be ideal if it weren't so public and reserved for FMA string definitions. I'm open to suggestions on how to improve this nit while minimizing our divergence from Solaris. o Use devctl_notify() to implement sysevent support in spa_event_notify(). The subsystem is EC_ZFS so that these events can never collide with those emitted in zfs_fm.c. o Add the sysctl "vfs.zfs.ccw_retry_interval". The value defaults to 5 minutes and is used to rate limit, on a per-pool basis, configuration cache file write attempts. o Modify spa_async_dispatch to honor configuration cache write limiting. If other events are pending, a configuration cache write will be attempted at the same time, so the rate limiting only applies when the asynchronous dispatch system is otherwise idle. Async events should be rare (e.g. device arrival/departure) and configuration cache writes rarer, so a more complicated system to strictly honor the retry limit seems unwarranted. o Remove check in spa_async_dispatch() for the root file system being read-write. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c: Instead of silently ignoring configuration cache write failures, report them via a new FMA event as well as to the console. The current zfs_ereport_post() doesn't allow arbitrary name=value pairs to be appended to the report, so the configuration cache file name is only available on the console output. This limitation should be addressed in a future update. Note: This error report is only posted once per incident, to avoid spamming. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h: Add a hrtime_t to the spa data structure to track the time (via gethrtime()) of the last configuration cache file write failure. This is referenced in spa_async_dispatch() to effect the rate limiting. sys/cddl/contrib/opensolaris/uts/common/sys/fm/fs/zfs.h: Add FM_EREPORT_ZFS_CONFIG_CACHE_WRITE as an ereport class. Submitted by: gibbs Reviewed by: Matthew Ahrens , Eric Schrock , Christopher Siden Sponsored by: Spectra Logic Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/fm/fs/zfs.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Jul 5 04:01:25 2013 (r252762) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Jul 5 04:02:15 2013 (r252763) @@ -88,6 +88,12 @@ TUNABLE_INT("vfs.zfs.check_hostid", &che SYSCTL_INT(_vfs_zfs, OID_AUTO, check_hostid, CTLFLAG_RW, &check_hostid, 0, "Check hostid on import?"); +/* + * The interval, in seconds, at which failed configuration cache file writes + * should be retried. + */ +static int zfs_ccw_retry_interval = 300; + typedef enum zti_modes { zti_mode_fixed, /* value is # of threads (min 1) */ zti_mode_online_percent, /* value is % of online CPUs */ @@ -5852,13 +5858,34 @@ spa_async_resume(spa_t *spa) mutex_exit(&spa->spa_async_lock); } +static boolean_t +spa_async_tasks_pending(spa_t *spa) +{ + uint_t non_config_tasks; + uint_t config_task; + boolean_t config_task_suspended; + + non_config_tasks = spa->spa_async_tasks & ~SPA_ASYNC_CONFIG_UPDATE; + config_task = spa->spa_async_tasks & SPA_ASYNC_CONFIG_UPDATE; + if (spa->spa_ccw_fail_time == 0) { + config_task_suspended = B_FALSE; + } else { + config_task_suspended = + (gethrtime() - spa->spa_ccw_fail_time) < + (zfs_ccw_retry_interval * NANOSEC); + } + + return (non_config_tasks || (config_task && !config_task_suspended)); +} + static void spa_async_dispatch(spa_t *spa) { mutex_enter(&spa->spa_async_lock); - if (spa->spa_async_tasks && !spa->spa_async_suspended && + if (spa_async_tasks_pending(spa) && + !spa->spa_async_suspended && spa->spa_async_thread == NULL && - rootdir != NULL && !vn_is_readonly(rootdir)) + rootdir != NULL) spa->spa_async_thread = thread_create(NULL, 0, spa_async_thread, spa, 0, &p0, TS_RUN, maxclsyspri); mutex_exit(&spa->spa_async_lock); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Fri Jul 5 04:01:25 2013 (r252762) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Fri Jul 5 04:02:15 2013 (r252763) @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -139,7 +140,7 @@ out: kobj_close_file(file); } -static void +static int spa_config_write(spa_config_dirent_t *dp, nvlist_t *nvl) { size_t buflen; @@ -147,13 +148,14 @@ spa_config_write(spa_config_dirent_t *dp vnode_t *vp; int oflags = FWRITE | FTRUNC | FCREAT | FOFFMAX; char *temp; + int err; /* * If the nvlist is empty (NULL), then remove the old cachefile. */ if (nvl == NULL) { - (void) vn_remove(dp->scd_path, UIO_SYSSPACE, RMFILE); - return; + err = vn_remove(dp->scd_path, UIO_SYSSPACE, RMFILE); + return (err); } /* @@ -174,12 +176,14 @@ spa_config_write(spa_config_dirent_t *dp */ (void) snprintf(temp, MAXPATHLEN, "%s.tmp", dp->scd_path); - if (vn_open(temp, UIO_SYSSPACE, oflags, 0644, &vp, CRCREAT, 0) == 0) { - if (vn_rdwr(UIO_WRITE, vp, buf, buflen, 0, UIO_SYSSPACE, - 0, RLIM64_INFINITY, kcred, NULL) == 0 && - VOP_FSYNC(vp, FSYNC, kcred, NULL) == 0) { - (void) vn_rename(temp, dp->scd_path, UIO_SYSSPACE); - } + err = vn_open(temp, UIO_SYSSPACE, oflags, 0644, &vp, CRCREAT, 0); + if (err == 0) { + err = vn_rdwr(UIO_WRITE, vp, buf, buflen, 0, UIO_SYSSPACE, + 0, RLIM64_INFINITY, kcred, NULL); + if (err == 0) + err = VOP_FSYNC(vp, FSYNC, kcred, NULL); + if (err == 0) + err = vn_rename(temp, dp->scd_path, UIO_SYSSPACE); (void) VOP_CLOSE(vp, oflags, 1, 0, kcred, NULL); } @@ -187,6 +191,7 @@ spa_config_write(spa_config_dirent_t *dp kmem_free(buf, buflen); kmem_free(temp, MAXPATHLEN); + return (err); } /* @@ -198,6 +203,8 @@ spa_config_sync(spa_t *target, boolean_t { spa_config_dirent_t *dp, *tdp; nvlist_t *nvl; + boolean_t ccw_failure; + int error; ASSERT(MUTEX_HELD(&spa_namespace_lock)); @@ -209,6 +216,7 @@ spa_config_sync(spa_t *target, boolean_t * cachefile is changed, the new one is pushed onto this list, allowing * us to update previous cachefiles that no longer contain this pool. */ + ccw_failure = B_FALSE; for (dp = list_head(&target->spa_config_list); dp != NULL; dp = list_next(&target->spa_config_list, dp)) { spa_t *spa = NULL; @@ -241,10 +249,32 @@ spa_config_sync(spa_t *target, boolean_t mutex_exit(&spa->spa_props_lock); } - spa_config_write(dp, nvl); + error = spa_config_write(dp, nvl); + if (error != 0) + ccw_failure = B_TRUE; nvlist_free(nvl); } + if (ccw_failure) { + /* + * Keep trying so that configuration data is + * written if/when any temporary filesystem + * resource issues are resolved. + */ + if (target->spa_ccw_fail_time == 0) { + zfs_ereport_post(FM_EREPORT_ZFS_CONFIG_CACHE_WRITE, + target, NULL, NULL, 0, 0); + } + target->spa_ccw_fail_time = gethrtime(); + spa_async_request(target, SPA_ASYNC_CONFIG_UPDATE); + } else { + /* + * Do not rate limit future attempts to update + * the config cache. + */ + target->spa_ccw_fail_time = 0; + } + /* * Remove any config entries older than the current one. */ Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Fri Jul 5 04:01:25 2013 (r252762) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Fri Jul 5 04:02:15 2013 (r252763) @@ -241,6 +241,7 @@ struct spa { uint64_t spa_deadman_calls; /* number of deadman calls */ uint64_t spa_sync_starttime; /* starting time fo spa_sync */ uint64_t spa_deadman_synctime; /* deadman expiration timer */ + hrtime_t spa_ccw_fail_time; /* Conf cache write fail time */ /* * spa_refcount & spa_config_lock must be the last elements * because refcount_t changes size based on compilation options. Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/fm/fs/zfs.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/fm/fs/zfs.h Fri Jul 5 04:01:25 2013 (r252762) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/fm/fs/zfs.h Fri Jul 5 04:02:15 2013 (r252763) @@ -46,6 +46,7 @@ extern "C" { #define FM_EREPORT_ZFS_IO_FAILURE "io_failure" #define FM_EREPORT_ZFS_PROBE_FAILURE "probe_failure" #define FM_EREPORT_ZFS_LOG_REPLAY "log_replay" +#define FM_EREPORT_ZFS_CONFIG_CACHE_WRITE "config_cache_write" #define FM_EREPORT_PAYLOAD_ZFS_POOL "pool" #define FM_EREPORT_PAYLOAD_ZFS_POOL_FAILMODE "pool_failmode" From owner-svn-src-stable-8@FreeBSD.ORG Fri Jul 5 04:11:37 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5F105890; Fri, 5 Jul 2013 04:11:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4F3301F36; Fri, 5 Jul 2013 04:11:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r654Bb2f076747; Fri, 5 Jul 2013 04:11:37 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r654BZID076733; Fri, 5 Jul 2013 04:11:35 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201307050411.r654BZID076733@svn.freebsd.org> From: Xin LI Date: Fri, 5 Jul 2013 04:11:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252765 - in stable/8: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/ope... X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 05 Jul 2013 04:11:37 -0000 Author: delphij Date: Fri Jul 5 04:11:34 2013 New Revision: 252765 URL: http://svnweb.freebsd.org/changeset/base/252765 Log: MFC r251646 + r252219: MFV r251644: Poor ZFS send / receive performance due to snapshot hold / release processing (by smh@) Illumos ZFS issues: 3740 Poor ZFS send / receive performance due to snapshot hold / release processing MFV r252215: Restore a previous behavior before r251646, where when destructing ZFS snapshot, the ioctl would return ENOENT when it hit any of them in the errlist (the new behavior was only return ENOENT when all returns error). Illumos ZFS issues: 3829 fix for 3740 changed behavior of zfs destroy/hold/release ioctl Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/8/cddl/contrib/opensolaris/cmd/zhack/zhack.c stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/8/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_userhold.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/cddl/contrib/opensolaris/cmd/zfs/ (props changed) stable/8/cddl/contrib/opensolaris/lib/libzfs/ (props changed) stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Fri Jul 5 04:08:45 2013 (r252764) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Fri Jul 5 04:11:34 2013 (r252765) @@ -28,6 +28,7 @@ * Copyright (c) 2011-2012 Pawel Jakub Dawidek . * All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. + * Copyright (c) 2013 Steven Hartland. All rights reserved. */ #include @@ -5222,8 +5223,7 @@ zfs_do_hold_rele_impl(int argc, char **a continue; } if (holding) { - if (zfs_hold(zhp, delim+1, tag, recursive, - B_FALSE, -1) != 0) + if (zfs_hold(zhp, delim+1, tag, recursive, -1) != 0) ++errors; } else { if (zfs_release(zhp, delim+1, tag, recursive) != 0) Modified: stable/8/cddl/contrib/opensolaris/cmd/zhack/zhack.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zhack/zhack.c Fri Jul 5 04:08:45 2013 (r252764) +++ stable/8/cddl/contrib/opensolaris/cmd/zhack/zhack.c Fri Jul 5 04:11:34 2013 (r252765) @@ -21,6 +21,7 @@ /* * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 Steven Hartland. All rights reserved. */ /* @@ -153,7 +154,7 @@ import_pool(const char *target, boolean_ g_importargs.poolname = g_pool; pools = zpool_search_import(g_zfs, &g_importargs); - if (pools == NULL || nvlist_next_nvpair(pools, NULL) == NULL) { + if (nvlist_empty(pools)) { if (!g_importargs.can_be_active) { g_importargs.can_be_active = B_TRUE; if (zpool_search_import(g_zfs, &g_importargs) != NULL || Modified: stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c Fri Jul 5 04:08:45 2013 (r252764) +++ stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c Fri Jul 5 04:11:34 2013 (r252765) @@ -23,6 +23,7 @@ * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. + * Copyright (c) 2013 Steven Hartland. All rights reserved. */ /* @@ -4713,7 +4714,7 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, error = user_release_one(fullname, tag); if (error) - fatal(0, "user_release_one(%s)", fullname, tag); + fatal(0, "user_release_one(%s, %s) = %d", fullname, tag, error); VERIFY3U(dmu_objset_hold(fullname, FTAG, &origin), ==, ENOENT); Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Fri Jul 5 04:08:45 2013 (r252764) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Fri Jul 5 04:11:34 2013 (r252765) @@ -27,6 +27,7 @@ * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. + * Copyright (c) 2013 Steven Hartland. All rights reserved. */ #ifndef _LIBZFS_H @@ -611,7 +612,8 @@ extern int zfs_send(zfs_handle_t *, cons extern int zfs_promote(zfs_handle_t *); extern int zfs_hold(zfs_handle_t *, const char *, const char *, - boolean_t, boolean_t, int); + boolean_t, int); +extern int zfs_hold_nvl(zfs_handle_t *, int, nvlist_t *); extern int zfs_release(zfs_handle_t *, const char *, const char *, boolean_t); extern int zfs_get_holds(zfs_handle_t *, nvlist_t **); extern uint64_t zvol_volsize_to_reservation(uint64_t, nvlist_t *); Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Fri Jul 5 04:08:45 2013 (r252764) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Fri Jul 5 04:11:34 2013 (r252765) @@ -21,12 +21,13 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved. + * Copyright 2012 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011-2012 Pawel Jakub Dawidek . * All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. + * Copyright (c) 2013 Steven Hartland. All rights reserved. */ #include @@ -3158,18 +3159,14 @@ static int zfs_check_snap_cb(zfs_handle_t *zhp, void *arg) { struct destroydata *dd = arg; - zfs_handle_t *szhp; char name[ZFS_MAXNAMELEN]; int rv = 0; (void) snprintf(name, sizeof (name), "%s@%s", zhp->zfs_name, dd->snapname); - szhp = make_dataset_handle(zhp->zfs_hdl, name); - if (szhp) { + if (lzc_exists(name)) verify(nvlist_add_boolean(dd->nvl, name) == 0); - zfs_close(szhp); - } rv = zfs_iter_filesystems(zhp, zfs_check_snap_cb, dd); zfs_close(zhp); @@ -3189,7 +3186,7 @@ zfs_destroy_snaps(zfs_handle_t *zhp, cha verify(nvlist_alloc(&dd.nvl, NV_UNIQUE_NAME, 0) == 0); (void) zfs_check_snap_cb(zfs_handle_dup(zhp), &dd); - if (nvlist_next_nvpair(dd.nvl, NULL) == NULL) { + if (nvlist_empty(dd.nvl)) { ret = zfs_standard_error_fmt(zhp->zfs_hdl, ENOENT, dgettext(TEXT_DOMAIN, "cannot destroy '%s@%s'"), zhp->zfs_name, snapname); @@ -3214,7 +3211,7 @@ zfs_destroy_snaps_nvl(libzfs_handle_t *h if (ret == 0) return (0); - if (nvlist_next_nvpair(errlist, NULL) == NULL) { + if (nvlist_empty(errlist)) { char errbuf[1024]; (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot destroy snapshots")); @@ -4162,24 +4159,21 @@ struct holdarg { const char *snapname; const char *tag; boolean_t recursive; + int error; }; static int zfs_hold_one(zfs_handle_t *zhp, void *arg) { struct holdarg *ha = arg; - zfs_handle_t *szhp; char name[ZFS_MAXNAMELEN]; int rv = 0; (void) snprintf(name, sizeof (name), "%s@%s", zhp->zfs_name, ha->snapname); - szhp = make_dataset_handle(zhp->zfs_hdl, name); - if (szhp) { + if (lzc_exists(name)) fnvlist_add_string(ha->nvl, name, ha->tag); - zfs_close(szhp); - } if (ha->recursive) rv = zfs_iter_filesystems(zhp, zfs_hold_one, ha); @@ -4189,14 +4183,10 @@ zfs_hold_one(zfs_handle_t *zhp, void *ar int zfs_hold(zfs_handle_t *zhp, const char *snapname, const char *tag, - boolean_t recursive, boolean_t enoent_ok, int cleanup_fd) + boolean_t recursive, int cleanup_fd) { int ret; struct holdarg ha; - nvlist_t *errors; - libzfs_handle_t *hdl = zhp->zfs_hdl; - char errbuf[1024]; - nvpair_t *elem; ha.nvl = fnvlist_alloc(); ha.snapname = snapname; @@ -4204,26 +4194,44 @@ zfs_hold(zfs_handle_t *zhp, const char * ha.recursive = recursive; (void) zfs_hold_one(zfs_handle_dup(zhp), &ha); - if (nvlist_next_nvpair(ha.nvl, NULL) == NULL) { + if (nvlist_empty(ha.nvl)) { + char errbuf[1024]; + fnvlist_free(ha.nvl); ret = ENOENT; - if (!enoent_ok) { - (void) snprintf(errbuf, sizeof (errbuf), - dgettext(TEXT_DOMAIN, - "cannot hold snapshot '%s@%s'"), - zhp->zfs_name, snapname); - (void) zfs_standard_error(hdl, ret, errbuf); - } + (void) snprintf(errbuf, sizeof (errbuf), + dgettext(TEXT_DOMAIN, + "cannot hold snapshot '%s@%s'"), + zhp->zfs_name, snapname); + (void) zfs_standard_error(zhp->zfs_hdl, ret, errbuf); return (ret); } - ret = lzc_hold(ha.nvl, cleanup_fd, &errors); + ret = zfs_hold_nvl(zhp, cleanup_fd, ha.nvl); fnvlist_free(ha.nvl); - if (ret == 0) + return (ret); +} + +int +zfs_hold_nvl(zfs_handle_t *zhp, int cleanup_fd, nvlist_t *holds) +{ + int ret; + nvlist_t *errors; + libzfs_handle_t *hdl = zhp->zfs_hdl; + char errbuf[1024]; + nvpair_t *elem; + + errors = NULL; + ret = lzc_hold(holds, cleanup_fd, &errors); + + if (ret == 0) { + /* There may be errors even in the success case. */ + fnvlist_free(errors); return (0); + } - if (nvlist_next_nvpair(errors, NULL) == NULL) { + if (nvlist_empty(errors)) { /* no hold-specific errors */ (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot hold")); @@ -4263,10 +4271,6 @@ zfs_hold(zfs_handle_t *zhp, const char * case EEXIST: (void) zfs_error(hdl, EZFS_REFTAG_HOLD, errbuf); break; - case ENOENT: - if (enoent_ok) - return (ENOENT); - /* FALLTHROUGH */ default: (void) zfs_standard_error(hdl, fnvpair_value_int32(elem), errbuf); @@ -4277,30 +4281,26 @@ zfs_hold(zfs_handle_t *zhp, const char * return (ret); } -struct releasearg { - nvlist_t *nvl; - const char *snapname; - const char *tag; - boolean_t recursive; -}; - static int zfs_release_one(zfs_handle_t *zhp, void *arg) { struct holdarg *ha = arg; - zfs_handle_t *szhp; char name[ZFS_MAXNAMELEN]; int rv = 0; + nvlist_t *existing_holds; (void) snprintf(name, sizeof (name), "%s@%s", zhp->zfs_name, ha->snapname); - szhp = make_dataset_handle(zhp->zfs_hdl, name); - if (szhp) { - nvlist_t *holds = fnvlist_alloc(); - fnvlist_add_boolean(holds, ha->tag); - fnvlist_add_nvlist(ha->nvl, name, holds); - zfs_close(szhp); + if (lzc_get_holds(name, &existing_holds) != 0) { + ha->error = ENOENT; + } else if (!nvlist_exists(existing_holds, ha->tag)) { + ha->error = ESRCH; + } else { + nvlist_t *torelease = fnvlist_alloc(); + fnvlist_add_boolean(torelease, ha->tag); + fnvlist_add_nvlist(ha->nvl, name, torelease); + fnvlist_free(torelease); } if (ha->recursive) @@ -4315,7 +4315,7 @@ zfs_release(zfs_handle_t *zhp, const cha { int ret; struct holdarg ha; - nvlist_t *errors; + nvlist_t *errors = NULL; nvpair_t *elem; libzfs_handle_t *hdl = zhp->zfs_hdl; char errbuf[1024]; @@ -4324,26 +4324,34 @@ zfs_release(zfs_handle_t *zhp, const cha ha.snapname = snapname; ha.tag = tag; ha.recursive = recursive; + ha.error = 0; (void) zfs_release_one(zfs_handle_dup(zhp), &ha); - if (nvlist_next_nvpair(ha.nvl, NULL) == NULL) { + if (nvlist_empty(ha.nvl)) { fnvlist_free(ha.nvl); - ret = ENOENT; + ret = ha.error; (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot release hold from snapshot '%s@%s'"), zhp->zfs_name, snapname); - (void) zfs_standard_error(hdl, ret, errbuf); + if (ret == ESRCH) { + (void) zfs_error(hdl, EZFS_REFTAG_RELE, errbuf); + } else { + (void) zfs_standard_error(hdl, ret, errbuf); + } return (ret); } ret = lzc_release(ha.nvl, &errors); fnvlist_free(ha.nvl); - if (ret == 0) + if (ret == 0) { + /* There may be errors even in the success case. */ + fnvlist_free(errors); return (0); + } - if (nvlist_next_nvpair(errors, NULL) == NULL) { + if (nvlist_empty(errors)) { /* no hold-specific errors */ (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot release")); Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Fri Jul 5 04:08:45 2013 (r252764) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Fri Jul 5 04:11:34 2013 (r252765) @@ -25,6 +25,7 @@ * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2012 Pawel Jakub Dawidek . * All rights reserved. + * Copyright (c) 2013 Steven Hartland. All rights reserved. */ #include @@ -802,6 +803,7 @@ typedef struct send_dump_data { int outfd; boolean_t err; nvlist_t *fss; + nvlist_t *snapholds; avl_tree_t *fsavl; snapfilter_cb_t *filter_cb; void *filter_cb_arg; @@ -952,41 +954,19 @@ dump_ioctl(zfs_handle_t *zhp, const char return (0); } -static int -hold_for_send(zfs_handle_t *zhp, send_dump_data_t *sdd) +static void +gather_holds(zfs_handle_t *zhp, send_dump_data_t *sdd) { - zfs_handle_t *pzhp; - int error = 0; - char *thissnap; - assert(zhp->zfs_type == ZFS_TYPE_SNAPSHOT); - if (sdd->dryrun) - return (0); - /* - * zfs_send() only opens a cleanup_fd for sends that need it, + * zfs_send() only sets snapholds for sends that need them, * e.g. replication and doall. */ - if (sdd->cleanup_fd == -1) - return (0); - - thissnap = strchr(zhp->zfs_name, '@') + 1; - *(thissnap - 1) = '\0'; - pzhp = zfs_open(zhp->zfs_hdl, zhp->zfs_name, ZFS_TYPE_DATASET); - *(thissnap - 1) = '@'; - - /* - * It's OK if the parent no longer exists. The send code will - * handle that error. - */ - if (pzhp) { - error = zfs_hold(pzhp, thissnap, sdd->holdtag, - B_FALSE, B_TRUE, sdd->cleanup_fd); - zfs_close(pzhp); - } + if (sdd->snapholds == NULL) + return; - return (error); + fnvlist_add_string(sdd->snapholds, zhp->zfs_name, sdd->holdtag); } static void * @@ -1042,28 +1022,23 @@ dump_snapshot(zfs_handle_t *zhp, void *a send_dump_data_t *sdd = arg; progress_arg_t pa = { 0 }; pthread_t tid; - char *thissnap; int err; boolean_t isfromsnap, istosnap, fromorigin; boolean_t exclude = B_FALSE; + err = 0; thissnap = strchr(zhp->zfs_name, '@') + 1; isfromsnap = (sdd->fromsnap != NULL && strcmp(sdd->fromsnap, thissnap) == 0); if (!sdd->seenfrom && isfromsnap) { - err = hold_for_send(zhp, sdd); - if (err == 0) { - sdd->seenfrom = B_TRUE; - (void) strcpy(sdd->prevsnap, thissnap); - sdd->prevsnap_obj = zfs_prop_get_int(zhp, - ZFS_PROP_OBJSETID); - } else if (err == ENOENT) { - err = 0; - } + gather_holds(zhp, sdd); + sdd->seenfrom = B_TRUE; + (void) strcpy(sdd->prevsnap, thissnap); + sdd->prevsnap_obj = zfs_prop_get_int(zhp, ZFS_PROP_OBJSETID); zfs_close(zhp); - return (err); + return (0); } if (sdd->seento || !sdd->seenfrom) { @@ -1114,14 +1089,7 @@ dump_snapshot(zfs_handle_t *zhp, void *a return (0); } - err = hold_for_send(zhp, sdd); - if (err) { - if (err == ENOENT) - err = 0; - zfs_close(zhp); - return (err); - } - + gather_holds(zhp, sdd); fromorigin = sdd->prevsnap[0] == '\0' && (sdd->fromorigin || sdd->replicate); @@ -1389,7 +1357,7 @@ zfs_send(zfs_handle_t *zhp, const char * avl_tree_t *fsavl = NULL; static uint64_t holdseq; int spa_version; - pthread_t tid; + pthread_t tid = 0; int pipefd[2]; dedup_arg_t dda = { 0 }; int featureflags = 0; @@ -1462,11 +1430,8 @@ zfs_send(zfs_handle_t *zhp, const char * *debugnvp = hdrnv; else nvlist_free(hdrnv); - if (err) { - fsavl_destroy(fsavl); - nvlist_free(fss); + if (err) goto stderr_out; - } } if (!flags->dryrun) { @@ -1490,8 +1455,6 @@ zfs_send(zfs_handle_t *zhp, const char * } free(packbuf); if (err == -1) { - fsavl_destroy(fsavl); - nvlist_free(fss); err = errno; goto stderr_out; } @@ -1502,8 +1465,6 @@ zfs_send(zfs_handle_t *zhp, const char * drr.drr_u.drr_end.drr_checksum = zc; err = write(outfd, &drr, sizeof (drr)); if (err == -1) { - fsavl_destroy(fsavl); - nvlist_free(fss); err = errno; goto stderr_out; } @@ -1515,7 +1476,7 @@ zfs_send(zfs_handle_t *zhp, const char * /* dump each stream */ sdd.fromsnap = fromsnap; sdd.tosnap = tosnap; - if (flags->dedup) + if (tid != 0) sdd.outfd = pipefd[0]; else sdd.outfd = outfd; @@ -1552,36 +1513,71 @@ zfs_send(zfs_handle_t *zhp, const char * err = errno; goto stderr_out; } + sdd.snapholds = fnvlist_alloc(); } else { sdd.cleanup_fd = -1; + sdd.snapholds = NULL; } - if (flags->verbose) { + if (flags->verbose || sdd.snapholds != NULL) { /* * Do a verbose no-op dry run to get all the verbose output - * before generating any data. Then do a non-verbose real - * run to generate the streams. + * or to gather snapshot hold's before generating any data, + * then do a non-verbose real run to generate the streams. */ sdd.dryrun = B_TRUE; err = dump_filesystems(zhp, &sdd); - sdd.dryrun = flags->dryrun; - sdd.verbose = B_FALSE; - if (flags->parsable) { - (void) fprintf(stderr, "size\t%llu\n", - (longlong_t)sdd.size); - } else { - char buf[16]; - zfs_nicenum(sdd.size, buf, sizeof (buf)); - (void) fprintf(stderr, dgettext(TEXT_DOMAIN, - "total estimated size is %s\n"), buf); + + if (err != 0) + goto stderr_out; + + if (flags->verbose) { + if (flags->parsable) { + (void) fprintf(stderr, "size\t%llu\n", + (longlong_t)sdd.size); + } else { + char buf[16]; + zfs_nicenum(sdd.size, buf, sizeof (buf)); + (void) fprintf(stderr, dgettext(TEXT_DOMAIN, + "total estimated size is %s\n"), buf); + } + } + + /* Ensure no snaps found is treated as an error. */ + if (!sdd.seento) { + err = ENOENT; + goto err_out; } + + /* Skip the second run if dryrun was requested. */ + if (flags->dryrun) + goto err_out; + + if (sdd.snapholds != NULL) { + err = zfs_hold_nvl(zhp, sdd.cleanup_fd, sdd.snapholds); + if (err != 0) + goto stderr_out; + + fnvlist_free(sdd.snapholds); + sdd.snapholds = NULL; + } + + sdd.dryrun = B_FALSE; + sdd.verbose = B_FALSE; } + err = dump_filesystems(zhp, &sdd); fsavl_destroy(fsavl); nvlist_free(fss); - if (flags->dedup) { - (void) close(pipefd[0]); + /* Ensure no snaps found is treated as an error. */ + if (err == 0 && !sdd.seento) + err = ENOENT; + + if (tid != 0) { + if (err != 0) + (void) pthread_cancel(tid); (void) pthread_join(tid, NULL); + (void) close(pipefd[0]); } if (sdd.cleanup_fd != -1) { @@ -1609,9 +1605,13 @@ zfs_send(zfs_handle_t *zhp, const char * stderr_out: err = zfs_standard_error(zhp->zfs_hdl, err, errbuf); err_out: + fsavl_destroy(fsavl); + nvlist_free(fss); + fnvlist_free(sdd.snapholds); + if (sdd.cleanup_fd != -1) VERIFY(0 == close(sdd.cleanup_fd)); - if (flags->dedup) { + if (tid != 0) { (void) pthread_cancel(tid); (void) pthread_join(tid, NULL); (void) close(pipefd[0]); Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Fri Jul 5 04:08:45 2013 (r252764) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Fri Jul 5 04:11:34 2013 (r252765) @@ -21,6 +21,7 @@ /* * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 Steven Hartland. All rights reserved. */ /* @@ -333,7 +334,6 @@ lzc_destroy_snaps(nvlist_t *snaps, boole nvlist_free(args); return (error); - } int @@ -393,11 +393,17 @@ lzc_exists(const char *dataset) * uncleanly, the holds will be released when the pool is next opened * or imported. * - * The return value will be 0 if all holds were created. Otherwise the return - * value will be the errno of a (unspecified) hold that failed, no holds will - * be created, and the errlist will have an entry for each hold that - * failed (name = snapshot). The value in the errlist will be the error - * code (int32). + * Holds for snapshots which don't exist will be skipped and have an entry + * added to errlist, but will not cause an overall failure. + * + * The return value will be 0 if all holds, for snapshots that existed, + * were succesfully created. + * + * Otherwise the return value will be the errno of a (unspecified) hold that + * failed and no holds will be created. + * + * In all cases the errlist will have an entry for each hold that failed + * (name = snapshot), with its value being the error code (int32). */ int lzc_hold(nvlist_t *holds, int cleanup_fd, nvlist_t **errlist) @@ -434,11 +440,17 @@ lzc_hold(nvlist_t *holds, int cleanup_fd * The snapshots must all be in the same pool. * The value is a nvlist whose keys are the holds to remove. * - * The return value will be 0 if all holds were removed. - * Otherwise the return value will be the errno of a (unspecified) release - * that failed, no holds will be released, and the errlist will have an - * entry for each snapshot that has failed releases (name = snapshot). - * The value in the errlist will be the error code (int32) of a failed release. + * Holds which failed to release because they didn't exist will have an entry + * added to errlist, but will not cause an overall failure. + * + * The return value will be 0 if the nvl holds was empty or all holds that + * existed, were successfully removed. + * + * Otherwise the return value will be the errno of a (unspecified) hold that + * failed to release and no holds will be released. + * + * In all cases the errlist will have an entry for each hold that failed to + * to release. */ int lzc_release(nvlist_t *holds, nvlist_t **errlist) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Fri Jul 5 04:08:45 2013 (r252764) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Fri Jul 5 04:11:34 2013 (r252765) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 Steven Hartland. All rights reserved. */ #include @@ -127,6 +128,7 @@ dsl_destroy_snapshot_check(void *arg, dm pair = nvlist_next_nvpair(dsda->dsda_errlist, NULL); if (pair != NULL) return (fnvpair_value_int32(pair)); + return (0); } Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Fri Jul 5 04:08:45 2013 (r252764) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Fri Jul 5 04:11:34 2013 (r252765) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 Steven Hartland. All rights reserved. */ #include @@ -856,23 +857,34 @@ dsl_pool_clean_tmp_userrefs(dsl_pool_t * zap_cursor_t zc; objset_t *mos = dp->dp_meta_objset; uint64_t zapobj = dp->dp_tmp_userrefs_obj; + nvlist_t *holds; if (zapobj == 0) return; ASSERT(spa_version(dp->dp_spa) >= SPA_VERSION_USERREFS); + holds = fnvlist_alloc(); + for (zap_cursor_init(&zc, mos, zapobj); zap_cursor_retrieve(&zc, &za) == 0; zap_cursor_advance(&zc)) { char *htag; - uint64_t dsobj; + nvlist_t *tags; htag = strchr(za.za_name, '-'); *htag = '\0'; ++htag; - dsobj = strtonum(za.za_name, NULL); - dsl_dataset_user_release_tmp(dp, dsobj, htag); + if (nvlist_lookup_nvlist(holds, za.za_name, &tags) != 0) { + tags = fnvlist_alloc(); + fnvlist_add_boolean(tags, htag); + fnvlist_add_nvlist(holds, za.za_name, tags); + fnvlist_free(tags); + } else { + fnvlist_add_boolean(tags, htag); + } } + dsl_dataset_user_release_tmp(dp, holds); + fnvlist_free(holds); zap_cursor_fini(&zc); } Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c Fri Jul 5 04:08:45 2013 (r252764) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c Fri Jul 5 04:11:34 2013 (r252765) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 Steven Hartland. All rights reserved. */ #include @@ -37,6 +38,7 @@ typedef struct dsl_dataset_user_hold_arg { nvlist_t *dduha_holds; + nvlist_t *dduha_chkholds; nvlist_t *dduha_errlist; minor_t dduha_minor; } dsl_dataset_user_hold_arg_t; @@ -53,25 +55,24 @@ dsl_dataset_user_hold_check_one(dsl_data objset_t *mos = dp->dp_meta_objset; int error = 0; + ASSERT(dsl_pool_config_held(dp)); + if (strlen(htag) > MAXNAMELEN) - return (E2BIG); + return (SET_ERROR(E2BIG)); /* Tempholds have a more restricted length */ if (temphold && strlen(htag) + MAX_TAG_PREFIX_LEN >= MAXNAMELEN) - return (E2BIG); + return (SET_ERROR(E2BIG)); /* tags must be unique (if ds already exists) */ - if (ds != NULL) { - mutex_enter(&ds->ds_lock); - if (ds->ds_phys->ds_userrefs_obj != 0) { - uint64_t value; - error = zap_lookup(mos, ds->ds_phys->ds_userrefs_obj, - htag, 8, 1, &value); - if (error == 0) - error = SET_ERROR(EEXIST); - else if (error == ENOENT) - error = 0; - } - mutex_exit(&ds->ds_lock); + if (ds != NULL && ds->ds_phys->ds_userrefs_obj != 0) { + uint64_t value; + + error = zap_lookup(mos, ds->ds_phys->ds_userrefs_obj, + htag, 8, 1, &value); + if (error == 0) + error = SET_ERROR(EEXIST); + else if (error == ENOENT) + error = 0; } return (error); @@ -82,52 +83,63 @@ dsl_dataset_user_hold_check(void *arg, d { dsl_dataset_user_hold_arg_t *dduha = arg; dsl_pool_t *dp = dmu_tx_pool(tx); - nvpair_t *pair; - int rv = 0; if (spa_version(dp->dp_spa) < SPA_VERSION_USERREFS) return (SET_ERROR(ENOTSUP)); - for (pair = nvlist_next_nvpair(dduha->dduha_holds, NULL); pair != NULL; - pair = nvlist_next_nvpair(dduha->dduha_holds, pair)) { - int error = 0; + if (!dmu_tx_is_syncing(tx)) + return (0); + + for (nvpair_t *pair = nvlist_next_nvpair(dduha->dduha_holds, NULL); + pair != NULL; pair = nvlist_next_nvpair(dduha->dduha_holds, pair)) { dsl_dataset_t *ds; - char *htag; + int error = 0; + char *htag, *name; /* must be a snapshot */ - if (strchr(nvpair_name(pair), '@') == NULL) + name = nvpair_name(pair); + if (strchr(name, '@') == NULL) error = SET_ERROR(EINVAL); if (error == 0) error = nvpair_value_string(pair, &htag); - if (error == 0) { - error = dsl_dataset_hold(dp, - nvpair_name(pair), FTAG, &ds); - } + + if (error == 0) + error = dsl_dataset_hold(dp, name, FTAG, &ds); + if (error == 0) { error = dsl_dataset_user_hold_check_one(ds, htag, dduha->dduha_minor != 0, tx); dsl_dataset_rele(ds, FTAG); } - if (error != 0) { - rv = error; - fnvlist_add_int32(dduha->dduha_errlist, - nvpair_name(pair), error); + if (error == 0) { + fnvlist_add_string(dduha->dduha_chkholds, name, htag); + } else { + /* + * We register ENOENT errors so they can be correctly + * reported if needed, such as when all holds fail. + */ + fnvlist_add_int32(dduha->dduha_errlist, name, error); + if (error != ENOENT) + return (error); } } - return (rv); + + return (0); } -void -dsl_dataset_user_hold_sync_one(dsl_dataset_t *ds, const char *htag, - minor_t minor, uint64_t now, dmu_tx_t *tx) + +static void +dsl_dataset_user_hold_sync_one_impl(nvlist_t *tmpholds, dsl_dataset_t *ds, + const char *htag, minor_t minor, uint64_t now, dmu_tx_t *tx) { dsl_pool_t *dp = ds->ds_dir->dd_pool; objset_t *mos = dp->dp_meta_objset; uint64_t zapobj; - mutex_enter(&ds->ds_lock); + ASSERT(RRW_WRITE_HELD(&dp->dp_config_rwlock)); + if (ds->ds_phys->ds_userrefs_obj == 0) { /* * This is the first user hold for this dataset. Create @@ -140,14 +152,26 @@ dsl_dataset_user_hold_sync_one(dsl_datas zapobj = ds->ds_phys->ds_userrefs_obj; } ds->ds_userrefs++; - mutex_exit(&ds->ds_lock); VERIFY0(zap_add(mos, zapobj, htag, 8, 1, &now, tx)); if (minor != 0) { + char name[MAXNAMELEN]; + nvlist_t *tags; + VERIFY0(dsl_pool_user_hold(dp, ds->ds_object, htag, now, tx)); - dsl_register_onexit_hold_cleanup(ds, htag, minor); + (void) snprintf(name, sizeof (name), "%llx", + (u_longlong_t)ds->ds_object); + + if (nvlist_lookup_nvlist(tmpholds, name, &tags) != 0) { + tags = fnvlist_alloc(); + fnvlist_add_boolean(tags, htag); + fnvlist_add_nvlist(tmpholds, name, tags); + fnvlist_free(tags); + } else { + fnvlist_add_boolean(tags, htag); + } } spa_history_log_internal_ds(ds, "hold", tx, @@ -155,140 +179,292 @@ dsl_dataset_user_hold_sync_one(dsl_datas htag, minor != 0, ds->ds_userrefs); } +typedef struct zfs_hold_cleanup_arg { + char zhca_spaname[MAXNAMELEN]; + uint64_t zhca_spa_load_guid; + nvlist_t *zhca_holds; +} zfs_hold_cleanup_arg_t; + +static void +dsl_dataset_user_release_onexit(void *arg) +{ + zfs_hold_cleanup_arg_t *ca = arg; + spa_t *spa; + int error; + + error = spa_open(ca->zhca_spaname, &spa, FTAG); + if (error != 0) { + zfs_dbgmsg("couldn't release holds on pool=%s " + "because pool is no longer loaded", + ca->zhca_spaname); + return; + } + if (spa_load_guid(spa) != ca->zhca_spa_load_guid) { + zfs_dbgmsg("couldn't release holds on pool=%s " + "because pool is no longer loaded (guid doesn't match)", + ca->zhca_spaname); + spa_close(spa, FTAG); + return; + } + + (void) dsl_dataset_user_release_tmp(spa_get_dsl(spa), ca->zhca_holds); + fnvlist_free(ca->zhca_holds); + kmem_free(ca, sizeof (zfs_hold_cleanup_arg_t)); + spa_close(spa, FTAG); +} + +static void +dsl_onexit_hold_cleanup(spa_t *spa, nvlist_t *holds, minor_t minor) +{ + zfs_hold_cleanup_arg_t *ca; + + if (minor == 0 || nvlist_empty(holds)) { + fnvlist_free(holds); + return; + } + + ASSERT(spa != NULL); + ca = kmem_alloc(sizeof (*ca), KM_SLEEP); + + (void) strlcpy(ca->zhca_spaname, spa_name(spa), + sizeof (ca->zhca_spaname)); + ca->zhca_spa_load_guid = spa_load_guid(spa); + ca->zhca_holds = holds; + VERIFY0(zfs_onexit_add_cb(minor, + dsl_dataset_user_release_onexit, ca, NULL)); +} + +void +dsl_dataset_user_hold_sync_one(dsl_dataset_t *ds, const char *htag, + minor_t minor, uint64_t now, dmu_tx_t *tx) +{ + nvlist_t *tmpholds; + + if (minor != 0) + tmpholds = fnvlist_alloc(); + else + tmpholds = NULL; + dsl_dataset_user_hold_sync_one_impl(tmpholds, ds, htag, minor, now, tx); + dsl_onexit_hold_cleanup(dsl_dataset_get_spa(ds), tmpholds, minor); +} + static void dsl_dataset_user_hold_sync(void *arg, dmu_tx_t *tx) { dsl_dataset_user_hold_arg_t *dduha = arg; dsl_pool_t *dp = dmu_tx_pool(tx); - nvpair_t *pair; + nvlist_t *tmpholds; uint64_t now = gethrestime_sec(); - for (pair = nvlist_next_nvpair(dduha->dduha_holds, NULL); pair != NULL; - pair = nvlist_next_nvpair(dduha->dduha_holds, pair)) { + if (dduha->dduha_minor != 0) + tmpholds = fnvlist_alloc(); + else + tmpholds = NULL; + for (nvpair_t *pair = nvlist_next_nvpair(dduha->dduha_chkholds, NULL); + pair != NULL; + pair = nvlist_next_nvpair(dduha->dduha_chkholds, pair)) { dsl_dataset_t *ds; + VERIFY0(dsl_dataset_hold(dp, nvpair_name(pair), FTAG, &ds)); - dsl_dataset_user_hold_sync_one(ds, fnvpair_value_string(pair), - dduha->dduha_minor, now, tx); + dsl_dataset_user_hold_sync_one_impl(tmpholds, ds, + fnvpair_value_string(pair), dduha->dduha_minor, now, tx); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Fri Jul 5 04:16:53 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6B67EB65; Fri, 5 Jul 2013 04:16:53 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5D63B1F6F; Fri, 5 Jul 2013 04:16:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r654GrB1077439; Fri, 5 Jul 2013 04:16:53 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r654GrL1077438; Fri, 5 Jul 2013 04:16:53 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201307050416.r654GrL1077438@svn.freebsd.org> From: Xin LI Date: Fri, 5 Jul 2013 04:16:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252767 - stable/8/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 05 Jul 2013 04:16:53 -0000 Author: delphij Date: Fri Jul 5 04:16:52 2013 New Revision: 252767 URL: http://svnweb.freebsd.org/changeset/base/252767 Log: MFC r252218: Diff reduction against Illumos, no real change to code itself. This marks vendor branch revision 252213 as merged, the actual code was committed in r245479. Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Fri Jul 5 04:16:03 2013 (r252766) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Fri Jul 5 04:16:52 2013 (r252767) @@ -22,6 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 Steven Hartland. All rights reserved. */ /* From owner-svn-src-stable-8@FreeBSD.ORG Fri Jul 5 08:17:49 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6B11A4CE; Fri, 5 Jul 2013 08:17:49 +0000 (UTC) (envelope-from marck@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5D38A1A1F; Fri, 5 Jul 2013 08:17:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r658HnAk048160; Fri, 5 Jul 2013 08:17:49 GMT (envelope-from marck@svn.freebsd.org) Received: (from marck@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r658Hm0c048157; Fri, 5 Jul 2013 08:17:48 GMT (envelope-from marck@svn.freebsd.org) Message-Id: <201307050817.r658Hm0c048157@svn.freebsd.org> From: Dmitry Morozovsky Date: Fri, 5 Jul 2013 08:17:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252777 - in stable/8: . sbin/hastctl X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 05 Jul 2013 08:17:49 -0000 Author: marck (doc committer) Date: Fri Jul 5 08:17:48 2013 New Revision: 252777 URL: http://svnweb.freebsd.org/changeset/base/252777 Log: Finish MFC of r248291,249741: Change 'status' command to produce one-line easy-parseable output. Approved by: trociny Modified: stable/8/UPDATING stable/8/sbin/hastctl/hastctl.8 stable/8/sbin/hastctl/hastctl.c Directory Properties: stable/8/sbin/hastctl/ (props changed) Modified: stable/8/UPDATING ============================================================================== --- stable/8/UPDATING Fri Jul 5 08:16:40 2013 (r252776) +++ stable/8/UPDATING Fri Jul 5 08:17:48 2013 (r252777) @@ -15,6 +15,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. debugging tools present in HEAD were left in place because sun4v support still needs work to become production ready. +20130705: + hastctl(8)'s `status' command output changed to terse one-liner format. + Scripts using this should switch to `list' command or be rewritten. + 20130624: Added ZFS TRIM support which is enabled by default. To disable ZFS TRIM support set vfs.zfs.trim.enabled=0 in loader.conf. Modified: stable/8/sbin/hastctl/hastctl.8 ============================================================================== --- stable/8/sbin/hastctl/hastctl.8 Fri Jul 5 08:16:40 2013 (r252776) +++ stable/8/sbin/hastctl/hastctl.8 Fri Jul 5 08:17:48 2013 (r252777) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 24, 2013 +.Dd July 5, 2013 .Dt HASTCTL 8 .Os .Sh NAME @@ -145,18 +145,10 @@ GEOM provider will not be created on secondary node. .El .It Cm list -.It Cm status Present verbose status of the configured resources. -For now, list and status commands are equivalent. -In the near future the output of -.Nm -status command will change to more terse format. -If you use ` -.Nm -status' for parsing in your scripts, switch to ` -.Nm -list'. - +.It Cm status +Present terse (and more easy machine-parseable) status of the configured +resources. .It Cm dump Dump metadata stored on local component for the configured resources. .El Modified: stable/8/sbin/hastctl/hastctl.c ============================================================================== --- stable/8/sbin/hastctl/hastctl.c Fri Jul 5 08:16:40 2013 (r252776) +++ stable/8/sbin/hastctl/hastctl.c Fri Jul 5 08:17:48 2013 (r252777) @@ -291,7 +291,7 @@ control_set_role(struct nv *nv, const ch } static int -control_status(struct nv *nv) +control_list(struct nv *nv) { unsigned int ii; const char *str; @@ -355,6 +355,43 @@ control_status(struct nv *nv) return (ret); } +static int +control_status(struct nv *nv) +{ + unsigned int ii; + const char *str; + int error, hprinted, ret; + + hprinted = 0; + ret = 0; + + for (ii = 0; ; ii++) { + str = nv_get_string(nv, "resource%u", ii); + if (str == NULL) + break; + if (!hprinted) { + printf("Name\tStatus\t Role\t\tComponents\n"); + hprinted = 1; + } + printf("%s\t", str); + error = nv_get_int16(nv, "error%u", ii); + if (error != 0) { + if (ret == 0) + ret = error; + printf("ERR%d\n", error); + continue; + } + str = nv_get_string(nv, "status%u", ii); + printf("%-9s", (str != NULL) ? str : "-"); + printf("%-15s", nv_get_string(nv, "role%u", ii)); + printf("%s\t", + nv_get_string(nv, "localpath%u", ii)); + printf("%s\n", + nv_get_string(nv, "remoteaddr%u", ii)); + } + return (ret); +} + int main(int argc, char *argv[]) { @@ -523,6 +560,8 @@ main(int argc, char *argv[]) error = control_set_role(nv, argv[0]); break; case CMD_LIST: + error = control_list(nv); + break; case CMD_STATUS: error = control_status(nv); break; From owner-svn-src-stable-8@FreeBSD.ORG Fri Jul 5 18:44:41 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C86046FA; Fri, 5 Jul 2013 18:44:41 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BAA861C63; Fri, 5 Jul 2013 18:44:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r65Iifkc035907; Fri, 5 Jul 2013 18:44:41 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r65IifFK035905; Fri, 5 Jul 2013 18:44:41 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201307051844.r65IifFK035905@svn.freebsd.org> From: Mikolaj Golub Date: Fri, 5 Jul 2013 18:44:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252819 - in stable/8/sbin: hastctl hastd X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 05 Jul 2013 18:44:41 -0000 Author: trociny Date: Fri Jul 5 18:44:41 2013 New Revision: 252819 URL: http://svnweb.freebsd.org/changeset/base/252819 Log: MFC r252472: Make hastctl(1) ('list' command) output a worker pid. Reviewed by: pjd Modified: stable/8/sbin/hastctl/hastctl.c stable/8/sbin/hastd/control.c Directory Properties: stable/8/sbin/hastctl/ (props changed) stable/8/sbin/hastd/ (props changed) Modified: stable/8/sbin/hastctl/hastctl.c ============================================================================== --- stable/8/sbin/hastctl/hastctl.c Fri Jul 5 18:44:10 2013 (r252818) +++ stable/8/sbin/hastctl/hastctl.c Fri Jul 5 18:44:41 2013 (r252819) @@ -293,6 +293,7 @@ control_set_role(struct nv *nv, const ch static int control_list(struct nv *nv) { + pid_t pid; unsigned int ii; const char *str; int error, ret; @@ -331,6 +332,9 @@ control_list(struct nv *nv) str = nv_get_string(nv, "status%u", ii); if (str != NULL) printf(" status: %s\n", str); + pid = nv_get_int32(nv, "workerpid%u", ii); + if (pid != 0) + printf(" workerpid: %d\n", pid); printf(" dirty: %ju (%NB)\n", (uintmax_t)nv_get_uint64(nv, "dirty%u", ii), (intmax_t)nv_get_uint64(nv, "dirty%u", ii)); Modified: stable/8/sbin/hastd/control.c ============================================================================== --- stable/8/sbin/hastd/control.c Fri Jul 5 18:44:10 2013 (r252818) +++ stable/8/sbin/hastd/control.c Fri Jul 5 18:44:41 2013 (r252819) @@ -271,6 +271,7 @@ control_status(struct hastd_config *cfg, nv_add_string(nvout, compression_name(res->hr_compression), "compression%u", no); nv_add_string(nvout, role2str(res->hr_role), "role%u", no); + nv_add_int32(nvout, res->hr_workerpid, "workerpid%u", no); switch (res->hr_role) { case HAST_ROLE_PRIMARY: From owner-svn-src-stable-8@FreeBSD.ORG Fri Jul 5 18:47:26 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 478ECA91; Fri, 5 Jul 2013 18:47:26 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3971D1C83; Fri, 5 Jul 2013 18:47:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r65IlQDo036546; Fri, 5 Jul 2013 18:47:26 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r65IlPVn036543; Fri, 5 Jul 2013 18:47:25 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201307051847.r65IlPVn036543@svn.freebsd.org> From: Mikolaj Golub Date: Fri, 5 Jul 2013 18:47:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252821 - stable/8/usr.sbin/bsnmpd/modules/snmp_hast X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 05 Jul 2013 18:47:26 -0000 Author: trociny Date: Fri Jul 5 18:47:25 2013 New Revision: 252821 URL: http://svnweb.freebsd.org/changeset/base/252821 Log: MFC r252516, r252540: Add a mib for worker process ID. Modified: stable/8/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt stable/8/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c stable/8/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def Directory Properties: stable/8/usr.sbin/bsnmpd/ (props changed) Modified: stable/8/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt ============================================================================== --- stable/8/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt Fri Jul 5 18:46:35 2013 (r252820) +++ stable/8/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt Fri Jul 5 18:47:25 2013 (r252821) @@ -57,6 +57,9 @@ begemotHast MODULE-IDENTITY REVISION "201304130000Z" DESCRIPTION "Initial revision." + REVISION "201307010000Z" + DESCRIPTION + "Added hastResourceWorkerPid." ::= { begemot 220 } begemotHastObjects OBJECT IDENTIFIER ::= { begemotHast 1 } @@ -116,7 +119,8 @@ HastResourceEntry ::= SEQUENCE { hastResourceReadErrors Counter64, hastResourceWriteErrors Counter64, hastResourceDeleteErrors Counter64, - hastResourceFlushErrors Counter64 + hastResourceFlushErrors Counter64, + hastResourceWorkerPid INTEGER } hastResourceIndex OBJECT-TYPE @@ -295,4 +299,12 @@ hastResourceFlushErrors OBJECT-TYPE "Count of resource local flush operations that failed." ::= { hastResourceEntry 21 } +hastResourceWorkerPid OBJECT-TYPE + SYNTAX INTEGER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Worker process ID." + ::= { hastResourceEntry 22 } + END Modified: stable/8/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c ============================================================================== --- stable/8/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c Fri Jul 5 18:46:35 2013 (r252820) +++ stable/8/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c Fri Jul 5 18:47:25 2013 (r252821) @@ -78,6 +78,7 @@ struct hast_snmp_resource { uint64_t write_errors; uint64_t delete_errors; uint64_t flush_errors; + pid_t workerpid; }; static TAILQ_HEAD(, hast_snmp_resource) resources = @@ -343,6 +344,7 @@ update_resources(void) nv_get_uint64(nvout, "stat_delete_error%u", i); res->flush_errors = nv_get_uint64(nvout, "stat_flush_error%u", i); + res->workerpid = nv_get_int32(nvout, "workerpid%u", i); TAILQ_INSERT_TAIL(&resources, res, link); } nv_free(nvout); @@ -498,6 +500,9 @@ op_hastResourceTable(struct snmp_context case LEAF_hastResourceFlushErrors: value->v.counter64 = res->flush_errors; break; + case LEAF_hastResourceWorkerPid: + value->v.integer = res->workerpid; + break; default: ret = SNMP_ERR_RES_UNAVAIL; break; Modified: stable/8/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def ============================================================================== --- stable/8/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def Fri Jul 5 18:46:35 2013 (r252820) +++ stable/8/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def Fri Jul 5 18:47:25 2013 (r252821) @@ -59,6 +59,7 @@ (19 hastResourceWriteErrors COUNTER64 GET) (20 hastResourceDeleteErrors COUNTER64 GET) (21 hastResourceFlushErrors COUNTER64 GET) + (22 hastResourceWorkerPid INTEGER GET) ) ) ) From owner-svn-src-stable-8@FreeBSD.ORG Sat Jul 6 02:50:23 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A8C3CE1D; Sat, 6 Jul 2013 02:50:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7F8081098; Sat, 6 Jul 2013 02:50:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r662oNTw082462; Sat, 6 Jul 2013 02:50:23 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r662oNjG082460; Sat, 6 Jul 2013 02:50:23 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201307060250.r662oNjG082460@svn.freebsd.org> From: Mark Johnston Date: Sat, 6 Jul 2013 02:50:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252859 - in stable/8/sys/cddl/dev: dtrace/amd64 sdt X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 06 Jul 2013 02:50:23 -0000 Author: markj Date: Sat Jul 6 02:50:22 2013 New Revision: 252859 URL: http://svnweb.freebsd.org/changeset/base/252859 Log: MFC r251238: SDT probes can directly pass up to five arguments as arguments to dtrace_probe(). Arguments beyond these five must be obtained in an architecture-specific way; this can be done through the getargval provider method, and through dtrace_getarg() if getargval isn't overridden. This change fixes two off-by-one bugs in the way these arguments are fetched in FreeBSD's DTrace implementation. First, the SDT provider must set the aframes parameter to 1 when creating a probe. The aframes parameter controls the number of frames that dtrace_getarg() will step over in order to find the frame containing the extra arguments. On FreeBSD, dtrace_getarg() is called in SDT probe context via dtrace_probe()->dtrace_dif_emulate()->dtrace_dif_variable->dtrace_getarg() so aframes must be 3 since the arguments are in dtrace_probe()'s frame; it was previously being called with a value of 2 instead. illumos uses a different aframes value for SDT probes, but this is because illumos SDT probes fire by triggering the #UD fault handler rather than calling dtrace_probe() directly. The second bug has to do with the way arguments are grabbed out dtrace_probe()'s frame on amd64. The code currently jumps over the first stack argument and retrieves the rest of them using a pointer into the stack. This works on i386 because all of dtrace_probe()'s arguments will be on the stack and the first argument is the probe ID, which should be ignored. However, it is incorrect to ignore the first stack argument on amd64, so we correct the pointer used to access the arguments. Modified: stable/8/sys/cddl/dev/dtrace/amd64/dtrace_isa.c stable/8/sys/cddl/dev/sdt/sdt.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) Modified: stable/8/sys/cddl/dev/dtrace/amd64/dtrace_isa.c ============================================================================== --- stable/8/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Sat Jul 6 02:49:56 2013 (r252858) +++ stable/8/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Sat Jul 6 02:50:22 2013 (r252859) @@ -398,7 +398,7 @@ dtrace_getarg(int arg, int aframes) } arg -= (inreg + 1); - stack = (uintptr_t *)&fp[1]; + stack = (uintptr_t *)fp + 2; load: DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); Modified: stable/8/sys/cddl/dev/sdt/sdt.c ============================================================================== --- stable/8/sys/cddl/dev/sdt/sdt.c Sat Jul 6 02:49:56 2013 (r252858) +++ stable/8/sys/cddl/dev/sdt/sdt.c Sat Jul 6 02:50:22 2013 (r252859) @@ -134,7 +134,7 @@ sdt_probe_callback(struct sdt_probe *pro return (0); (void) dtrace_probe_create(prov->id, probe->mod, probe->func, - probe->name, 0, probe); + probe->name, 1, probe); return (0); } From owner-svn-src-stable-8@FreeBSD.ORG Sat Jul 6 03:40:00 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8995D887; Sat, 6 Jul 2013 03:40:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7735D133F; Sat, 6 Jul 2013 03:40:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r663e0LU098445; Sat, 6 Jul 2013 03:40:00 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r663e0Jh098444; Sat, 6 Jul 2013 03:40:00 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201307060340.r663e0Jh098444@svn.freebsd.org> From: Mark Johnston Date: Sat, 6 Jul 2013 03:40:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252861 - stable/8/sys/cddl/dev/dtmalloc X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 06 Jul 2013 03:40:00 -0000 Author: markj Date: Sat Jul 6 03:40:00 2013 New Revision: 252861 URL: http://svnweb.freebsd.org/changeset/base/252861 Log: MFC r252325: The dtmalloc provider uses the short description of a malloc type as the function name of its corresponding DTrace probes. These descriptions may contain whitespace, but probe names cannot, so just replace any whitespace with underscores when creating probes. Modified: stable/8/sys/cddl/dev/dtmalloc/dtmalloc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) Modified: stable/8/sys/cddl/dev/dtmalloc/dtmalloc.c ============================================================================== --- stable/8/sys/cddl/dev/dtmalloc/dtmalloc.c Sat Jul 6 03:39:40 2013 (r252860) +++ stable/8/sys/cddl/dev/dtmalloc/dtmalloc.c Sat Jul 6 03:40:00 2013 (r252861) @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -111,8 +112,17 @@ dtmalloc_type_cb(struct malloc_type *mtp { char name[DTRACE_FUNCNAMELEN]; struct malloc_type_internal *mtip = mtp->ks_handle; + int i; + /* + * malloc_type descriptions are allowed to contain whitespace, but + * DTrace probe identifiers are not, so replace the whitespace with + * underscores. + */ strlcpy(name, mtp->ks_shortdesc, sizeof(name)); + for (i = 0; name[i] != 0; i++) + if (isspace(name[i])) + name[i] = '_'; if (dtrace_probe_lookup(dtmalloc_id, NULL, name, "malloc") != 0) return; From owner-svn-src-stable-8@FreeBSD.ORG Sat Jul 6 08:37:44 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E017B249; Sat, 6 Jul 2013 08:37:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C18991DDD; Sat, 6 Jul 2013 08:37:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r668biMO085700; Sat, 6 Jul 2013 08:37:44 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r668bhu0085695; Sat, 6 Jul 2013 08:37:43 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201307060837.r668bhu0085695@svn.freebsd.org> From: Andriy Gapon Date: Sat, 6 Jul 2013 08:37:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252870 - stable/8/sys/dev/uart X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 06 Jul 2013 08:37:45 -0000 Author: avg Date: Sat Jul 6 08:37:43 2013 New Revision: 252870 URL: http://svnweb.freebsd.org/changeset/base/252870 Log: MFC r246243: uart: add resume method and enable it for attachments on the most common x86 buses Modified: stable/8/sys/dev/uart/uart_bus.h stable/8/sys/dev/uart/uart_bus_acpi.c stable/8/sys/dev/uart/uart_bus_isa.c stable/8/sys/dev/uart/uart_bus_pci.c stable/8/sys/dev/uart/uart_core.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/uart/ (props changed) Modified: stable/8/sys/dev/uart/uart_bus.h ============================================================================== --- stable/8/sys/dev/uart/uart_bus.h Sat Jul 6 08:30:45 2013 (r252869) +++ stable/8/sys/dev/uart/uart_bus.h Sat Jul 6 08:37:43 2013 (r252870) @@ -137,6 +137,7 @@ extern char uart_driver_name[]; int uart_bus_attach(device_t dev); int uart_bus_detach(device_t dev); +int uart_bus_resume(device_t dev); serdev_intr_t *uart_bus_ihand(device_t dev, int ipend); int uart_bus_ipend(device_t dev); int uart_bus_probe(device_t dev, int regshft, int rclk, int rid, int chan); Modified: stable/8/sys/dev/uart/uart_bus_acpi.c ============================================================================== --- stable/8/sys/dev/uart/uart_bus_acpi.c Sat Jul 6 08:30:45 2013 (r252869) +++ stable/8/sys/dev/uart/uart_bus_acpi.c Sat Jul 6 08:37:43 2013 (r252870) @@ -47,6 +47,7 @@ static device_method_t uart_acpi_methods DEVMETHOD(device_probe, uart_acpi_probe), DEVMETHOD(device_attach, uart_bus_attach), DEVMETHOD(device_detach, uart_bus_detach), + DEVMETHOD(device_resume, uart_bus_resume), { 0, 0 } }; Modified: stable/8/sys/dev/uart/uart_bus_isa.c ============================================================================== --- stable/8/sys/dev/uart/uart_bus_isa.c Sat Jul 6 08:30:45 2013 (r252869) +++ stable/8/sys/dev/uart/uart_bus_isa.c Sat Jul 6 08:37:43 2013 (r252870) @@ -50,6 +50,7 @@ static device_method_t uart_isa_methods[ DEVMETHOD(device_probe, uart_isa_probe), DEVMETHOD(device_attach, uart_bus_attach), DEVMETHOD(device_detach, uart_bus_detach), + DEVMETHOD(device_resume, uart_bus_resume), { 0, 0 } }; Modified: stable/8/sys/dev/uart/uart_bus_pci.c ============================================================================== --- stable/8/sys/dev/uart/uart_bus_pci.c Sat Jul 6 08:30:45 2013 (r252869) +++ stable/8/sys/dev/uart/uart_bus_pci.c Sat Jul 6 08:37:43 2013 (r252870) @@ -51,6 +51,7 @@ static device_method_t uart_pci_methods[ DEVMETHOD(device_probe, uart_pci_probe), DEVMETHOD(device_attach, uart_bus_attach), DEVMETHOD(device_detach, uart_bus_detach), + DEVMETHOD(device_resume, uart_bus_resume), DEVMETHOD_END }; Modified: stable/8/sys/dev/uart/uart_core.c ============================================================================== --- stable/8/sys/dev/uart/uart_core.c Sat Jul 6 08:30:45 2013 (r252869) +++ stable/8/sys/dev/uart/uart_core.c Sat Jul 6 08:37:43 2013 (r252870) @@ -578,3 +578,12 @@ uart_bus_detach(device_t dev) return (0); } + +int +uart_bus_resume(device_t dev) +{ + struct uart_softc *sc; + + sc = device_get_softc(dev); + return (UART_ATTACH(sc)); +} From owner-svn-src-stable-8@FreeBSD.ORG Sat Jul 6 08:43:50 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 70414714; Sat, 6 Jul 2013 08:43:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 636581DFD; Sat, 6 Jul 2013 08:43:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r668horC088347; Sat, 6 Jul 2013 08:43:50 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r668hopZ088345; Sat, 6 Jul 2013 08:43:50 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201307060843.r668hopZ088345@svn.freebsd.org> From: Andriy Gapon Date: Sat, 6 Jul 2013 08:43:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252873 - stable/8/lib/libdwarf X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 06 Jul 2013 08:43:50 -0000 Author: avg Date: Sat Jul 6 08:43:49 2013 New Revision: 252873 URL: http://svnweb.freebsd.org/changeset/base/252873 Log: MFC r248641: libdwarf: anonymous types are expected to have empty type names Modified: stable/8/lib/libdwarf/dwarf_die.c Directory Properties: stable/8/lib/libdwarf/ (props changed) Modified: stable/8/lib/libdwarf/dwarf_die.c ============================================================================== --- stable/8/lib/libdwarf/dwarf_die.c Sat Jul 6 08:43:31 2013 (r252872) +++ stable/8/lib/libdwarf/dwarf_die.c Sat Jul 6 08:43:49 2013 (r252873) @@ -29,8 +29,6 @@ #include #include "_libdwarf.h" -static const char *anon_name = "__anon__"; - int dwarf_die_add(Dwarf_CU cu, int level, uint64_t offset, uint64_t abnum, Dwarf_Abbrev a, Dwarf_Die *diep, Dwarf_Error *err) { @@ -57,7 +55,7 @@ dwarf_die_add(Dwarf_CU cu, int level, ui die->die_abnum = abnum; die->die_a = a; die->die_cu = cu; - die->die_name = anon_name; + die->die_name = ""; /* Initialise the list of attribute values. */ STAILQ_INIT(&die->die_attrval); From owner-svn-src-stable-8@FreeBSD.ORG Sat Jul 6 08:59:27 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D082CF7A; Sat, 6 Jul 2013 08:59:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C28EA1E71; Sat, 6 Jul 2013 08:59:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r668xRXG092434; Sat, 6 Jul 2013 08:59:27 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r668xRkt092433; Sat, 6 Jul 2013 08:59:27 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201307060859.r668xRkt092433@svn.freebsd.org> From: Andriy Gapon Date: Sat, 6 Jul 2013 08:59:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252876 - stable/8/sys/boot/common X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 06 Jul 2013 08:59:27 -0000 Author: avg Date: Sat Jul 6 08:59:27 2013 New Revision: 252876 URL: http://svnweb.freebsd.org/changeset/base/252876 Log: MFC r249139: strncmp for boot code: fix an off by one error Modified: stable/8/sys/boot/common/util.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/boot/ (props changed) Modified: stable/8/sys/boot/common/util.c ============================================================================== --- stable/8/sys/boot/common/util.c Sat Jul 6 08:58:30 2013 (r252875) +++ stable/8/sys/boot/common/util.c Sat Jul 6 08:59:27 2013 (r252876) @@ -68,9 +68,9 @@ int strncmp(const char *s1, const char *s2, size_t len) { - for (; *s1 == *s2 && *s1 != '\0' && len > 0; len--, s1++, s2++) + for (; len > 0 && *s1 == *s2 && *s1 != '\0'; len--, s1++, s2++) ; - return ((unsigned char)*s1 - (unsigned char)*s2); + return (len == 0 ? 0 : (unsigned char)*s1 - (unsigned char)*s2); } void From owner-svn-src-stable-8@FreeBSD.ORG Sat Jul 6 09:03:02 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B48832D3; Sat, 6 Jul 2013 09:03:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A74EE1E9E; Sat, 6 Jul 2013 09:03:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r66932Rg094858; Sat, 6 Jul 2013 09:03:02 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r66932B0094857; Sat, 6 Jul 2013 09:03:02 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201307060903.r66932B0094857@svn.freebsd.org> From: Andriy Gapon Date: Sat, 6 Jul 2013 09:03:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252878 - stable/8/etc X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 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, 06 Jul 2013 09:03:02 -0000 Author: avg Date: Sat Jul 6 09:03:02 2013 New Revision: 252878 URL: http://svnweb.freebsd.org/changeset/base/252878 Log: MFC r248820: rc.subr: disabling globbing while processing devfs rules Modified: stable/8/etc/rc.subr Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/rc.subr ============================================================================== --- stable/8/etc/rc.subr Sat Jul 6 09:02:30 2013 (r252877) +++ stable/8/etc/rc.subr Sat Jul 6 09:03:02 2013 (r252878) @@ -1322,7 +1322,7 @@ make_symlink() # devfs_rulesets_from_file() { - local file _err _me + local file _err _me _opts file="$1" _me="devfs_rulesets_from_file" _err=0 @@ -1335,6 +1335,11 @@ devfs_rulesets_from_file() debug "$_me: no such file ($file)" return 0 fi + + # Disable globbing so that the rule patterns are not expanded + # by accident with matching filesystem entries. + _opts=$-; set -f + debug "reading rulesets from file ($file)" { while read line do @@ -1381,6 +1386,7 @@ devfs_rulesets_from_file() break fi done } < $file + case $_opts in *f*) ;; *) set +f ;; esac return $_err }