From owner-svn-src-all@freebsd.org Fri Jan 29 17:24:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E437A72097; Fri, 29 Jan 2016 17:24:09 +0000 (UTC) (envelope-from cschuber@gmail.com) Received: from mail-pf0-x233.google.com (mail-pf0-x233.google.com [IPv6:2607:f8b0:400e:c00::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 000BE19F5; Fri, 29 Jan 2016 17:24:08 +0000 (UTC) (envelope-from cschuber@gmail.com) Received: by mail-pf0-x233.google.com with SMTP id o185so40492469pfb.1; Fri, 29 Jan 2016 09:24:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:mime-version:from:subject:date:to:content-type; bh=/3PYem77a/Mi5KCsiLBN79U//W7aWd8658HqBjrIbbk=; b=gZ6o5wHHKuPkGQ34qZg5EMpRQez+yHNBfHp+j1JUfqo/qtIRQ11sc/QDmp/SjVZyeX A4zLrp3LM0hy1j0WGTFebBIQ8WTlFB00L62BInOmOMz0sCrkZktgEJExx1EifizSYt1C g4mlxnpPYCYX+oL4V0G4sReA7i0WJIBif9gijwV9tLSvf/KuRY5GlZWzbwUWoJLBVN9O frWbgWiW00iTrUmc/ExL/Z2GCVLhZDoHJWCzrRIL0VL7g1aNXxprn/EnrHj8ZoobC0/9 omm9faUtrdpEAvn9T3vEsCf3sXVBTSRex5MiwbPOcyuUXvoRFfSmK4tCL46O5IY5eZ1N 0WLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:mime-version:from:subject:date:to :content-type; bh=/3PYem77a/Mi5KCsiLBN79U//W7aWd8658HqBjrIbbk=; b=Owcjlzagy1bpAMg7qJvt4/V9s7PrIAs3meTK95nd4TMH2TDhrhRU66D1kPbImBNh2Q CUzztdFRGOLvKXsYoLR4XVDVLxGFGa+iNvgdhO7OdA2hfag/hBS0yxWg47E9gr/1dNIw TpfpFOmIN7WdFP9rnIYgYmahCJgy2zEbWu7Ns10woFIoFoIqZ4Xy0Rn9dapjS/pNL3lT /8yVxCbb2YQbL2jQeMni2WK4vkvHf/m858BHWvvnxD9p/gLvPwXgXY7TtddnqQF/tqvf uiHJXC/Q7t9oJto8NHPlrvTI2QdQKClRfelE0xddSkHUmLXo3UTK6CXG7kNDl/aov0qG 4KFg== X-Gm-Message-State: AG10YOQ8D0gy9mI6QwLiTASO/8TxrK0+5LJ2u84iDTxFwVOPxhkkf9Fyu9TmgtaGzxgYDA== X-Received: by 10.98.32.25 with SMTP id g25mr15242678pfg.20.1454088248285; Fri, 29 Jan 2016 09:24:08 -0800 (PST) Received: from [192.168.1.101] (S0106002401cb186f.gv.shawcable.net. [96.50.22.10]) by smtp.gmail.com with ESMTPSA id q136sm24827363pfq.66.2016.01.29.09.24.07 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 29 Jan 2016 09:24:07 -0800 (PST) Message-ID: <56aba037.8e2a620a.e5e0a.571a@mx.google.com> MIME-Version: 1.0 From: Cy Schubert Subject: RE: svn commit: r295045 - in head: .sys/cddl/contrib/opensolaris/uts/common/fs/zfs Date: Fri, 29 Jan 2016 09:24:22 -0800 To: Alan Somers , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , "cy.schubert@cschubert.com" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 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, 29 Jan 2016 17:24:09 -0000 Thank you. :) Sent from my cellphone, ~Cy -----Original Message----- From: Alan Somers Sent: 29/01/2016 09:08 To: src-committers@freebsd.org; svn-src-all@freebsd.org; svn-src-head@freeb= sd.org Subject: svn commit: r295045 - in head: .sys/cddl/contrib/opensolaris/uts/c= ommon/fs/zfs Author: asomers Date: Fri Jan 29 17:08:26 2016 New Revision: 295045 URL: https://svnweb.freebsd.org/changeset/base/295045 Log: Add a sysctl to allow ZFS pools backed by zvols =20 Change 294329 removed the ability to build ZFS pools that are backed by zvols, because having that ability (even if it's not used) leads to deadlocks. By popular demand, I'm adding an off-by-default sysctl to reenable that ability. =20 Reviewed by: lidl, delphij MFC after: Never Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D4998 Modified: head/UPDATING head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: head/UPDATING =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- head/UPDATING Fri Jan 29 17:05:30 2016 (r295044) +++ head/UPDATING Fri Jan 29 17:08:26 2016 (r295045) @@ -31,6 +31,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) =20 +20160129: + Building ZFS pools on top of zvols is prohibited by default. That + feature has never worked safely; it's always been prone to deadlocks. + Using a zvol as the backing store for a VM guest's virtual disk will + still work, even if the guest is using ZFS. Legacy behavior can be + restored by setting vfs.zfs.vol.recursive=3D1. + 20160119: The NONE and HPN patches has been removed from OpenSSH. They are still available in the security/openssh-portable port. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Fri Jan 29 1= 7:05:30 2016 (r295044) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Fri Jan 29 1= 7:08:26 2016 (r295045) @@ -134,6 +134,9 @@ SYSCTL_NODE(_vfs_zfs, OID_AUTO, vol, CTL static int volmode =3D ZFS_VOLMODE_GEOM; SYSCTL_INT(_vfs_zfs_vol, OID_AUTO, mode, CTLFLAG_RWTUN, &volmode, 0, "Expose as GEOM providers (1), device files (2) or neither"); +static boolean_t zpool_on_zvol =3D B_FALSE; +SYSCTL_INT(_vfs_zfs_vol, OID_AUTO, recursive, CTLFLAG_RWTUN, &zpool_on_zvo= l, 0, + "Allow zpools to use zvols as vdevs (DANGEROUS)"); =20 #endif typedef struct zvol_extent { @@ -1114,7 +1117,9 @@ zvol_open(struct g_provider *pp, int fla return (err); } #else /* !illumos */ - if (tsd_get(zfs_geom_probe_vdev_key) !=3D NULL) { + boolean_t locked =3D B_FALSE; + + if (!zpool_on_zvol && tsd_get(zfs_geom_probe_vdev_key) !=3D NULL) { /* * if zfs_geom_probe_vdev_key is set, that means that zfs is * attempting to probe geom providers while looking for a @@ -1125,19 +1130,34 @@ zvol_open(struct g_provider *pp, int fla */ return (EOPNOTSUPP); } - - mutex_enter(&zfsdev_state_lock); + /* + * Protect against recursively entering spa_namespace_lock + * when spa_open() is used for a pool on a (local) ZVOL(s). + * This is needed since we replaced upstream zfsdev_state_lock + * with spa_namespace_lock in the ZVOL code. + * We are using the same trick as spa_open(). + * Note that calls in zvol_first_open which need to resolve + * pool name to a spa object will enter spa_open() + * recursively, but that function already has all the + * necessary protection. + */ + if (!MUTEX_HELD(&zfsdev_state_lock)) { + mutex_enter(&zfsdev_state_lock); + locked =3D B_TRUE; + } =20 zv =3D pp->private; if (zv =3D=3D NULL) { - mutex_exit(&zfsdev_state_lock); + if (locked) + mutex_exit(&zfsdev_state_lock); return (SET_ERROR(ENXIO)); } =20 if (zv->zv_total_opens =3D=3D 0) { err =3D zvol_first_open(zv); if (err) { - mutex_exit(&zfsdev_state_lock); + if (locked) + mutex_exit(&zfsdev_state_lock); return (err); } pp->mediasize =3D zv->zv_volsize; @@ -1171,7 +1191,8 @@ zvol_open(struct g_provider *pp, int fla mutex_exit(&zfsdev_state_lock); #else zv->zv_total_opens +=3D count; - mutex_exit(&zfsdev_state_lock); + if (locked) + mutex_exit(&zfsdev_state_lock); #endif =20 return (err); @@ -1181,7 +1202,8 @@ out: #ifdef illumos mutex_exit(&zfsdev_state_lock); #else - mutex_exit(&zfsdev_state_lock); + if (locked) + mutex_exit(&zfsdev_state_lock); #endif return (err); }