From owner-svn-src-all@FreeBSD.ORG Fri Feb 11 05:56:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CE18106566C; Fri, 11 Feb 2011 05:56:15 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A0618FC15; Fri, 11 Feb 2011 05:56:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1B5uF8n047527; Fri, 11 Feb 2011 05:56:15 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1B5uFo8047525; Fri, 11 Feb 2011 05:56:15 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201102110556.p1B5uFo8047525@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 11 Feb 2011 05:56:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218541 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Feb 2011 05:56:15 -0000 Author: ae Date: Fri Feb 11 05:56:14 2011 New Revision: 218541 URL: http://svn.freebsd.org/changeset/base/218541 Log: MFC r218278: vdev's sectorsize should not be greater than 8 Kbytes and also it should be power of 2. This prevents non-aligned access while probing vdev's labels. PR: kern/147852 Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Feb 11 05:54:46 2011 (r218540) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Feb 11 05:56:14 2011 (r218541) @@ -392,7 +392,8 @@ vdev_geom_open_by_path(vdev_t *vd, int c if (pp != NULL) { ZFS_LOG(1, "Found provider by name %s.", vd->vdev_path); cp = vdev_geom_attach(pp); - if (cp != NULL && check_guid) { + if (cp != NULL && check_guid && ISP2(pp->sectorsize) && + pp->sectorsize <= VDEV_PAD_SIZE) { g_topology_unlock(); guid = vdev_geom_read_guid(cp); g_topology_lock(); @@ -456,6 +457,17 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi if (cp == NULL) { ZFS_LOG(1, "Provider %s not found.", vd->vdev_path); error = ENOENT; + } else if (cp->provider->sectorsize > VDEV_PAD_SIZE || + !ISP2(cp->provider->sectorsize)) { + ZFS_LOG(1, "Provider %s has unsupported sectorsize.", + vd->vdev_path); + + g_topology_lock(); + vdev_geom_detach(cp, 0); + g_topology_unlock(); + + error = EINVAL; + cp = NULL; } else if (cp->acw == 0 && (spa_mode(vd->vdev_spa) & FWRITE) != 0) { int i;