Compare commits
119 Commits
stable-3
...
0b063f2c20
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b063f2c20 | |||
| ea3522b2f7 | |||
| aa7ac7c184 | |||
| a010b40938 | |||
| f0371a1b16 | |||
| 933b31ffad | |||
| 76a4c29ab5 | |||
| afa7541760 | |||
| f3341ff73f | |||
| 50ad4ffe78 | |||
| cabb465d41 | |||
| cd09cd8030 | |||
| fccda2b9e6 | |||
| 5a3a6c060f | |||
| 170bd23f1a | |||
| 7abe13017f | |||
| 47ae0e2662 | |||
| 849c46778d | |||
| fd313b306e | |||
| c0f28922e8 | |||
| 7fdf8cc174 | |||
| 42e934e271 | |||
| 026bc5c9b2 | |||
| edf5051c71 | |||
| 75b07eca3e | |||
| 8324054718 | |||
| 1fa7e3ca4d | |||
| 8a088a9e2a | |||
| 871e750385 | |||
| c43065ced4 | |||
| b199710aee | |||
| 6beaed3f99 | |||
| 6efadbff82 | |||
| ed50d895d0 | |||
| 66609d7572 | |||
| fdd7076d71 | |||
| 7b1cd3b8c0 | |||
| dda3b9248b | |||
| 4e883a4ec5 | |||
| 2e2e28836c | |||
| f7fae412d9 | |||
| 4495daacdc | |||
| b9d59150d1 | |||
| e5fa0aa21d | |||
| 7130c30d2b | |||
| b03175e961 | |||
| cc88cf22d1 | |||
| f07031b9ab | |||
| af05210837 | |||
| c542769d74 | |||
| 2ce263d24d | |||
| 38b6b3a10d | |||
| 65fc6d785f | |||
| f2be26ec96 | |||
| e2f4edc81e | |||
| 3c99d2a035 | |||
| 3264cfc5e7 | |||
| bdc71736c4 | |||
| 11fac95726 | |||
| 012341487f | |||
| ea927859d2 | |||
| e6fdafd565 | |||
| 4c3d639686 | |||
| 8a19f2ad5d | |||
| 56d9662c48 | |||
| a59077893a | |||
| 4156449701 | |||
| 8dbff718a0 | |||
| 58a974f8f0 | |||
| 1e88a70802 | |||
| 59653d92a8 | |||
| a5dfd38639 | |||
| 100fba2dff | |||
| eee857a82b | |||
| 33edb24418 | |||
| 2d5ff41105 | |||
| d93bc1b005 | |||
| 18708aae25 | |||
| 904f90c739 | |||
| 81f5dae8f7 | |||
| 7bfc3db5e1 | |||
| 49f86653f1 | |||
| 3474a9b46b | |||
| d0b125705d | |||
| 8a287a137b | |||
| 00d871a78a | |||
| 23db36409e | |||
| d72bef5bd3 | |||
| b894a06c2c | |||
| 0b15456e05 | |||
| 2aba4528fd | |||
| 00c2573479 | |||
| 531bc89e39 | |||
| de76987c78 | |||
| 8155ecfe17 | |||
| c5aee9e4ce | |||
| 03ab644074 | |||
| acef550f8d | |||
| c7fd7e24f5 | |||
| d064c14aad | |||
| 8d62a89482 | |||
| 5a1f030de3 | |||
| bc3a2de1e1 | |||
| 944a4708cf | |||
| 3435683847 | |||
| 64d186b910 | |||
| eb4bd3cde8 | |||
| c6ed1ff858 | |||
| 20bb0ecfa0 | |||
| 1c1a906890 | |||
| 787716f74d | |||
| 46e32ac3b7 | |||
| f5c66275b3 | |||
| e479455eaf | |||
| 10b48f6191 | |||
| 09b78d33bc | |||
| 2335fd5207 | |||
| 9959b4fc3a | |||
| 5ce963e7da |
@@ -0,0 +1,6 @@
|
||||
[submodule "zfs-debian"]
|
||||
path = zfs-debian
|
||||
url = ../mirror_zfs-debian
|
||||
[submodule "spl-debian"]
|
||||
path = spl-debian
|
||||
url = ../mirror_spl-debian
|
||||
@@ -1,67 +1,78 @@
|
||||
RELEASE=3.3
|
||||
RELEASE=5.1
|
||||
|
||||
# source form https://github.com/zfsonlinux/
|
||||
|
||||
ZFSVER=0.6.3-1.2
|
||||
ZFSPKGREL=2~wheezy
|
||||
SPLPKGREL=1~wheezy
|
||||
ZFSPKGVER=0.6.3-${ZFSPKGREL}
|
||||
SPLPKGVER=0.6.3-${SPLPKGREL}
|
||||
ZFSVER=0.7.11
|
||||
ZFSPKGREL=pve1~bpo1
|
||||
SPLPKGREL=pve1~bpo1
|
||||
ZFSPKGVER=${ZFSVER}-${ZFSPKGREL}
|
||||
SPLPKGVER=${ZFSVER}-${SPLPKGREL}
|
||||
|
||||
SPLDIR=spl-spl-${ZFSVER}
|
||||
SPLSRC=spl-${ZFSVER}.tar.gz
|
||||
ZFSDIR=zfs-zfs-${ZFSVER}
|
||||
ZFSSRC=zfs-${ZFSVER}.tar.gz
|
||||
SPLDIR=spl-build
|
||||
SPLSRC=spl-debian
|
||||
ZFSDIR=zfs-build
|
||||
ZFSSRC=zfs-debian
|
||||
|
||||
SPL_DEBS= \
|
||||
SPL_DEB = \
|
||||
spl_${SPLPKGVER}_amd64.deb
|
||||
|
||||
ZFS_DEBS= \
|
||||
libnvpair1_${ZFSPKGVER}_amd64.deb \
|
||||
libuutil1_${ZFSPKGVER}_amd64.deb \
|
||||
libzfs2_${ZFSPKGVER}_amd64.deb \
|
||||
libzfs-dev_${ZFSPKGVER}_amd64.deb \
|
||||
libzpool2_${ZFSPKGVER}_amd64.deb \
|
||||
zfs-doc_${ZFSPKGVER}_amd64.deb \
|
||||
zfs-initramfs_${ZFSPKGVER}_amd64.deb \
|
||||
zfsutils_${ZFSPKGVER}_amd64.deb
|
||||
ZFS_DEB1= libnvpair1linux_${ZFSPKGVER}_amd64.deb
|
||||
ZFS_DEB2= \
|
||||
libuutil1linux_${ZFSPKGVER}_amd64.deb \
|
||||
libzfs2linux_${ZFSPKGVER}_amd64.deb \
|
||||
libzfslinux-dev_${ZFSPKGVER}_amd64.deb \
|
||||
libzpool2linux_${ZFSPKGVER}_amd64.deb \
|
||||
zfs-dbg_${ZFSPKGVER}_amd64.deb \
|
||||
zfs-zed_${ZFSPKGVER}_amd64.deb \
|
||||
zfs-initramfs_${ZFSPKGVER}_all.deb \
|
||||
zfs-test_${ZFSPKGVER}_amd64.deb \
|
||||
zfsutils-linux_${ZFSPKGVER}_amd64.deb
|
||||
ZFS_DEBS= $(ZFS_DEB1) $(ZFS_DEB2)
|
||||
|
||||
DEBS=${SPL_DEBS} ${ZFS_DEBS}
|
||||
DEBS=${SPL_DEB} ${ZFS_DEBS}
|
||||
|
||||
all: ${DEBS}
|
||||
all: deb
|
||||
deb: ${DEBS}
|
||||
|
||||
.PHONY: dinstall
|
||||
dinstall: ${DEBS}
|
||||
dpkg -i ${DEBS}
|
||||
|
||||
.PHONY: submodule
|
||||
submodule:
|
||||
test -f "${ZFSSRC}/debian/changelog" || git submodule update --init
|
||||
test -f "${SPLSRC}/debian/changelog" || git submodule update --init
|
||||
|
||||
.PHONY: spl
|
||||
spl ${SPL_DEBS}: ${SPLSRC}
|
||||
spl: ${SPL_DEB}
|
||||
${SPL_DEB}: ${SPLSRC}
|
||||
rm -rf ${SPLDIR}
|
||||
tar xf ${SPLSRC}
|
||||
cp -a spl-debian-pve ${SPLDIR}/debian
|
||||
cd ${SPLDIR}; dpkg-buildpackage -b -uc -us
|
||||
mkdir ${SPLDIR}
|
||||
cp -a ${SPLSRC}/* ${SPLDIR}/
|
||||
mv ${SPLDIR}/debian/changelog ${SPLDIR}/debian/changelog.org
|
||||
cat spl-changelog.Debian ${SPLDIR}/debian/changelog.org > ${SPLDIR}/debian/changelog
|
||||
cd ${SPLDIR}; ln -s ../spl-patches patches
|
||||
cd ${SPLDIR}; quilt push -a
|
||||
cd ${SPLDIR}; rm -rf .pc ./patches
|
||||
cd ${SPLDIR}; dpkg-buildpackage -b -uc -us
|
||||
|
||||
.PHONY: zfs
|
||||
zfs ${ZFS_DEBS}: ${ZFSSRC}
|
||||
zfs: $(ZFS_DEBS)
|
||||
$(ZFS_DEB2): $(ZFS_DEB1)
|
||||
$(ZFS_DEB1): $(ZFSSRC)
|
||||
rm -rf ${ZFSDIR}
|
||||
tar xf ${ZFSSRC}
|
||||
cp -a zfs-debian-pve ${ZFSDIR}/debian
|
||||
cd ${ZFSDIR}; dpkg-buildpackage -b -uc -us
|
||||
|
||||
.PHONY: download
|
||||
download:
|
||||
#git clone https://github.com/zfsonlinux/pkg-spl.git
|
||||
#git clone https://github.com/zfsonlinux/pkg-zfs.git
|
||||
##git checkout master/ubuntu/precise
|
||||
##git checkout master/debian/wheezy
|
||||
rm spl-*.tar.gz
|
||||
rm zfs-*.tar.gz
|
||||
wget https://github.com/zfsonlinux/spl/archive/${SPLSRC}
|
||||
wget https://github.com/zfsonlinux/zfs/archive/${ZFSSRC}
|
||||
mkdir ${ZFSDIR}
|
||||
cp -a ${ZFSSRC}/* ${ZFSDIR}/
|
||||
mv ${ZFSDIR}/debian/changelog ${ZFSDIR}/debian/changelog.org
|
||||
cat zfs-changelog.Debian ${ZFSDIR}/debian/changelog.org > ${ZFSDIR}/debian/changelog
|
||||
cd ${ZFSDIR}; ln -s ../zfs-patches patches
|
||||
cd ${ZFSDIR}; quilt push -a
|
||||
cd ${ZFSDIR}; rm -rf .pc ./patches
|
||||
cd ${ZFSDIR}; dpkg-buildpackage -b -uc -us
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf *~ *.deb *.changes ${ZFSDIR} ${SPLDIR}
|
||||
rm -rf *~ *.deb *.changes *.buildinfo ${ZFSDIR} ${SPLDIR}
|
||||
|
||||
.PHONY: distclean
|
||||
distclean: clean
|
||||
@@ -69,27 +80,4 @@ distclean: clean
|
||||
|
||||
.PHONY: upload
|
||||
upload: ${DEBS}
|
||||
umount /pve/${RELEASE}; mount /pve/${RELEASE} -o rw
|
||||
mkdir -p /pve/${RELEASE}/extra
|
||||
rm -f /pve/${RELEASE}/extra/spl_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/spl-dkms_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/libnvpair1_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/libnvpair1-dbg_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/libuutil1_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/libuutil1-dbg_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/libzfs2_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/libzfs2-dbg_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/libzfs-dev_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/libzpool2_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/libzpool2-dbg_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/zfs_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/zfs-dkms_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/zfs-doc_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/zfs-initramfs_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/zfsutils_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/zfsutils-dbg_*.deb
|
||||
rm -f /pve/${RELEASE}/extra/Packages*
|
||||
cp ${DEBS} /pve/${RELEASE}/extra
|
||||
cd /pve/${RELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
|
||||
umount /pve/${RELEASE}; mount /pve/${RELEASE} -o ro
|
||||
|
||||
tar -cf - ${DEBS} | ssh repoman@repo.proxmox.com -- upload --product pve,pmg --dist stretch --arch amd64
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
Proxmox VE packaging for ZFS on Linux
|
||||
|
||||
This is based of code from:
|
||||
This is based on code from:
|
||||
|
||||
https://github.com/zfsonlinux/pkg-spl.git
|
||||
https://github.com/zfsonlinux/pkg-zfs.git
|
||||
|
||||
We merged updates from the precice branch into the older wheezy
|
||||
branch.
|
||||
We removed the dkms/modules related code, because we ship the
|
||||
modules with the kernel.
|
||||
|
||||
For licensing questions, see:
|
||||
|
||||
http://open-zfs.org/wiki/Talk:FAQ
|
||||
http://open-zfs.org/wiki/Talk:FAQ
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,144 @@
|
||||
spl-linux (0.7.11-pve1~bpo1) unstable; urgency=medium
|
||||
|
||||
* update SPL to 0.7.11
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 10 Sep 2018 15:47:06 +0200
|
||||
|
||||
spl-linux (0.7.9-pve1~bpo9) unstable; urgency=medium
|
||||
|
||||
* update SPL to 0.7.9
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 18 May 2018 13:49:09 +0200
|
||||
|
||||
spl-linux (0.7.8-pve1~bpo9) unstable; urgency=medium
|
||||
|
||||
* update SPL to 0.7.8 (no changes)
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 30 Apr 2018 13:47:22 +0200
|
||||
|
||||
spl-linux (0.7.7-pve1~bpo9) unstable; urgency=medium
|
||||
|
||||
* update SPL to 0.7.7
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 3 Apr 2018 14:28:35 +0200
|
||||
|
||||
spl-linux (0.7.6-pve1~bpo9) unstable; urgency=medium
|
||||
|
||||
* update SPL to 0.7.6
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 21 Feb 2018 09:47:54 +0100
|
||||
|
||||
spl-linux (0.7.4-pve1~bpo9) unstable; urgency=medium
|
||||
|
||||
* update SPL to 0.7.4
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 19 Dec 2017 12:52:42 +0100
|
||||
|
||||
spl-linux (0.7.3-pve1~bpo9) unstable; urgency=medium
|
||||
|
||||
* update spl to 0.7.3
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 6 Nov 2017 09:14:19 +0100
|
||||
|
||||
spl-linux (0.7.2-pve1~bpo90) unstable; urgency=medium
|
||||
|
||||
* update spl to 0.7.2
|
||||
|
||||
* clean up man pages
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 12 Oct 2017 13:33:04 +0200
|
||||
|
||||
spl-linux (0.6.5.11-pve10~bpo90) unstable; urgency=medium
|
||||
|
||||
* update spl to debian/0.6.5.11-1
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 27 Jul 2017 13:11:45 +0200
|
||||
|
||||
spl-linux (0.6.5.9-pve9~bpo90) unstable; urgency=medium
|
||||
|
||||
* rebuild for PVE 5.0 / Debian Stretch
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 10 Mar 2017 09:45:52 +0100
|
||||
|
||||
spl-linux (0.6.5.9-pve8~bpo80) unstable; urgency=medium
|
||||
|
||||
* update spl to debian/0.6.5.9-1
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 6 Feb 2017 12:39:35 +0100
|
||||
|
||||
spl-linux (0.6.5.8-pve7~bpo80) unstable; urgency=medium
|
||||
|
||||
* update spl to debian/0.6.5.8-2
|
||||
|
||||
* switch package upstream sources to Debian (Jessie)
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 12 Oct 2016 11:16:02 +0200
|
||||
|
||||
spl-linux (0.6.5.7-pve6~bpo80) unstable; urgency=medium
|
||||
|
||||
* update pkg-spl to jessie/0.6.5.7-5
|
||||
|
||||
* change package versioning to allow upgrades from PVE3/wheezy
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 28 Jun 2016 09:50:00 +0200
|
||||
|
||||
spl-linux (0.6.5-pve5~jessie) unstable; urgency=medium
|
||||
|
||||
* Update pkg-spl to jessie/0.6.5.6-3
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 15 Apr 2016 11:11:59 +0200
|
||||
|
||||
spl-linux (0.6.5-pve4~jessie) unstable; urgency=medium
|
||||
|
||||
* update to 0.6.5.6
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 30 Mar 2016 10:49:49 +0200
|
||||
|
||||
spl-linux (0.6.5-pve3~jessie) unstable; urgency=medium
|
||||
|
||||
* update to 0.6.5.4
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 14 Jan 2016 11:00:40 +0100
|
||||
|
||||
spl-linux (0.6.5-pve2~jessie) unstable; urgency=medium
|
||||
|
||||
* update to 0.6.5.3
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 04 Nov 2015 17:40:58 +0100
|
||||
|
||||
spl-linux (0.6.5-pve1~jessie) unstable; urgency=medium
|
||||
|
||||
* update to master/debian/jessie/0.6.5-1
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 21 Sep 2015 10:04:23 +0200
|
||||
|
||||
spl-linux (0.6.4-pve3~jessie) unstable; urgency=medium
|
||||
|
||||
* update to snapshot/debian/jessie/0.6.4-8-8ac6ff
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 24 Aug 2015 06:14:12 +0200
|
||||
|
||||
spl-linux (0.6.4-pve2~jessie) unstable; urgency=medium
|
||||
|
||||
* update to 0.6.4.2 (snapshot/debian/jessie/0.6.4-6-37d7cd)
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 21 Jul 2015 11:02:31 +0200
|
||||
|
||||
spl-linux (0.6.4-pve1~jessie) unstable; urgency=medium
|
||||
|
||||
* update to 0.6.4 (use upstream zol package definitions)
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 14 Apr 2015 10:17:26 +0200
|
||||
|
||||
spl-linux (0.6.3-pve1~jessie) unstable; urgency=medium
|
||||
|
||||
* recompile for jessie
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Sat, 28 Feb 2015 16:03:01 +0100
|
||||
|
||||
spl-linux (0.6.3-pve1~wheezy) unstable; urgency=low
|
||||
|
||||
* first version for Proxmox VE
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Sat, 10 Jan 2015 14:06:34 +0100
|
||||
|
||||
Submodule
+1
Submodule spl-debian added at e6b66753ff
@@ -1,6 +0,0 @@
|
||||
spl-linux (0.6.3-1~wheezy) unstable; urgency=low
|
||||
|
||||
* first version for Proxmox VE
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Sat, 10 Jan 2015 14:06:34 +0100
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
7
|
||||
@@ -1,34 +0,0 @@
|
||||
Source: spl-linux
|
||||
Section: kernel
|
||||
Priority: extra
|
||||
Maintainer: Proxmox Support Team <support@proxmox.com>
|
||||
Build-Depends: autotools-dev,
|
||||
autoconf,
|
||||
autogen,
|
||||
automake,
|
||||
debhelper (>= 8),
|
||||
dh-autoreconf,
|
||||
dkms (>= 2.2.0.2),
|
||||
libtool,
|
||||
Standards-Version: 3.9.5
|
||||
Homepage: http://www.zfsonlinux.org/
|
||||
|
||||
Package: spl-dkms
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends}, dkms (>= 2.2.0.2), file, lsb-release
|
||||
Recommends: spl
|
||||
Description: Solaris Porting Layer kernel modules for Linux
|
||||
The Solaris Porting Layer (SPL) is a Linux kernel module which provides many of
|
||||
the Solaris kernel APIs. This shim layer makes it possible to run Solaris
|
||||
kernel code in the Linux kernel with relatively minimal modification.
|
||||
.
|
||||
The Solaris Porting LAyer Tests (SPLAT) is a Linux kernel module which provides
|
||||
a testing harness for the SPL module.
|
||||
|
||||
Package: spl
|
||||
Architecture: any
|
||||
Conflicts: spl-dev
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Solaris Porting Layer utilities for Linux
|
||||
This package provides the userspace utilities for the SPL and SPLAT Linux
|
||||
kernel modules.
|
||||
@@ -1,147 +0,0 @@
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: Solaris Porting Layer for Linux
|
||||
Upstream-Contact: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Source: https://github.com/zfsonlinux/zfs/
|
||||
Disclaimer:
|
||||
This work was produced at the Lawrence Livermore National Laboratory
|
||||
(LLNL) under Contract No. DE-AC52-07NA27344 (Contract 44) between
|
||||
the U.S. Department of Energy (DOE) and Lawrence Livermore National
|
||||
Security, LLC (LLNS) for the operation of LLNL.
|
||||
.
|
||||
This work was prepared as an account of work sponsored by an agency of
|
||||
the United States Government. Neither the United States Government nor
|
||||
Lawrence Livermore National Security, LLC nor any of their employees,
|
||||
makes any warranty, express or implied, or assumes any liability or
|
||||
responsibility for the accuracy, completeness, or usefulness of any
|
||||
information, apparatus, product, or process disclosed, or represents
|
||||
that its use would not infringe privately-owned rights.
|
||||
.
|
||||
Reference herein to any specific commercial products, process, or
|
||||
services by trade name, trademark, manufacturer or otherwise does
|
||||
not necessarily constitute or imply its endorsement, recommendation,
|
||||
or favoring by the United States Government or Lawrence Livermore
|
||||
National Security, LLC. The views and opinions of authors expressed
|
||||
herein do not necessarily state or reflect those of the Untied States
|
||||
Government or Lawrence Livermore National Security, LLC, and shall
|
||||
not be used for advertising or product endorsement purposes.
|
||||
|
||||
Files: *
|
||||
Copyright: Lawrence Livermore National Security, LLC.
|
||||
The Regents of the University of California
|
||||
License: GPL-2+
|
||||
|
||||
Files: config/config.guess
|
||||
Copyright: Free Software Foundation, Inc.
|
||||
License: GPL-2+
|
||||
|
||||
Files: config/config.sub
|
||||
Copyright: Free Software Foundation, Inc.
|
||||
License: GPL-2+
|
||||
|
||||
Files: config/deb.am
|
||||
Copyright: Lawrence Livermore National Security, LLC.
|
||||
License: GPL-2+
|
||||
|
||||
Files: config/depcomp
|
||||
Copyright: Free Software Foundation, Inc.
|
||||
License: GPL-2+
|
||||
|
||||
Files: config/install-sh
|
||||
Copyright: 1994 X Consortium
|
||||
License:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
.
|
||||
Except as contained in this notice, the name of the X Consortium shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
ings in this Software without prior written authorization from the X Consor-
|
||||
tium.
|
||||
|
||||
Files: config/ltmain.sh
|
||||
Copyright: Free Software Foundation, Inc.
|
||||
License: GPL-2+
|
||||
|
||||
Files: config/missing
|
||||
Copyright: Free Software Foundation, Inc.
|
||||
License: GPL-2+
|
||||
|
||||
Files: config/tgz.am
|
||||
Copyright: Lawrence Livermore National Security, LLC.
|
||||
License: GPL-2+
|
||||
|
||||
Files: debian/*
|
||||
Copyright: Darik Horn <dajhorn@vanadac.com>
|
||||
Source: https://github.com/dajhorn/pkg-spl/
|
||||
License: GPL-2+
|
||||
|
||||
Files: include/linux/zlib_compat.h
|
||||
Copyright: Lawrence Livermore National Security, LLC.
|
||||
License: GPL-2+
|
||||
|
||||
Files: include/rpc/xdr.h
|
||||
Copyright: Sun Microsystems, Inc.
|
||||
License: GPL-2+
|
||||
|
||||
Files: include/sys/extdirent.h
|
||||
Copyright: Lawrence Livermore National Security, LLC.
|
||||
License: GPL-2+
|
||||
|
||||
Files: include/sys/fcntl.h
|
||||
Copyright: Lawrence Livermore National Security, LLC.
|
||||
License: GPL-2+
|
||||
|
||||
Files: include/sys/idmap.h
|
||||
Copyright: Lawrence Livermore National Security, LLC.
|
||||
License: GPL-2+
|
||||
|
||||
Files: include/sys/tsd.h
|
||||
Copyright: Lawrence Livermore National Security, LLC.
|
||||
License: GPL-2+
|
||||
|
||||
Files: include/sys/zmod.h
|
||||
Copyright: Jean-loup Gailly
|
||||
Mark Adler
|
||||
License:
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
.
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Files: module/spl/spl-tsd.c
|
||||
Copyright: Lawrence Livermore National Security, LLC.
|
||||
License: GPL-2+
|
||||
|
||||
Files: module/spl/spl-xdr.c
|
||||
Copyright: Sun Microsystems, Inc.
|
||||
License: GPL-2+
|
||||
|
||||
Files: module/splat/splat-linux.c
|
||||
Copyright: Lawrence Livermore National Security, LLC.
|
||||
License: GPL-2+
|
||||
@@ -1,35 +0,0 @@
|
||||
AUTOINSTALL="yes"
|
||||
PACKAGE_NAME="spl"
|
||||
PACKAGE_VERSION="#MODULE_VERSION#"
|
||||
PRE_BUILD="configure
|
||||
--prefix=/usr
|
||||
--with-config=kernel
|
||||
--with-linux=$(case `lsb_release -is` in
|
||||
(Debian)
|
||||
if [ -e ${kernel_source_dir/%build/source} ]
|
||||
then
|
||||
echo ${kernel_source_dir/%build/source}
|
||||
else
|
||||
# This is a kpkg exception for Proxmox 2.0
|
||||
echo ${kernel_source_dir}
|
||||
fi
|
||||
;;
|
||||
(*)
|
||||
echo ${kernel_source_dir}
|
||||
;;
|
||||
esac)
|
||||
--with-linux-obj=${kernel_source_dir}
|
||||
"
|
||||
POST_INSTALL="cp
|
||||
${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/spl_config.h
|
||||
${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/module/Module.symvers
|
||||
${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/${kernelver}/${arch}/
|
||||
"
|
||||
REMAKE_INITRD="no"
|
||||
MAKE[0]="make"
|
||||
BUILT_MODULE_NAME[0]="spl"
|
||||
BUILT_MODULE_LOCATION[0]="module/spl/"
|
||||
DEST_MODULE_LOCATION[0]="/extra/spl/spl"
|
||||
BUILT_MODULE_NAME[1]="splat"
|
||||
BUILT_MODULE_LOCATION[1]="module/splat/"
|
||||
DEST_MODULE_LOCATION[1]="/extra/splat/splat"
|
||||
@@ -1,28 +0,0 @@
|
||||
From 7559daf38acc293474d3d2a13ecf746bc7507a11 Mon Sep 17 00:00:00 2001
|
||||
From: Darik Horn <dajhorn@vanadac.com>
|
||||
Date: Tue, 11 Oct 2011 18:32:58 -0500
|
||||
Subject: [PATCH 1/2] Revert "Remove /etc/hostid missing warning"
|
||||
|
||||
This reverts commit 6b3b569df30d13ed7bbbff877cffc71290a52f12.
|
||||
---
|
||||
module/spl/spl-generic.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: b/module/spl/spl-generic.c
|
||||
===================================================================
|
||||
--- a/module/spl/spl-generic.c
|
||||
+++ b/module/spl/spl-generic.c
|
||||
@@ -471,8 +471,12 @@
|
||||
|
||||
file = kobj_open_file(spl_hostid_path);
|
||||
|
||||
- if (file == (struct _buf *)-1)
|
||||
+ if (file == (struct _buf *)-1) {
|
||||
+ printk(KERN_WARNING
|
||||
+ "SPL: The %s file is not found.\n",
|
||||
+ spl_hostid_path);
|
||||
return -1;
|
||||
+ }
|
||||
|
||||
result = kobj_get_filesize(file, &size);
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
0001-Revert-Remove-etc-hostid-missing-warning.patch
|
||||
@@ -1,63 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
NAME := $(shell awk '$$1 == "Name:" { print $$2; }' META)
|
||||
VERSION := $(shell dpkg-parsechangelog \
|
||||
| awk '$$1 == "Version:" { print $$2; }' | cut -d- -f1)
|
||||
REVISION := $(shell dpkg-parsechangelog \
|
||||
| awk '$$1 == "Version:" { print $$2; }' | cut -d- -f2-)
|
||||
|
||||
%:
|
||||
dh $@ --with autoreconf
|
||||
|
||||
override_dh_auto_configure:
|
||||
@# Embed the downstream version in the module.
|
||||
@sed \
|
||||
-e 's/^Version:.*/Version: $(VERSION)/' \
|
||||
-e 's/^Release:.*/Release: $(REVISION)/' \
|
||||
-i.orig META
|
||||
|
||||
@# Create the makefiles and configure script.
|
||||
./autogen.sh
|
||||
|
||||
@# Build the userland, but don't build the kernel modules.
|
||||
dh_auto_configure -- --with-config=user
|
||||
|
||||
override_dh_auto_test:
|
||||
# scripts/check.sh tries insmod and rmmod, so it cannot
|
||||
# run in an unprivileged build environment.
|
||||
|
||||
override_dh_auto_install:
|
||||
@# Install the utilities.
|
||||
make install DESTDIR='$(CURDIR)/debian/tmp'
|
||||
|
||||
@# Create a dummy hostid file for the zfs-initramfs package.
|
||||
@# NB: Commentary in the spl.postinst script.
|
||||
mkdir -p '$(CURDIR)/debian/tmp/etc/'
|
||||
/usr/bin/printf '\xFF\xFF\xFF\xFF' >'$(CURDIR)/debian/tmp/etc/hostid'
|
||||
|
||||
@# Get a bare copy of the source code.
|
||||
@# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree.
|
||||
make distdir
|
||||
|
||||
@# Delete boilerplate to satisfy the lintian extra-license-file check.
|
||||
rm '$(CURDIR)/$(NAME)-$(VERSION)/COPYING'
|
||||
|
||||
@# This shunt allows DKMS to install the Module.symvers and spl_config.h
|
||||
@# files to the ${dkms_tree} area through the POST_INSTALL directive.
|
||||
echo '#!/bin/sh' >'$(CURDIR)/$(NAME)-$(VERSION)/cp'
|
||||
echo 'cp "$$@"' >>'$(CURDIR)/$(NAME)-$(VERSION)/cp'
|
||||
chmod 755 '$(CURDIR)/$(NAME)-$(VERSION)/cp'
|
||||
|
||||
# Install the DKMS source.
|
||||
mkdir -p '$(CURDIR)/debian/tmp/usr/src/'
|
||||
mv '$(CURDIR)/$(NAME)-$(VERSION)' '$(CURDIR)/debian/tmp/usr/src/'
|
||||
|
||||
# Install the dkms.conf file.
|
||||
dh_dkms -V $(VERSION)
|
||||
|
||||
override_dh_auto_clean:
|
||||
dh_auto_clean
|
||||
@if test -e META.orig; then mv META.orig META; fi
|
||||
|
||||
%:
|
||||
dh $@
|
||||
@@ -1,3 +0,0 @@
|
||||
usr/src/spl-*/AUTHORS usr/share/doc/spl-dkms/
|
||||
usr/src/spl-*/DISCLAIMER usr/share/doc/spl-dkms/
|
||||
usr/src
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
#DEBHELPER#
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
#DEBHELPER#
|
||||
@@ -1,3 +0,0 @@
|
||||
etc/hostid
|
||||
usr/sbin
|
||||
usr/share/man
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# The hostname and hostid of the last system to access a ZFS pool are stored in
|
||||
# the ZFS pool itself. A pool is foreign if, during `zpool import`, the
|
||||
# current hostname and hostid are different than the stored values thereof.
|
||||
#
|
||||
# The hostname and hostid on Solaris are intrinsic, but they are not on Linux,
|
||||
# so the spl kernel module invokes /bin/hostname and /usr/bin/hostid from the
|
||||
# userland in its initialization routine.
|
||||
#
|
||||
# However, these two indentifiers are usually undefined in the Linux initramfs
|
||||
# environment, so the /etc/hostname and /etc/hostid files must be added to the
|
||||
# initrd. Things like a DHCP lease change can affect the hostid too.
|
||||
#
|
||||
# ZFS requires stable values for hostname and hostid, but basic Linux systems
|
||||
# do not. The hostid is therefore stabilized by creating the /etc/hostid file
|
||||
# in the regular environment if it does not already exist. An undefined
|
||||
# hostname is usuallly stable.
|
||||
#
|
||||
# Neither /etc/hostname nor /etc/hostid are controlled configuration files in
|
||||
# Debian distributions, but the spl package nevertheless installs a dummy
|
||||
# /etc/hostid file that contains the HW_INVALID_HOSTID sentinal value so that
|
||||
# the package manager will track it.
|
||||
|
||||
# This result is always an eight-character hexadecimal number sans the 0x
|
||||
# prefix. Remember that /usr/bin/hostid generates a value if the /etc/hostid
|
||||
# file doesn't exist or is malformed.
|
||||
HOSTID=$(hostid)
|
||||
|
||||
if [ -f /etc/hostid -a "0x$HOSTID" != "0xffffffff" ]
|
||||
then
|
||||
# This system already has a stable hostid.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Truncate the dummy file and generate the actual system hostid.
|
||||
: >/etc/hostid
|
||||
HOSTID=$(hostid)
|
||||
|
||||
# @TODO: Check whether this method is appropriate for gethostid(2) on big
|
||||
# endian systems. (Update: It isn't.)
|
||||
#
|
||||
# The /etc/hostname file on i386 and amd64 systems must be a little endian
|
||||
# integer of exacly four bytes. Regardless, a consistent hostid is more
|
||||
# important than a correct byte order here.
|
||||
|
||||
# Conveniences like a ${HOSTID:$ii:2} substring range or a `sed` one-liner
|
||||
# are prohibited here because this file must be dash-compatible by policy.
|
||||
AA=$(echo $HOSTID | cut -b 1,2)
|
||||
BB=$(echo $HOSTID | cut -b 3,4)
|
||||
CC=$(echo $HOSTID | cut -b 5,6)
|
||||
DD=$(echo $HOSTID | cut -b 7,8)
|
||||
|
||||
# Invoke the external printf because the dash builtin lacks the byte format.
|
||||
"$(which printf)" "\x$DD\x$CC\x$BB\x$AA" >"/etc/hostid"
|
||||
|
||||
# @ASSERT: [ "$HOSTID" = "$(hostid)" ]
|
||||
|
||||
#DEBHELPER#
|
||||
@@ -0,0 +1,170 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
|
||||
Date: Wed, 12 Oct 2016 10:57:39 +0200
|
||||
Subject: [PATCH] remove DKMS and module build
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
|
||||
---
|
||||
debian/control | 1 -
|
||||
debian/control.in | 31 -------------------------
|
||||
debian/rules | 68 +------------------------------------------------------
|
||||
3 files changed, 1 insertion(+), 99 deletions(-)
|
||||
|
||||
diff --git a/debian/control b/debian/control
|
||||
index 07db14a..01387e5 100644
|
||||
--- a/debian/control
|
||||
+++ b/debian/control
|
||||
@@ -8,7 +8,6 @@ Build-Depends: autogen,
|
||||
autotools-dev,
|
||||
debhelper (>= 9),
|
||||
dh-autoreconf,
|
||||
- dkms (>> 2.2.0.2-1~),
|
||||
libtool
|
||||
Standards-Version: 4.1.2
|
||||
Homepage: http://www.zfsonlinux.org/
|
||||
diff --git a/debian/control.in b/debian/control.in
|
||||
index 91242a1..5fd81aa 100644
|
||||
--- a/debian/control.in
|
||||
+++ b/debian/control.in
|
||||
@@ -8,47 +8,16 @@ Build-Depends: autogen,
|
||||
autotools-dev,
|
||||
debhelper (>= 9),
|
||||
dh-autoreconf,
|
||||
- dkms (>> 2.2.0.2-1~),
|
||||
libtool
|
||||
Standards-Version: 4.1.2
|
||||
Homepage: http://www.zfsonlinux.org/
|
||||
Vcs-Git: git@salsa.debian.org:zfsonlinux-team/spl.git
|
||||
Vcs-Browser: https://salsa.debian.org/zfsonlinux-team/spl
|
||||
|
||||
-Package: spl-dkms
|
||||
-Architecture: all
|
||||
-Depends: dkms (>> 2.2.1.0),
|
||||
- file,
|
||||
- libc-dev,
|
||||
- libelf-dev,
|
||||
- lsb-release,
|
||||
- ${misc:Depends}
|
||||
-Suggests: spl (>= ${source:Upstream-Version}),
|
||||
- @LINUX_COMPAT@
|
||||
-Conflicts: spl (<< 0.7.9~)
|
||||
-Provides: spl-modules
|
||||
-Description: Solaris Porting Layer kernel modules for Linux
|
||||
- The Solaris Porting Layer (SPL) is a Linux kernel module which provides
|
||||
- many of the Solaris kernel APIs. This shim layer makes it possible to
|
||||
- run Solaris kernel code in the Linux kernel with relatively minimal
|
||||
- modification. The Solaris Porting LAyer Tests (SPLAT) is a Linux kernel
|
||||
- module which provides a testing harness for the SPL module.
|
||||
- .
|
||||
- SPL can be particularly useful when you want to track upstream Illumos
|
||||
- (or any other OpenSolaris fork) development closely and don't want the
|
||||
- overhead of maintaining a large patch which converts Solaris primitives
|
||||
- to Linux primitives.
|
||||
- .
|
||||
- This package contains the source code for the SPL and SPLAT Linux kernel
|
||||
- modules, which can be used with DKMS, so that local kernel modules are
|
||||
- automatically built and installed every time the kernel packages are
|
||||
- upgraded.
|
||||
-
|
||||
Package: spl
|
||||
Architecture: linux-any
|
||||
Conflicts: spl-dev, splat
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
-Recommends: spl-modules | spl-dkms
|
||||
Description: Solaris Porting Layer user-space utilities for Linux
|
||||
The Solaris Porting Layer (SPL) is a Linux kernel module which provides
|
||||
many of the Solaris kernel APIs. This shim layer makes it possible to
|
||||
diff --git a/debian/rules b/debian/rules
|
||||
index 3a12abc..8dca8fd 100755
|
||||
--- a/debian/rules
|
||||
+++ b/debian/rules
|
||||
@@ -14,12 +14,8 @@ ifndef KVERS
|
||||
KVERS=$(shell uname -r)
|
||||
endif
|
||||
|
||||
-non_epoch_version=$(shell echo $(KVERS) | perl -pe 's/^\d+://')
|
||||
-PACKAGE=spl
|
||||
-pmodules = $(PACKAGE)-modules-$(non_epoch_version)
|
||||
-
|
||||
%:
|
||||
- dh $@ --with dkms,autoreconf --parallel
|
||||
+ dh $@ --with autoreconf --parallel
|
||||
|
||||
override_dh_auto_configure:
|
||||
sed "s/@LINUX_COMPAT@/linux-libc-dev \(<< $(shell debian/get_next.sh)\)/" debian/control.in > debian/control
|
||||
@@ -45,69 +41,7 @@ override_dh_auto_install:
|
||||
@# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree.
|
||||
$(MAKE) distdir
|
||||
|
||||
- @# This shunt allows DKMS to install the Module.symvers and spl_config.h
|
||||
- @# files to the ${dkms_tree} area through the POST_INSTALL directive.
|
||||
- echo '#!/bin/sh' >'$(CURDIR)/$(NAME)-$(VERSION)/cp'
|
||||
- echo 'cp "$$@"' >>'$(CURDIR)/$(NAME)-$(VERSION)/cp'
|
||||
- chmod 755 '$(CURDIR)/$(NAME)-$(VERSION)/cp'
|
||||
-
|
||||
- # Install the DKMS source.
|
||||
- mkdir -p '$(CURDIR)/debian/tmp/usr/src/'
|
||||
- mv '$(CURDIR)/$(NAME)-$(VERSION)' '$(CURDIR)/debian/tmp/usr/src/'
|
||||
-
|
||||
-override_dh_dkms:
|
||||
- dh_dkms -V $(VERSION)
|
||||
-
|
||||
override_dh_auto_clean:
|
||||
dh_auto_clean
|
||||
@if test -e META.orig; then mv META.orig META; fi
|
||||
sed "s/@LINUX_COMPAT@/linux-libc-dev \(<< $(shell debian/get_next.sh)\)/" debian/control.in > debian/control
|
||||
-
|
||||
-# ------------
|
||||
-
|
||||
-override_dh_prep-deb-files:
|
||||
- for templ in $(wildcard $(CURDIR)/debian/*_KVERS_*.in); do \
|
||||
- sed -e 's/##KVERS##/$(KVERS)/g ; s/#KVERS#/$(KVERS)/g ; s/_KVERS_/$(KVERS)/g ; s/##KDREV##/$(KDREV)/g ; s/#KDREV#/$(KDREV)/g ; s/_KDREV_/$(KDREV)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g' \
|
||||
- < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \
|
||||
- done
|
||||
- sed -e 's/##KVERS##/$(KVERS)/g ; s/#KVERS#/$(KVERS)/g ; s/_KVERS_/$(KVERS)/g ; s/##KDREV##/$(KDREV)/g ; s/#KDREV#/$(KDREV)/g ; s/_KDREV_/$(KDREV)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g' \
|
||||
- < debian/control.modules.in > debian/control
|
||||
-
|
||||
-override_dh_configure_modules: override_dh_configure_modules_stamp
|
||||
-override_dh_configure_modules_stamp:
|
||||
- ./configure --with-config=kernel --with-linux=$(KSRC) \
|
||||
- --with-linux-obj=$(KOBJ) \
|
||||
- --disable-debug-kmem
|
||||
- touch override_dh_configure_modules_stamp
|
||||
-
|
||||
-override_dh_binary-modules-udeb: override_dh_prep-deb-files override_dh_configure_modules
|
||||
- dh_testdir
|
||||
- dh_testroot
|
||||
- dh_prep
|
||||
-
|
||||
- $(MAKE) -C $(CURDIR)/module modules
|
||||
-
|
||||
- dh_installdirs -p${pmodules}-di
|
||||
- dh_install -p${pmodules}-di
|
||||
- dh_gencontrol -p${pmodules}-di
|
||||
-
|
||||
- dh_builddeb -p${pmodules}-di
|
||||
-
|
||||
-override_dh_binary-modules: override_dh_prep-deb-files override_dh_configure_modules
|
||||
- dh_testdir
|
||||
- dh_testroot
|
||||
- dh_prep
|
||||
-
|
||||
- $(MAKE) -C $(CURDIR)/module modules
|
||||
-
|
||||
- dh_installdocs -p${pmodules}
|
||||
- dh_install -p${pmodules}
|
||||
- dh_installchangelogs -p${pmodules}
|
||||
- dh_compress -p${pmodules}
|
||||
- dh_strip -p${pmodules}
|
||||
- dh_fixperms -p${pmodules}
|
||||
- dh_installdeb -p${pmodules}
|
||||
- dh_gencontrol -p${pmodules}
|
||||
- dh_md5sums -p${pmodules}
|
||||
-
|
||||
- dh_builddeb -p${pmodules}
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Date: Sun, 12 Aug 2018 18:22:54 -0400
|
||||
Subject: [PATCH] Linux 4.18 compat: inode timespec -> timespec64
|
||||
|
||||
Commit torvalds/linux@95582b0 changes the inode i_atime, i_mtime,
|
||||
and i_ctime members form timespec's to timespec64's to make them
|
||||
2038 safe. As part of this change the current_time() function was
|
||||
also updated to return the timespec64 type.
|
||||
|
||||
Resolve this issue by introducing a new inode_timespec_t type which
|
||||
is defined to match the timespec type used by the inode. It should
|
||||
be used when working with inode timestamps to ensure matching types.
|
||||
|
||||
The timestruc_t type under Illumos was used in a similar fashion but
|
||||
was specified to always be a timespec_t. Rather than incorrectly
|
||||
define this type all timespec_t types have been replaced by the new
|
||||
inode_timespec_t type.
|
||||
|
||||
Finally, the kernel and user space 'sys/time.h' headers were aligned
|
||||
with each other. They define as appropriate for the context several
|
||||
constants as macros and include static inline implementation of
|
||||
gethrestime(), gethrestime_sec(), and gethrtime().
|
||||
|
||||
Reviewed-by: Chunwei Chen <tuxoko@gmail.com>
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Closes #7643
|
||||
Backported-by: Richard Yao <ryao@gentoo.org>
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
config/kernel-inode-times.m4 | 25 +++++++++++++++++++++++++
|
||||
config/spl-build.m4 | 1 +
|
||||
include/sys/condvar.h | 1 +
|
||||
include/sys/time.h | 25 +++++++++++++++++++------
|
||||
include/sys/types.h | 3 ---
|
||||
include/sys/vnode.h | 6 +++---
|
||||
6 files changed, 49 insertions(+), 12 deletions(-)
|
||||
create mode 100644 config/kernel-inode-times.m4
|
||||
|
||||
diff --git a/config/kernel-inode-times.m4 b/config/kernel-inode-times.m4
|
||||
new file mode 100644
|
||||
index 0000000..3a6acd8
|
||||
--- /dev/null
|
||||
+++ b/config/kernel-inode-times.m4
|
||||
@@ -0,0 +1,25 @@
|
||||
+dnl #
|
||||
+dnl # 4.18 API change
|
||||
+dnl # i_atime, i_mtime, and i_ctime changed from timespec to timespec64.
|
||||
+dnl #
|
||||
+AC_DEFUN([SPL_AC_KERNEL_INODE_TIMES], [
|
||||
+ AC_MSG_CHECKING([whether inode->i_*time's are timespec64])
|
||||
+ tmp_flags="$EXTRA_KCFLAGS"
|
||||
+ EXTRA_KCFLAGS="-Werror"
|
||||
+ SPL_LINUX_TRY_COMPILE([
|
||||
+ #include <linux/fs.h>
|
||||
+ ],[
|
||||
+ struct inode ip;
|
||||
+ struct timespec ts;
|
||||
+
|
||||
+ memset(&ip, 0, sizeof(ip));
|
||||
+ ts = ip.i_mtime;
|
||||
+ ],[
|
||||
+ AC_MSG_RESULT(no)
|
||||
+ ],[
|
||||
+ AC_MSG_RESULT(yes)
|
||||
+ AC_DEFINE(HAVE_INODE_TIMESPEC64_TIMES, 1,
|
||||
+ [inode->i_*time's are timespec64])
|
||||
+ ])
|
||||
+ EXTRA_KCFLAGS="$tmp_flags"
|
||||
+])
|
||||
diff --git a/config/spl-build.m4 b/config/spl-build.m4
|
||||
index 5c6c02a..0dc5be8 100644
|
||||
--- a/config/spl-build.m4
|
||||
+++ b/config/spl-build.m4
|
||||
@@ -43,6 +43,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
|
||||
SPL_AC_2ARGS_VFS_GETATTR
|
||||
SPL_AC_USLEEP_RANGE
|
||||
SPL_AC_KMEM_CACHE_ALLOCFLAGS
|
||||
+ SPL_AC_KERNEL_INODE_TIMES
|
||||
SPL_AC_WAIT_ON_BIT
|
||||
SPL_AC_INODE_LOCK
|
||||
SPL_AC_GROUP_INFO_GID
|
||||
diff --git a/include/sys/condvar.h b/include/sys/condvar.h
|
||||
index 5fcc906..ce3149a 100644
|
||||
--- a/include/sys/condvar.h
|
||||
+++ b/include/sys/condvar.h
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/callo.h>
|
||||
+#include <sys/time.h>
|
||||
|
||||
/*
|
||||
* The kcondvar_t struct is protected by mutex taken externally before
|
||||
diff --git a/include/sys/time.h b/include/sys/time.h
|
||||
index ddda6de..59557af 100644
|
||||
--- a/include/sys/time.h
|
||||
+++ b/include/sys/time.h
|
||||
@@ -52,15 +52,28 @@
|
||||
#define NSEC2SEC(n) ((n) / (NANOSEC / SEC))
|
||||
#define SEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / SEC))
|
||||
|
||||
+typedef longlong_t hrtime_t;
|
||||
+typedef struct timespec timespec_t;
|
||||
+
|
||||
static const int hz = HZ;
|
||||
|
||||
#define TIMESPEC_OVERFLOW(ts) \
|
||||
((ts)->tv_sec < TIME_MIN || (ts)->tv_sec > TIME_MAX)
|
||||
|
||||
+#if defined(HAVE_INODE_TIMESPEC64_TIMES)
|
||||
+typedef struct timespec64 inode_timespec_t;
|
||||
+#else
|
||||
+typedef struct timespec inode_timespec_t;
|
||||
+#endif
|
||||
+
|
||||
static inline void
|
||||
-gethrestime(timestruc_t *now)
|
||||
-{
|
||||
- *now = current_kernel_time();
|
||||
+gethrestime(inode_timespec_t *ts)
|
||||
+ {
|
||||
+#if defined(HAVE_INODE_TIMESPEC64_TIMES)
|
||||
+ *ts = current_kernel_time64();
|
||||
+#else
|
||||
+ *ts = current_kernel_time();
|
||||
+#endif
|
||||
}
|
||||
|
||||
static inline time_t
|
||||
@@ -74,9 +87,9 @@ gethrestime_sec(void)
|
||||
static inline hrtime_t
|
||||
gethrtime(void)
|
||||
{
|
||||
- struct timespec now;
|
||||
- getrawmonotonic(&now);
|
||||
- return (((hrtime_t)now.tv_sec * NSEC_PER_SEC) + now.tv_nsec);
|
||||
+ struct timespec ts;
|
||||
+ getrawmonotonic(&ts);
|
||||
+ return (((hrtime_t)ts.tv_sec * NSEC_PER_SEC) + ts.tv_nsec);
|
||||
}
|
||||
|
||||
#endif /* _SPL_TIME_H */
|
||||
diff --git a/include/sys/types.h b/include/sys/types.h
|
||||
index 2fe63b7..b958462 100644
|
||||
--- a/include/sys/types.h
|
||||
+++ b/include/sys/types.h
|
||||
@@ -49,9 +49,6 @@ typedef long long offset_t;
|
||||
typedef struct task_struct kthread_t;
|
||||
typedef struct task_struct proc_t;
|
||||
typedef short pri_t;
|
||||
-typedef struct timespec timestruc_t; /* definition per SVr4 */
|
||||
-typedef struct timespec timespec_t;
|
||||
-typedef longlong_t hrtime_t;
|
||||
typedef unsigned short ushort_t;
|
||||
typedef u_longlong_t len_t;
|
||||
typedef longlong_t diskaddr_t;
|
||||
diff --git a/include/sys/vnode.h b/include/sys/vnode.h
|
||||
index 0ed4794..87f12d6 100644
|
||||
--- a/include/sys/vnode.h
|
||||
+++ b/include/sys/vnode.h
|
||||
@@ -129,9 +129,9 @@ typedef struct vattr {
|
||||
long va_nodeid; /* node # */
|
||||
uint32_t va_nlink; /* # links */
|
||||
uint64_t va_size; /* file size */
|
||||
- struct timespec va_atime; /* last acc */
|
||||
- struct timespec va_mtime; /* last mod */
|
||||
- struct timespec va_ctime; /* last chg */
|
||||
+ inode_timespec_t va_atime; /* last acc */
|
||||
+ inode_timespec_t va_mtime; /* last mod */
|
||||
+ inode_timespec_t va_ctime; /* last chg */
|
||||
dev_t va_rdev; /* dev */
|
||||
uint64_t va_nblocks; /* space used */
|
||||
uint32_t va_blksize; /* block size */
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tony Hutter <hutter2@llnl.gov>
|
||||
Date: Wed, 15 Aug 2018 09:39:55 -0700
|
||||
Subject: [PATCH] Add pool state /proc entry, "SUSPENDED" pools (SPL)
|
||||
|
||||
(This is the SPL backported code from f0ed6c744)
|
||||
|
||||
1. Add a proc entry to display the pool's state:
|
||||
|
||||
$ cat /proc/spl/kstat/zfs/tank/state
|
||||
ONLINE
|
||||
|
||||
This is done without using the spa config locks, so it will
|
||||
never hang.
|
||||
|
||||
2. Fix 'zpool status' and 'zpool list -o health' output to print
|
||||
"SUSPENDED" instead of "ONLINE" for suspended pools.
|
||||
|
||||
Reviewed-by: Olaf Faaland <faaland1@llnl.gov>
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
|
||||
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
|
||||
Closes #7331
|
||||
Closes #7563
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
include/sys/kstat.h | 2 +-
|
||||
module/spl/spl-kstat.c | 4 ++--
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/include/sys/kstat.h b/include/sys/kstat.h
|
||||
index 2018019..b8aa7ed 100644
|
||||
--- a/include/sys/kstat.h
|
||||
+++ b/include/sys/kstat.h
|
||||
@@ -72,7 +72,7 @@
|
||||
#define KSTAT_FLAG_UNSUPPORTED \
|
||||
(KSTAT_FLAG_VAR_SIZE | KSTAT_FLAG_WRITABLE | \
|
||||
KSTAT_FLAG_PERSISTENT | KSTAT_FLAG_DORMANT)
|
||||
-
|
||||
+#define KSTAT_FLAG_NO_HEADERS 0x80
|
||||
|
||||
#define KS_MAGIC 0x9d9d9d9d
|
||||
|
||||
diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c
|
||||
index 6970fcc..f9b9015 100644
|
||||
--- a/module/spl/spl-kstat.c
|
||||
+++ b/module/spl/spl-kstat.c
|
||||
@@ -388,7 +388,8 @@ kstat_seq_start(struct seq_file *f, loff_t *pos)
|
||||
|
||||
ksp->ks_snaptime = gethrtime();
|
||||
|
||||
- if (!n && kstat_seq_show_headers(f))
|
||||
+ if (!(ksp->ks_flags & KSTAT_FLAG_NO_HEADERS) && !n &&
|
||||
+ kstat_seq_show_headers(f))
|
||||
return (NULL);
|
||||
|
||||
if (n >= ksp->ks_ndata)
|
||||
@@ -538,7 +539,6 @@ __kstat_create(const char *ks_module, int ks_instance, const char *ks_name,
|
||||
ASSERT(ks_module);
|
||||
ASSERT(ks_instance == 0);
|
||||
ASSERT(ks_name);
|
||||
- ASSERT(!(ks_flags & KSTAT_FLAG_UNSUPPORTED));
|
||||
|
||||
if ((ks_type == KSTAT_TYPE_INTR) || (ks_type == KSTAT_TYPE_IO))
|
||||
ASSERT(ks_ndata == 1);
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tony Hutter <hutter2@llnl.gov>
|
||||
Date: Wed, 15 Aug 2018 11:58:54 -0700
|
||||
Subject: [PATCH] Add rwsem_tryupgrade for 4.9.20-rt16 kernel (SPL)
|
||||
|
||||
(This is the SPL backported code from 11d0525cb)
|
||||
|
||||
The RT rwsem implementation was changed to allow multiple readers
|
||||
as of the 4.9.20-rt16 patch set. This results in a build failure
|
||||
because the existing implementation was forced to directly access
|
||||
the rwsem structure which has changed.
|
||||
|
||||
While this could be accommodated by adding additional compatibility
|
||||
code. This patch resolves the build issue by simply assuming the
|
||||
rwsem can never be upgraded. This functionality is a performance
|
||||
optimization and all callers must already handle this case.
|
||||
|
||||
Converting the last remaining use of __SPIN_LOCK_UNLOCKED to
|
||||
spin_lock_init() was additionally required to get a clean build.
|
||||
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Closes #7589
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
include/sys/isa_defs.h | 8 ++++++++
|
||||
include/sys/rwlock.h | 10 +++++-----
|
||||
module/spl/spl-rwlock.c | 19 ++++++++++++++-----
|
||||
module/spl/spl-vnode.c | 2 ++
|
||||
4 files changed, 29 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/include/sys/isa_defs.h b/include/sys/isa_defs.h
|
||||
index 5559782..13dcb35 100644
|
||||
--- a/include/sys/isa_defs.h
|
||||
+++ b/include/sys/isa_defs.h
|
||||
@@ -210,6 +210,14 @@
|
||||
|
||||
#include <sys/byteorder.h>
|
||||
|
||||
+/*
|
||||
+ * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS will be defined by the Linux
|
||||
+ * kernel for architectures which support efficient unaligned access.
|
||||
+ */
|
||||
+#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
|
||||
+#define HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
+#endif
|
||||
+
|
||||
#if defined(__LITTLE_ENDIAN) && !defined(_LITTLE_ENDIAN)
|
||||
#define _LITTLE_ENDIAN __LITTLE_ENDIAN
|
||||
#endif
|
||||
diff --git a/include/sys/rwlock.h b/include/sys/rwlock.h
|
||||
index 325dfc4..2699229 100644
|
||||
--- a/include/sys/rwlock.h
|
||||
+++ b/include/sys/rwlock.h
|
||||
@@ -135,7 +135,7 @@ RW_LOCK_HELD(krwlock_t *rwp)
|
||||
}
|
||||
|
||||
/*
|
||||
- * The following functions must be a #define and not static inline.
|
||||
+ * The following functions must be a #define and not static inline.
|
||||
* This ensures that the native linux semaphore functions (down/up)
|
||||
* will be correctly located in the users code which is important
|
||||
* for the built in kernel lock analysis tools
|
||||
@@ -151,10 +151,10 @@ RW_LOCK_HELD(krwlock_t *rwp)
|
||||
spl_rw_set_type(rwp, type); \
|
||||
})
|
||||
|
||||
-#define rw_destroy(rwp) \
|
||||
-({ \
|
||||
- VERIFY(!RW_LOCK_HELD(rwp)); \
|
||||
-})
|
||||
+/*
|
||||
+ * The Linux rwsem implementation does not require a matching destroy.
|
||||
+ */
|
||||
+#define rw_destroy(rwp) ((void) 0)
|
||||
|
||||
#define rw_tryenter(rwp, rw) \
|
||||
({ \
|
||||
diff --git a/module/spl/spl-rwlock.c b/module/spl/spl-rwlock.c
|
||||
index bf7ee2f..ac28c91 100644
|
||||
--- a/module/spl/spl-rwlock.c
|
||||
+++ b/module/spl/spl-rwlock.c
|
||||
@@ -34,16 +34,24 @@
|
||||
static int
|
||||
__rwsem_tryupgrade(struct rw_semaphore *rwsem)
|
||||
{
|
||||
-
|
||||
+#if defined(READER_BIAS) && defined(WRITER_BIAS)
|
||||
+ /*
|
||||
+ * After the 4.9.20-rt16 kernel the realtime patch series lifted the
|
||||
+ * single reader restriction. While this could be accommodated by
|
||||
+ * adding additional compatibility code assume the rwsem can never
|
||||
+ * be upgraded. All caller must already cleanly handle this case.
|
||||
+ */
|
||||
+ return (0);
|
||||
+#else
|
||||
ASSERT((struct task_struct *)
|
||||
((unsigned long)rwsem->lock.owner & ~RT_MUTEX_OWNER_MASKALL) ==
|
||||
current);
|
||||
|
||||
/*
|
||||
- * Under the realtime patch series, rwsem is implemented as a
|
||||
- * single mutex held by readers and writers alike. However,
|
||||
- * this implementation would prevent a thread from taking a
|
||||
- * read lock twice, as the mutex would already be locked on
|
||||
+ * Prior to 4.9.20-rt16 kernel the realtime patch series, rwsem is
|
||||
+ * implemented as a single mutex held by readers and writers alike.
|
||||
+ * However, this implementation would prevent a thread from taking
|
||||
+ * a read lock twice, as the mutex would already be locked on
|
||||
* the second attempt. Therefore the implementation allows a
|
||||
* single thread to take a rwsem as read lock multiple times
|
||||
* tracking that nesting as read_depth counter.
|
||||
@@ -59,6 +67,7 @@ __rwsem_tryupgrade(struct rw_semaphore *rwsem)
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
+#endif
|
||||
}
|
||||
#elif defined(CONFIG_RWSEM_GENERIC_SPINLOCK)
|
||||
static int
|
||||
diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c
|
||||
index 74ae8fe..cd0015f 100644
|
||||
--- a/module/spl/spl-vnode.c
|
||||
+++ b/module/spl/spl-vnode.c
|
||||
@@ -670,6 +670,8 @@ vn_file_cache_destructor(void *buf, void *cdrarg)
|
||||
int
|
||||
spl_vn_init(void)
|
||||
{
|
||||
+ spin_lock_init(&vn_file_lock);
|
||||
+
|
||||
vn_cache = kmem_cache_create("spl_vn_cache",
|
||||
sizeof (struct vnode), 64, vn_cache_constructor,
|
||||
vn_cache_destructor, NULL, NULL, NULL, 0);
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tony Hutter <hutter2@llnl.gov>
|
||||
Date: Wed, 5 Sep 2018 10:36:46 -0700
|
||||
Subject: [PATCH] Tag spl-0.7.10
|
||||
|
||||
META file and changelog updated.
|
||||
|
||||
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
META | 2 +-
|
||||
rpm/generic/spl-kmod.spec.in | 3 +++
|
||||
rpm/generic/spl.spec.in | 3 +++
|
||||
3 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/META b/META
|
||||
index 95c9368..7818d34 100644
|
||||
--- a/META
|
||||
+++ b/META
|
||||
@@ -1,7 +1,7 @@
|
||||
Meta: 1
|
||||
Name: spl
|
||||
Branch: 1.0
|
||||
-Version: 0.7.9
|
||||
+Version: 0.7.10
|
||||
Release: 1
|
||||
Release-Tags: relext
|
||||
License: GPL
|
||||
diff --git a/rpm/generic/spl-kmod.spec.in b/rpm/generic/spl-kmod.spec.in
|
||||
index 9cd2225..f31e31e 100644
|
||||
--- a/rpm/generic/spl-kmod.spec.in
|
||||
+++ b/rpm/generic/spl-kmod.spec.in
|
||||
@@ -167,6 +167,9 @@ chmod u+x ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/*/extra/*/*/*
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%changelog
|
||||
+* Wed Sep 05 2018 Tony Hutter <hutter2@llnl.gov> - 0.7.10-1
|
||||
+- Released 0.7.10-1, detailed release notes are available at:
|
||||
+- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.10
|
||||
* Tue May 08 2018 Tony Hutter <hutter2@llnl.gov> - 0.7.9-1
|
||||
- Released 0.7.9-1, detailed release notes are available at:
|
||||
- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.9
|
||||
diff --git a/rpm/generic/spl.spec.in b/rpm/generic/spl.spec.in
|
||||
index 39c6411..7e9ee12 100644
|
||||
--- a/rpm/generic/spl.spec.in
|
||||
+++ b/rpm/generic/spl.spec.in
|
||||
@@ -44,6 +44,9 @@ make install DESTDIR=%{?buildroot}
|
||||
%{_mandir}/man5/*
|
||||
|
||||
%changelog
|
||||
+* Wed Sep 05 2018 Tony Hutter <hutter2@llnl.gov> - 0.7.10-1
|
||||
+- Released 0.7.10-1, detailed release notes are available at:
|
||||
+- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.10
|
||||
* Tue May 08 2018 Tony Hutter <hutter2@llnl.gov> - 0.7.9-1
|
||||
- Released 0.7.9-1, detailed release notes are available at:
|
||||
- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.9
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Date: Wed, 12 Sep 2018 20:42:34 -0400
|
||||
Subject: [PATCH] Linux 4.18 compat: Kconfig
|
||||
|
||||
The kernel's top level Kconfig was updated in 4.18 such that it
|
||||
no longer matches the expected pattern preventing the spl source
|
||||
from being inserted. Simplify the existing logic to always insert
|
||||
the entry at the end of the file since an exact location is not
|
||||
required, unlike in the Makefile.
|
||||
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Issue #7890
|
||||
|
||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
---
|
||||
copy-builtin | 27 +--------------------------
|
||||
1 file changed, 1 insertion(+), 26 deletions(-)
|
||||
|
||||
diff --git a/copy-builtin b/copy-builtin
|
||||
index 34c482b..b8e3a08 100755
|
||||
--- a/copy-builtin
|
||||
+++ b/copy-builtin
|
||||
@@ -88,32 +88,7 @@ EOF
|
||||
done
|
||||
} > "$KERNEL_DIR/spl/Kbuild"
|
||||
|
||||
-add_after()
|
||||
-{
|
||||
- local FILE="$1"
|
||||
- local MARKER="$2"
|
||||
- local NEW="$3"
|
||||
- local LINE
|
||||
-
|
||||
- while IFS='' read -r LINE
|
||||
- do
|
||||
- echo "$LINE"
|
||||
-
|
||||
- if [ -n "$MARKER" -a "$LINE" = "$MARKER" ]
|
||||
- then
|
||||
- echo "$NEW"
|
||||
- MARKER=''
|
||||
- if IFS='' read -r LINE
|
||||
- then
|
||||
- [ "$LINE" != "$NEW" ] && echo "$LINE"
|
||||
- fi
|
||||
- fi
|
||||
- done < "$FILE" > "$FILE.new"
|
||||
-
|
||||
- mv "$FILE.new" "$FILE"
|
||||
-}
|
||||
-
|
||||
-add_after "$KERNEL_DIR/Kconfig" 'source "arch/$SRCARCH/Kconfig"' 'source "spl/Kconfig"'
|
||||
+echo 'source "spl/Kconfig"' >>"$KERNEL_DIR/Kconfig"
|
||||
# We must take care to build SPL before ZFS, otherwise the symbols required
|
||||
# to link ZFS will not be available.
|
||||
sed -i 's~mm/ fs/~mm/ spl/ fs/~' "$KERNEL_DIR/Makefile"
|
||||
@@ -0,0 +1,56 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tony Hutter <hutter2@llnl.gov>
|
||||
Date: Thu, 13 Sep 2018 10:13:33 -0700
|
||||
Subject: [PATCH] Tag spl-0.7.11
|
||||
|
||||
META file and changelog updated.
|
||||
|
||||
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
|
||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
---
|
||||
META | 2 +-
|
||||
rpm/generic/spl-kmod.spec.in | 3 +++
|
||||
rpm/generic/spl.spec.in | 3 +++
|
||||
3 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/META b/META
|
||||
index 7818d34..fc98597 100644
|
||||
--- a/META
|
||||
+++ b/META
|
||||
@@ -1,7 +1,7 @@
|
||||
Meta: 1
|
||||
Name: spl
|
||||
Branch: 1.0
|
||||
-Version: 0.7.10
|
||||
+Version: 0.7.11
|
||||
Release: 1
|
||||
Release-Tags: relext
|
||||
License: GPL
|
||||
diff --git a/rpm/generic/spl-kmod.spec.in b/rpm/generic/spl-kmod.spec.in
|
||||
index f31e31e..4cc1faf 100644
|
||||
--- a/rpm/generic/spl-kmod.spec.in
|
||||
+++ b/rpm/generic/spl-kmod.spec.in
|
||||
@@ -167,6 +167,9 @@ chmod u+x ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/*/extra/*/*/*
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%changelog
|
||||
+* Thu Sep 13 2018 Tony Hutter <hutter2@llnl.gov> - 0.7.11-1
|
||||
+- Released 0.7.11-1, detailed release notes are available at:
|
||||
+- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.11
|
||||
* Wed Sep 05 2018 Tony Hutter <hutter2@llnl.gov> - 0.7.10-1
|
||||
- Released 0.7.10-1, detailed release notes are available at:
|
||||
- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.10
|
||||
diff --git a/rpm/generic/spl.spec.in b/rpm/generic/spl.spec.in
|
||||
index 7e9ee12..4b3a3d7 100644
|
||||
--- a/rpm/generic/spl.spec.in
|
||||
+++ b/rpm/generic/spl.spec.in
|
||||
@@ -44,6 +44,9 @@ make install DESTDIR=%{?buildroot}
|
||||
%{_mandir}/man5/*
|
||||
|
||||
%changelog
|
||||
+* Thu Sep 13 2018 Tony Hutter <hutter2@llnl.gov> - 0.7.11-1
|
||||
+- Released 0.7.11-1, detailed release notes are available at:
|
||||
+- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.11
|
||||
* Wed Sep 05 2018 Tony Hutter <hutter2@llnl.gov> - 0.7.10-1
|
||||
- Released 0.7.10-1, detailed release notes are available at:
|
||||
- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.10
|
||||
@@ -0,0 +1,7 @@
|
||||
0001-remove-DKMS-and-module-build.patch
|
||||
0002-Linux-4.18-compat-inode-timespec-timespec64.patch
|
||||
0003-Add-pool-state-proc-entry-SUSPENDED-pools-SPL.patch
|
||||
0004-Add-rwsem_tryupgrade-for-4.9.20-rt16-kernel-SPL.patch
|
||||
0005-Tag-spl-0.7.10.patch
|
||||
0006-Linux-4.18-compat-Kconfig.patch
|
||||
0007-Tag-spl-0.7.11.patch
|
||||
Binary file not shown.
@@ -0,0 +1,257 @@
|
||||
zfs-linux (0.7.11-pve1~bpo1) unstable; urgency=medium
|
||||
|
||||
* update ZFS to 0.7.11
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 10 Sep 2018 15:47:31 +0200
|
||||
|
||||
zfs-linux (0.7.9-pve3~bpo9) unstable; urgency=medium
|
||||
|
||||
* Cherry-pick fix for deadlock umount/snapentry_expire
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 03 Aug 2018 11:41:11 +0200
|
||||
|
||||
zfs-linux (0.7.9-pve2~bpo9) unstable; urgency=medium
|
||||
|
||||
* Cherry-pick fix for zpl_mount deadlock
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 12 Jul 2018 12:37:50 +0200
|
||||
|
||||
zfs-linux (0.7.9-pve1~bpo9) unstable; urgency=medium
|
||||
|
||||
* update ZFS to 0.7.9
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 18 May 2018 13:49:09 +0200
|
||||
|
||||
zfs-linux (0.7.8-pve1~bpo9) unstable; urgency=medium
|
||||
|
||||
* update ZFS to 0.7.8 (no changes)
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 30 Apr 2018 13:47:22 +0200
|
||||
|
||||
zfs-linux (0.7.7-pve2~bpo9) unstable; urgency=medium
|
||||
|
||||
* (temporarily) revert likely cause of #7401
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 9 Apr 2018 09:49:27 +0200
|
||||
|
||||
zfs-linux (0.7.7-pve1~bpo9) unstable; urgency=medium
|
||||
|
||||
* update ZFS to 0.7.7
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 3 Apr 2018 14:28:35 +0200
|
||||
|
||||
zfs-linux (0.7.6-pve1~bpo9) unstable; urgency=medium
|
||||
|
||||
* update ZFS to 0.7.6
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 21 Feb 2018 09:48:29 +0100
|
||||
|
||||
zfs-linux (0.7.4-pve2~bpo9) unstable; urgency=medium
|
||||
|
||||
* cherry-pick ARC hit rate fix from 0.7.6
|
||||
|
||||
* always load ZFS modules on boot
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 19 Jan 2018 11:31:14 +0100
|
||||
|
||||
zfs-linux (0.7.4-pve1~bpo9) unstable; urgency=medium
|
||||
|
||||
* update ZFS to 0.7.4
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 19 Dec 2017 12:52:42 +0100
|
||||
|
||||
zfs-linux (0.7.3-pve1~bpo9) unstable; urgency=medium
|
||||
|
||||
* update ZFS to 0.7.3
|
||||
|
||||
* include fix for user namespace setgid issue (#6800 upstream)
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 6 Nov 2017 09:14:19 +0100
|
||||
|
||||
zfs-linux (0.7.2-pve1~bpo90) unstable; urgency=medium
|
||||
|
||||
* update zfs to 0.7.2
|
||||
|
||||
* add PR 6616 - zfs send/recv compatibility with 0.6.5
|
||||
|
||||
* add PR 6695 - zfs recv: don't skip over objects which should be freed
|
||||
|
||||
* various small fixes
|
||||
|
||||
* split test suite into zfs-test package
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 12 Oct 2017 13:34:05 +0200
|
||||
|
||||
zfs-linux (0.6.5.11-pve18~bpo90) unstable; urgency=medium
|
||||
|
||||
* fix #1509: arc_summary error with L2ARC
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 2 Oct 2017 09:30:41 +0200
|
||||
|
||||
zfs-linux (0.6.5.11-pve17~bpo90) unstable; urgency=medium
|
||||
|
||||
* update zfs to debian/0.6.5.11-1
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 27 Jul 2017 13:11:45 +0200
|
||||
|
||||
zfs-linux (0.6.5.9-pve16~bpo90) unstable; urgency=medium
|
||||
|
||||
* drop transitional packages
|
||||
|
||||
* convert python scripts to python 3, drop .py suffix
|
||||
|
||||
* rebuild for PVE 5.0 / Debian Stretch
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 10 Mar 2017 09:45:52 +0100
|
||||
|
||||
zfs-linux (0.6.5.9-pve15~bpo80) unstable; urgency=medium
|
||||
|
||||
* update zfs to debian/0.6.5.9-1
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 6 Feb 2017 12:39:10 +0100
|
||||
|
||||
zfs-linux (0.6.5.8-pve14~bpo80) unstable; urgency=medium
|
||||
|
||||
* update zfs to debian/0.6.5.8-3
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 11 Jan 2017 09:34:58 +0100
|
||||
|
||||
zfs-linux (0.6.5.8-pve13~bpo80) unstable; urgency=medium
|
||||
|
||||
* fix #1184: zfs-share.service has wrong path to 'rm' command
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 27 Oct 2016 11:25:47 +0200
|
||||
|
||||
zfs-linux (0.6.5.8-pve12~bpo80) unstable; urgency=medium
|
||||
|
||||
* import with "-d /dev/disk/by-id" in systemd service
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 24 Oct 2016 13:48:08 +0200
|
||||
|
||||
zfs-linux (0.6.5.8-pve11~bpo80) unstable; urgency=medium
|
||||
|
||||
* update zfs to debian/0.6.5.8-1
|
||||
|
||||
* switch package upstream sources to Debian (Jessie)
|
||||
|
||||
* add transitional packages for upgrades
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 12 Oct 2016 11:16:02 +0200
|
||||
|
||||
zfs-linux (0.6.5.7-pve10~bpo80) unstable; urgency=medium
|
||||
|
||||
* update to pkg-zfs jessie/0.6.5.7-8
|
||||
|
||||
* change package versioning to allow upgrades from PVE3/wheezy
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 28 Jun 2016 09:50:00 +0200
|
||||
|
||||
zfs-linux (0.6.5-pve9~jessie) unstable; urgency=medium
|
||||
|
||||
* Update to pkg-zfs jessie/0.6.5.6-3
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 12 Apr 2016 09:51:35 +0200
|
||||
|
||||
zfs-linux (0.6.5-pve8~jessie) unstable; urgency=medium
|
||||
|
||||
* update to zfs-0.6.5.6
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 30 Mar 2016 10:50:22 +0200
|
||||
|
||||
zfs-linux (0.6.5-pve7~jessie) unstable; urgency=medium
|
||||
|
||||
* update to zfs-0.6.5.4
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 14 Jan 2016 10:51:17 +0100
|
||||
|
||||
zfs-linux (0.6.5-pve6~jessie) unstable; urgency=medium
|
||||
|
||||
* Prepare to tag zfs-0.6.5.3
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 05 Nov 2015 07:21:44 +0100
|
||||
|
||||
zfs-linux (0.6.5-pve5~jessie) unstable; urgency=medium
|
||||
|
||||
* Illumos 6267 - dn_bonus evicted too early
|
||||
|
||||
* Fix use-after-free in vdev_disk_physio_completion
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 04 Nov 2015 17:42:42 +0100
|
||||
|
||||
zfs-linux (0.6.5-pve4~jessie) unstable; urgency=medium
|
||||
|
||||
* update to master/debian/jessie/0.6.5.2-2
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 05 Oct 2015 17:56:45 +0200
|
||||
|
||||
zfs-linux (0.6.5-pve3~jessie) unstable; urgency=medium
|
||||
|
||||
* do not install /etc/init.d/zfs-zed script to avoid double startup
|
||||
with systemd
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 28 Sep 2015 10:14:40 +0200
|
||||
|
||||
zfs-linux (0.6.5-pve2~jessie) unstable; urgency=medium
|
||||
|
||||
* update to master/debian/jessie/0.6.5.1-4
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 24 Sep 2015 12:45:33 +0200
|
||||
|
||||
zfs-linux (0.6.5-pve1~jessie) unstable; urgency=medium
|
||||
|
||||
* update to master/debian/jessie/0.6.5.1-2
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 21 Sep 2015 10:02:41 +0200
|
||||
|
||||
zfs-linux (0.6.4-pve3~jessie) unstable; urgency=medium
|
||||
|
||||
* update to snapshot/debian/jessie/0.6.4-24-6bec43
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 24 Aug 2015 06:13:44 +0200
|
||||
|
||||
zfs-linux (0.6.4-pve2~jessie) unstable; urgency=medium
|
||||
|
||||
* update to 0.6.4.2 (snapshot/debian/jessie/0.6.4-21-53b1d9)
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 21 Jul 2015 11:03:21 +0200
|
||||
|
||||
zfs-linux (0.6.4-pve1~jessie) unstable; urgency=medium
|
||||
|
||||
* update to 0.6.4 (use upstream zol package definitions)
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 14 Apr 2015 10:19:22 +0200
|
||||
|
||||
zfs-linux (0.6.3-pve3~jessie) unstable; urgency=medium
|
||||
|
||||
* ignore zfs-import-scan errors
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 31 Mar 2015 17:52:40 +0200
|
||||
|
||||
zfs-linux (0.6.3-pve2~jessie) unstable; urgency=medium
|
||||
|
||||
* use systemd for service startup
|
||||
|
||||
* install zed configuration file /etc/zfs/zed.d/zed.rc
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Sun, 15 Mar 2015 15:52:54 +0100
|
||||
|
||||
zfs-linux (0.6.3-pve1~jessie) unstable; urgency=medium
|
||||
|
||||
* recompile on jessie
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Sat, 28 Feb 2015 16:02:08 +0100
|
||||
|
||||
zfs-linux (0.6.3-2~wheezy) unstable; urgency=low
|
||||
|
||||
* use /sbin/modprobe to avoid warning inside initrd
|
||||
|
||||
* fix warning about undefined values inside initrd
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 14 Jan 2015 19:03:04 +0100
|
||||
|
||||
zfs-linux (0.6.3-1~wheezy) unstable; urgency=low
|
||||
|
||||
* first version for Proxmox VE
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Sat, 10 Jan 2015 14:06:34 +0100
|
||||
|
||||
Submodule
+1
Submodule zfs-debian added at b444ee6627
@@ -1,14 +0,0 @@
|
||||
zfs-linux (0.6.3-2~wheezy) unstable; urgency=low
|
||||
|
||||
* use /sbin/modprobe to avoid warning inside initrd
|
||||
|
||||
* fix warning about undefined values inside initrd
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 14 Jan 2015 19:03:04 +0100
|
||||
|
||||
zfs-linux (0.6.3-1~wheezy) unstable; urgency=low
|
||||
|
||||
* first version for Proxmox VE
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Sat, 10 Jan 2015 14:06:34 +0100
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
7
|
||||
@@ -1,178 +0,0 @@
|
||||
Source: zfs-linux
|
||||
Section: kernel
|
||||
Priority: extra
|
||||
Maintainer: Proxmox Support Team <support@proxmox.com>
|
||||
Build-Depends: autotools-dev,
|
||||
autoconf,
|
||||
autogen,
|
||||
automake,
|
||||
debhelper (>= 8),
|
||||
dh-autoreconf,
|
||||
dkms (>= 2.2.0.2),
|
||||
libselinux1-dev,
|
||||
libtool,
|
||||
uuid-dev,
|
||||
zlib1g-dev,
|
||||
Standards-Version: 3.9.5
|
||||
|
||||
Package: libnvpair1
|
||||
Section: libs
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Replaces: libnvpair0
|
||||
Description: Solaris name-value library for Linux
|
||||
This library provides routines for packing and unpacking nv pairs for
|
||||
transporting data across process boundaries, transporting between
|
||||
kernel and userland, and possibly saving onto disk files.
|
||||
|
||||
Package: libnvpair1-dbg
|
||||
Section: debug
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, libnvpair1 (= ${binary:Version})
|
||||
Replaces: libnvpair0-dbg
|
||||
Description: Debugging symbols for libnvpair1
|
||||
This library provides routines for packing and unpacking nv pairs for
|
||||
transporting data across process boundaries, transporting between
|
||||
kernel and userland, and possibly saving onto disk files.
|
||||
.
|
||||
This package contains the debugging symbols for libnvpair1.
|
||||
|
||||
Package: libuutil1
|
||||
Section: libs
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Replaces: libuutil0
|
||||
Description: Solaris userland utility library for Linux
|
||||
This library provides a variety of glue functions for OpenZFS on Linux:
|
||||
* libspl: The Solaris Porting Layer library, which provides APIs that make it
|
||||
possible to run Solaris user code in a Linux environment with relatively
|
||||
minimal modification.
|
||||
* libavl: The Adelson-Velskii Landis balanced binary tree manipulation
|
||||
library.
|
||||
* libefi: The Extensible Firmware Interface library for GUID disk
|
||||
partitioning.
|
||||
* libshare: NFS and SMB service integration for OpenZFS.
|
||||
|
||||
Package: libuutil1-dbg
|
||||
Section: debug
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, libuutil1 (= ${binary:Version})
|
||||
Replaces: libuutil0-dbg
|
||||
Description: Debugging symbols for libuutil1
|
||||
This library provides a variety of glue functions for OpenZFS on Linux:
|
||||
* libspl: The Solaris Porting Layer library, which provides APIs that make it
|
||||
possible to run Solaris user code in a Linux environment with relatively
|
||||
minimal modification.
|
||||
* libavl: The Adelson-Velskii Landis balanced binary tree manipulation
|
||||
library.
|
||||
* libefi: The Extensible Firmware Interface library for GUID disk
|
||||
partitioning.
|
||||
* libshare: NFS and SMB service integration for OpenZFS.
|
||||
.
|
||||
This package contains debugging symbols for libuutil1.
|
||||
|
||||
Package: libzfs-dev
|
||||
Section: libdevel
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, libzfs2 (= ${binary:Version})
|
||||
Provides: libnvpair-dev, libuutil-dev
|
||||
Replaces: libefi1,
|
||||
libnvpair1,
|
||||
libshare1,
|
||||
libspl1,
|
||||
libunicode1,
|
||||
libuutil1,
|
||||
libzavl1,
|
||||
libzfs2,
|
||||
libzpool2,
|
||||
Description: Native OpenZFS filesystem development files for Linux
|
||||
Header files and static libraries for compiling software
|
||||
against libzfs.
|
||||
|
||||
Package: libzfs2
|
||||
Section: libs
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Replaces: libzfs0, libzfs1
|
||||
Description: Native OpenZFS filesystem library for Linux
|
||||
The ZoL management library.
|
||||
|
||||
Package: libzfs2-dbg
|
||||
Section: debug
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, libzfs2 (= ${binary:Version})
|
||||
Replaces: libzfs0-dbg, libzfs1-dbg
|
||||
Description: Debugging symbols for libzfs2
|
||||
The ZoL management library.
|
||||
.
|
||||
This package contains the debugging symbols for libzfs2.
|
||||
|
||||
Package: libzpool2
|
||||
Section: libs
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Replaces: libzpool0, libzpool1
|
||||
Description: Native OpenZFS pool library for Linux
|
||||
The zpool management library.
|
||||
|
||||
Package: libzpool2-dbg
|
||||
Section: debug
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, libzpool2 (= ${binary:Version})
|
||||
Replaces: libzpool0-dbg, libzpool1-dbg
|
||||
Description: Debugging symbols for libzpool2
|
||||
The zpool management library.
|
||||
.
|
||||
This package contains the debugging symbols for libzpool2.
|
||||
|
||||
Package: zfs-dkms
|
||||
Section: kernel
|
||||
Architecture: linux-any
|
||||
Pre-Depends: spl-dkms (>= ${source:Upstream-Version})
|
||||
Depends: ${misc:Depends}, dkms (>= 2.2.0.2)
|
||||
Replaces: lzfs, lzfs-dkms
|
||||
Provides: lustre-backend-fs, lzfs, lzfs-dkms
|
||||
Conflicts: lzfs, lzfs-dkms
|
||||
Description: Native OpenZFS filesystem kernel modules for Linux
|
||||
An advanced integrated volume manager and filesystem that is designed for
|
||||
performance and data integrity. Snapshots, clones, checksums, deduplication,
|
||||
compression, and RAID redundancy are built-in features.
|
||||
.
|
||||
Includes the SPA, DMU, ZVOL, and ZPL components of OpenZFS.
|
||||
|
||||
Package: zfs-doc
|
||||
Section: doc
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}
|
||||
Description: Native OpenZFS filesystem documentation and examples.
|
||||
Shared boilerplate files for OpenZFS on Linux that are not required at runtime.
|
||||
|
||||
Package: zfs-initramfs
|
||||
Section: kernel
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, zfsutils
|
||||
Description: Native OpenZFS root filesystem capabilities for Linux
|
||||
This package adds OpenZFS to the system initramfs with a hook
|
||||
for the initramfs-tools infrastructure.
|
||||
|
||||
Package: zfsutils
|
||||
Section: admin
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Suggests: samba-common-bin (>= 3.0.23), nfs-kernel-server, zfs-initramfs
|
||||
Conflicts: zfs, zfs-fuse
|
||||
Replaces: zfs
|
||||
Description: Native OpenZFS management utilities for Linux
|
||||
This package provides the zpool and zfs commands that are used to
|
||||
manage OpenZFS filesystems.
|
||||
|
||||
Package: zfsutils-dbg
|
||||
Section: debug
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, zfsutils (= ${binary:Version})
|
||||
Replaces: zfs-dbg
|
||||
Description: Debugging symbols for zfsutils
|
||||
This package provides the zpool and zfs commands that are used to
|
||||
manage OpenZFS filesystems.
|
||||
.
|
||||
This package contains the debugging symbols for zfsutils.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
lib/libnvpair.so.*
|
||||
@@ -1 +0,0 @@
|
||||
lib/libuutil.so.*
|
||||
@@ -1,4 +0,0 @@
|
||||
lib/*.a
|
||||
lib/*.la
|
||||
lib/*.so
|
||||
usr/include
|
||||
@@ -1,2 +0,0 @@
|
||||
lib/libzfs.so.*
|
||||
lib/libzfs_core.so.*
|
||||
@@ -1 +0,0 @@
|
||||
lib/libzpool.so.*
|
||||
@@ -1,71 +0,0 @@
|
||||
From: Darik Horn <dajhorn@vanadac.com>
|
||||
Date: Tue, 17 Jan 2012 19:45:07 -0600
|
||||
Subject: Prevent manual builds in the DKMS source.
|
||||
|
||||
Print an instructive error messsage and exit if the `dkms.conf` file
|
||||
exists when the userland is configured. (ie: `--with-config=user`)
|
||||
|
||||
A non-trivial number of people try to rebuild ZoL from the
|
||||
`/usr/src/zfs` tree, which is modified to better satisfy Debian
|
||||
packaging policy and contains only the module sources for DKMS.
|
||||
|
||||
Regardless, local installations usually break managed installations,
|
||||
so this autotools test could be further enhanced to check whether
|
||||
ZFS has a DKMS registration.
|
||||
---
|
||||
config/dkms.m4 | 14 ++++++++++++++
|
||||
config/user.m4 | 1 +
|
||||
config/zfs-build.m4 | 6 +++---
|
||||
3 files changed, 18 insertions(+), 3 deletions(-)
|
||||
create mode 100644 config/dkms.m4
|
||||
|
||||
diff --git a/config/dkms.m4 b/config/dkms.m4
|
||||
new file mode 100644
|
||||
index 0000000..cfa1152
|
||||
--- /dev/null
|
||||
+++ b/config/dkms.m4
|
||||
@@ -0,0 +1,14 @@
|
||||
+dnl #
|
||||
+dnl # Prevent manual building in DKMS source tree.
|
||||
+dnl #
|
||||
+AC_DEFUN([ZFS_AC_DKMS_INHIBIT], [
|
||||
+ AC_MSG_CHECKING([for dkms.conf file])
|
||||
+ AS_IF([test -e dkms.conf], [
|
||||
+ AC_MSG_ERROR([
|
||||
+ *** ZFS should not be manually built in the DKMS source tree.
|
||||
+ *** Remove all ZFS packages before compiling the ZoL sources.
|
||||
+ *** Running "make install" breaks ZFS packages.])
|
||||
+ ], [
|
||||
+ AC_MSG_RESULT([not found])
|
||||
+ ])
|
||||
+])
|
||||
diff --git a/config/user.m4 b/config/user.m4
|
||||
index 3802437..f5a8827 100644
|
||||
--- a/config/user.m4
|
||||
+++ b/config/user.m4
|
||||
@@ -2,6 +2,7 @@ dnl #
|
||||
dnl # Default ZFS user configuration
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_USER], [
|
||||
+ ZFS_AC_DKMS_INHIBIT
|
||||
ZFS_AC_CONFIG_USER_UDEV
|
||||
ZFS_AC_CONFIG_USER_SYSTEMD
|
||||
ZFS_AC_CONFIG_USER_SYSVINIT
|
||||
diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
|
||||
index 5ec94a0..41eec88 100644
|
||||
--- a/config/zfs-build.m4
|
||||
+++ b/config/zfs-build.m4
|
||||
@@ -87,10 +87,10 @@ AC_DEFUN([ZFS_AC_CONFIG], [
|
||||
ZFS_AC_CONFIG_ALWAYS
|
||||
|
||||
case "$ZFS_CONFIG" in
|
||||
- kernel) ZFS_AC_CONFIG_KERNEL ;;
|
||||
user) ZFS_AC_CONFIG_USER ;;
|
||||
- all) ZFS_AC_CONFIG_KERNEL
|
||||
- ZFS_AC_CONFIG_USER ;;
|
||||
+ kernel) ZFS_AC_CONFIG_KERNEL ;;
|
||||
+ all) ZFS_AC_CONFIG_USER
|
||||
+ ZFS_AC_CONFIG_KERNEL ;;
|
||||
srpm) ;;
|
||||
*)
|
||||
AC_MSG_RESULT([Error!])
|
||||
@@ -1,70 +0,0 @@
|
||||
From: Darik Horn <dajhorn@vanadac.com>
|
||||
Date: Sat, 18 Oct 2014 14:23:11 -0500
|
||||
Subject: Check for META and DCH consistency in autoconf.
|
||||
|
||||
If a debian/ packaging overlay exists, then the software versions defined in
|
||||
the META and debian/changelog files must be the same to ensure that DKMS uses
|
||||
correct paths and that users see the same version everywhere.
|
||||
---
|
||||
config/zfs-meta.m4 | 34 +++++++++++++++++++++++++++++-----
|
||||
1 file changed, 29 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/config/zfs-meta.m4 b/config/zfs-meta.m4
|
||||
index 7c92dd5..d174ccc 100644
|
||||
--- a/config/zfs-meta.m4
|
||||
+++ b/config/zfs-meta.m4
|
||||
@@ -1,9 +1,10 @@
|
||||
dnl #
|
||||
dnl # DESCRIPTION:
|
||||
-dnl # Read meta data from the META file. When building from a git repository
|
||||
-dnl # the ZFS_META_RELEASE field will be overwritten if there is an annotated
|
||||
-dnl # tag matching the form ZFS_META_NAME-ZFS_META_VERSION-*. This allows
|
||||
-dnl # for working builds to be uniquely identified using the git commit hash.
|
||||
+dnl # Read meta data from the META file or the debian/changelog file if it
|
||||
+dnl # exists. When building from a git repository the ZFS_META_RELEASE field
|
||||
+dnl # will be overwritten if there is an annotated tag matching the form
|
||||
+dnl # ZFS_META_NAME-ZFS_META_VERSION-*. This allows for working builds to be
|
||||
+dnl # uniquely identified using the git commit hash.
|
||||
dnl #
|
||||
dnl # The META file format is as follows:
|
||||
dnl # ^[ ]*KEY:[ \t]+VALUE$
|
||||
@@ -49,6 +50,7 @@ AC_DEFUN([ZFS_AC_META], [
|
||||
_zfs_ac_meta_type="none"
|
||||
if test -f "$META"; then
|
||||
_zfs_ac_meta_type="META file"
|
||||
+ _dpkg_parsechangelog=$(dpkg-parsechangelog 2>/dev/null)
|
||||
|
||||
ZFS_META_NAME=_ZFS_AC_META_GETVAL([(Name|Project|Package)]);
|
||||
if test -n "$ZFS_META_NAME"; then
|
||||
@@ -66,8 +68,30 @@ AC_DEFUN([ZFS_AC_META], [
|
||||
AC_SUBST([ZFS_META_VERSION])
|
||||
fi
|
||||
|
||||
+ if test -n "${_dpkg_parsechangelog}"; then
|
||||
+ _dpkg_version=$(echo "${_dpkg_parsechangelog}" \
|
||||
+ | $AWK '$[]1 == "Version:" { print $[]2; }' \
|
||||
+ | cut -d- -f1)
|
||||
+ if test "${_dpkg_version}" != "$ZFS_META_VERSION"; then
|
||||
+ AC_MSG_ERROR([
|
||||
+ *** Version $ZFS_META_VERSION in the META file is different than
|
||||
+ *** version $_dpkg_version in the debian/changelog file. DKMS and DEB
|
||||
+ *** packaging require that these files have the same version.
|
||||
+ ])
|
||||
+ fi
|
||||
+ fi
|
||||
+
|
||||
ZFS_META_RELEASE=_ZFS_AC_META_GETVAL([Release]);
|
||||
- if test ! -f ".nogitrelease" && git rev-parse --git-dir > /dev/null 2>&1; then
|
||||
+
|
||||
+ if test -n "${_dpkg_parsechangelog}"; then
|
||||
+ _dpkg_release=$(echo "${_dpkg_parsechangelog}" \
|
||||
+ | $AWK '$[]1 == "Version:" { print $[]2; }' \
|
||||
+ | cut -d- -f2-)
|
||||
+ if test -n "${_dpkg_release}"; then
|
||||
+ ZFS_META_RELEASE=${_dpkg_release}
|
||||
+ _zfs_ac_meta_type="dpkg-parsechangelog"
|
||||
+ fi
|
||||
+ elif test ! -f ".nogitrelease" && git rev-parse --git-dir > /dev/null 2>&1; then
|
||||
_match="${ZFS_META_NAME}-${ZFS_META_VERSION}"
|
||||
_alias=$(git describe --match=${_match} 2>/dev/null)
|
||||
_release=$(echo ${_alias}|cut -f3- -d'-'|sed 's/-/_/g')
|
||||
@@ -1,41 +0,0 @@
|
||||
From: Darik Horn <dajhorn@vanadac.com>
|
||||
Date: Sat, 18 Oct 2014 19:48:46 -0500
|
||||
Subject: Add libuutil to LIBADD for libzfs and libzfs_core
|
||||
|
||||
Resolve spurious dpkg-shlibdeps warnings like this:
|
||||
|
||||
warning: symbol strlcpy used by libzfs_core.so found in none of the libraries
|
||||
|
||||
This happens because dpkg-shlibdeps does not recursively search for symbols.
|
||||
|
||||
Signed-off-by: Darik Horn <dajhorn@vanadac.com>
|
||||
---
|
||||
lib/libzfs/Makefile.am | 1 +
|
||||
lib/libzfs_core/Makefile.am | 3 ++-
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am
|
||||
index 8b1f517..efdf84b 100644
|
||||
--- a/lib/libzfs/Makefile.am
|
||||
+++ b/lib/libzfs/Makefile.am
|
||||
@@ -23,6 +23,7 @@ libzfs_la_SOURCES = \
|
||||
|
||||
libzfs_la_LIBADD = \
|
||||
$(top_builddir)/lib/libzfs_core/libzfs_core.la \
|
||||
+ $(top_builddir)/lib/libuutil/libuutil.la \
|
||||
$(top_builddir)/lib/libshare/libshare.la \
|
||||
$(top_builddir)/lib/libnvpair/libnvpair.la \
|
||||
$(top_builddir)/lib/libzpool/libzpool.la
|
||||
diff --git a/lib/libzfs_core/Makefile.am b/lib/libzfs_core/Makefile.am
|
||||
index 0ecd208..6f0be5f 100644
|
||||
--- a/lib/libzfs_core/Makefile.am
|
||||
+++ b/lib/libzfs_core/Makefile.am
|
||||
@@ -10,6 +10,7 @@ libzfs_core_la_SOURCES = \
|
||||
$(top_srcdir)/lib/libzfs_core/libzfs_core.c
|
||||
|
||||
libzfs_core_la_LIBADD = \
|
||||
- $(top_builddir)/lib/libnvpair/libnvpair.la
|
||||
+ $(top_builddir)/lib/libnvpair/libnvpair.la \
|
||||
+ $(top_builddir)/lib/libuutil/libuutil.la
|
||||
|
||||
libzfs_core_la_LDFLAGS = -version-info 1:0:0
|
||||
@@ -1,31 +0,0 @@
|
||||
From: Ned Bass <bass6@llnl.gov>
|
||||
Date: Wed, 17 Dec 2014 11:01:42 -0800
|
||||
Subject: vdev_id: use mawk-compatible regular expression
|
||||
|
||||
Slot mapping in vdev_id doesn't work on systems using mawk as the 'awk'
|
||||
alternative. A regular expression in map_slot() contains an unquoted
|
||||
empty string following the alternation (|) operator, which results in an
|
||||
"missing operand" error with mawk. The solution is to rearrange the
|
||||
expression so the alternation has two operands.
|
||||
|
||||
Signed-off-by: Ned Bass <bass6@llnl.gov>
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Closes zfsonlinux/pkg-zfs#136
|
||||
Closes zfsonlinux/zfs#2965
|
||||
---
|
||||
cmd/vdev_id/vdev_id | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmd/vdev_id/vdev_id b/cmd/vdev_id/vdev_id
|
||||
index b6752ba..6fddd12 100755
|
||||
--- a/cmd/vdev_id/vdev_id
|
||||
+++ b/cmd/vdev_id/vdev_id
|
||||
@@ -116,7 +116,7 @@ map_slot() {
|
||||
local MAPPED_SLOT=
|
||||
|
||||
MAPPED_SLOT=`awk "\\$1 == \"slot\" && \\$2 == ${LINUX_SLOT} && \
|
||||
- \\$4 ~ /^(${CHANNEL}|)$/ { print \\$3; exit }" $CONFIG`
|
||||
+ \\$4 ~ /^${CHANNEL}$|^$/ { print \\$3; exit }" $CONFIG`
|
||||
if [ -z "$MAPPED_SLOT" ] ; then
|
||||
MAPPED_SLOT=$LINUX_SLOT
|
||||
fi
|
||||
@@ -1,4 +0,0 @@
|
||||
0001-Prevent-manual-builds-in-the-DKMS-source.patch
|
||||
0002-Check-for-META-and-DCH-consistency-in-autoconf.patch
|
||||
0003-Add-libuutil-to-LIBADD-for-libzfs-and-libzfs_core.patch
|
||||
0005-vdev_id-use-mawk-compatible-regular-expression.patch
|
||||
@@ -1,115 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
CHMOD ?= chmod
|
||||
INSTALL ?= install
|
||||
MAKE ?= make
|
||||
|
||||
META_NAME := $(shell awk '$$1 == "Name:" { print $$2; }' META)
|
||||
VERSION := $(shell dpkg-parsechangelog \
|
||||
| awk '$$1 == "Version:" { print $$2; }' | cut -d- -f1)
|
||||
REVISION := $(shell dpkg-parsechangelog \
|
||||
| awk '$$1 == "Version:" { print $$2; }' | cut -d- -f2-)
|
||||
|
||||
META_DISTDIR := $(CURDIR)/$(META_NAME)-$(VERSION)/
|
||||
|
||||
%:
|
||||
dh $@ --with autoreconf,dkms
|
||||
|
||||
override_dh_auto_configure:
|
||||
@# Embed the downstream version in the module.
|
||||
@sed \
|
||||
-e 's/^Version:.*/Version: $(VERSION)/' \
|
||||
-e 's/^Release:.*/Release: $(REVISION)/' \
|
||||
-i.orig META
|
||||
|
||||
@# Build the userland, but don't build the kernel modules.
|
||||
dh_auto_configure -- \
|
||||
--bindir=/bin \
|
||||
--sbindir=/sbin \
|
||||
--libdir=/lib \
|
||||
--with-udevdir=/lib/udev \
|
||||
--with-config=user
|
||||
|
||||
override_dh_auto_test:
|
||||
# The dh_auto_test rule is disabled because
|
||||
# `make check` cannot run in an unprivileged build environment.
|
||||
|
||||
override_dh_auto_install:
|
||||
@# Install the utilities.
|
||||
$(MAKE) install DESTDIR='$(CURDIR)/debian/tmp'
|
||||
|
||||
@# Get a bare copy of the source code for DKMS.
|
||||
@# This creates the $(META_DISTDIR)/ tree.
|
||||
$(MAKE) distdir
|
||||
|
||||
@# Delete components that are not required to build the kernel modules.
|
||||
@# This prevents several lintian complaints, discourages users from
|
||||
@# running `make install` in /usr/src, and reduces the installation
|
||||
@# size by one third. The printf creates a dummy automake file.
|
||||
umask 0111 && \
|
||||
cd '$(META_DISTDIR)' && \
|
||||
for ii in $$(find cmd dracut etc lib man rpm scripts udev -type f); do \
|
||||
rm "$$ii"; \
|
||||
test "$$ii" != "$${ii%.in}" && printf '%%:\n\t#\n' >"$$ii"; \
|
||||
true; \
|
||||
done
|
||||
|
||||
@# This shunt allows DKMS to copy the Module.symvers and zfs_config.h
|
||||
@# files into the ${dkms_tree} area through the POST_INSTALL directive.
|
||||
printf '#!/bin/sh\ncp "$$@"\n' >'$(META_DISTDIR)/cp'
|
||||
$(CHMOD) 755 '$(META_DISTDIR)/cp'
|
||||
|
||||
@# Install the DKMS source directly, avoiding dh_install.
|
||||
$(INSTALL) -d '$(CURDIR)/debian/zfs-dkms/usr/src/'
|
||||
mv '$(META_DISTDIR)' '$(CURDIR)/debian/zfs-dkms/usr/src/'
|
||||
|
||||
override_dh_dkms:
|
||||
dh_dkms -V
|
||||
|
||||
override_dh_install:
|
||||
@# Exclude the upstream /usr/lib/udev/rules.d files.
|
||||
dh_install -X/rules.d/
|
||||
|
||||
@# Ensure that /etc/zfs is in the zfsutils package
|
||||
@# because git has difficulty tracking empty directories.
|
||||
$(INSTALL) -d '$(CURDIR)/debian/zfsutils/etc/zfs/'
|
||||
|
||||
@# Resolve lintian errors regarding Debian Policy Manual Section 8.4
|
||||
@# by moving unversioned library links from /lib to /usr/lib in the
|
||||
@# development package. Look at libc6-dev for a packaging example if
|
||||
@# multiarch support ever becomes a concern here.
|
||||
$(INSTALL) -d '$(CURDIR)/debian/libzfs-dev/usr/lib/'
|
||||
cd '$(CURDIR)/debian/libzfs-dev/lib' && \
|
||||
for ii in $$(find -type l); do \
|
||||
ln -s "../../lib/$$(readlink "$$ii")" "../usr/lib/$$(basename "$$ii")" \
|
||||
&& rm "$$ii"; \
|
||||
done
|
||||
|
||||
override_dh_installdocs:
|
||||
dh_installdocs --link-doc=zfs-doc
|
||||
|
||||
override_dh_installinit:
|
||||
@# Install debian/zfsutils.zfs.default as /etc/default/zfs.
|
||||
dh_installinit --name=zfs
|
||||
|
||||
@# Install the /etc/init.d/zfs-mount script.
|
||||
@# Debian runs local mounts at sysv sequences [10..12] [08..09].
|
||||
dh_installinit --name=zfs-mount \
|
||||
--no-restart-on-upgrade --no-start -- defaults 13 07
|
||||
|
||||
@# Debian runs nfs-kernel-server at sysv sequence 17 01,
|
||||
@# iscsitarget at 02 01, and samba at 01 02.
|
||||
dh_installinit --name=zfs-share \
|
||||
--no-restart-on-upgrade --no-start -- defaults 18 00
|
||||
|
||||
|
||||
override_dh_installudev:
|
||||
dh_installudev --name=zvol --priority=60
|
||||
dh_installudev --name=vdev --priority=69
|
||||
|
||||
override_dh_strip:
|
||||
dh_strip -plibnvpair1 --dbg-package=libnvpair1-dbg
|
||||
dh_strip -plibuutil1 --dbg-package=libuutil1-dbg
|
||||
dh_strip -plibzfs2 --dbg-package=libzfs2-dbg
|
||||
dh_strip -plibzpool2 --dbg-package=libzpool2-dbg
|
||||
dh_strip -pzfsutils --dbg-package=zfsutils-dbg
|
||||
@@ -1,6 +0,0 @@
|
||||
## /etc/dpkg/dpkg.cfg.d/zfs-doc
|
||||
##
|
||||
## DPKG overrides that prevent the installation of ZoL documentation.
|
||||
|
||||
## Enable this line to reduce installation size.
|
||||
#path-exclude /usr/share/doc/zfs-doc/*
|
||||
@@ -1,2 +0,0 @@
|
||||
# Force the inclusion of Busybox in the initramfs.
|
||||
BUSYBOX=y
|
||||
@@ -1,78 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Add ZoL filesystem capabilities to an initrd, usually for a native OpenZFS root.
|
||||
#
|
||||
|
||||
# This hook installs udev rules for ZoL.
|
||||
PREREQ="zdev"
|
||||
|
||||
# These prerequisites are provided by the zfsutils package. The zdb utility is
|
||||
# not strictly required, but it can be useful at the initramfs recovery prompt.
|
||||
COPY_EXEC_LIST="/sbin/zdb /sbin/zpool /sbin/zfs /sbin/mount.zfs"
|
||||
|
||||
# These prerequisites are provided by the base system.
|
||||
COPY_EXEC_LIST="$COPY_EXEC_LIST /bin/hostname /sbin/blkid"
|
||||
|
||||
# Explicitly specify all kernel modules because automatic dependency resolution
|
||||
# is unreliable on many systems.
|
||||
MANUAL_ADD_MODULES_LIST="zlib_deflate spl zavl zcommon znvpair zunicode zfs"
|
||||
|
||||
# Generic result code.
|
||||
RC=0
|
||||
|
||||
case $1 in
|
||||
prereqs)
|
||||
echo "$PREREQ"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
for ii in $COPY_EXEC_LIST
|
||||
do
|
||||
if [ ! -x "$ii" ]
|
||||
then
|
||||
echo "Error: $ii is not executable."
|
||||
RC=2
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$RC" -ne 0 ]
|
||||
then
|
||||
exit "$RC"
|
||||
fi
|
||||
|
||||
. /usr/share/initramfs-tools/hook-functions
|
||||
|
||||
mkdir -p "$DESTDIR/etc/"
|
||||
|
||||
# zpool requires /etc/mtab
|
||||
ln -sf "/proc/mounts" "$DESTDIR/etc/mtab"
|
||||
|
||||
# ZDB uses pthreads for some functions, but the library dependency is not
|
||||
# automatically detected. The `find` utility and extended `cp` options are
|
||||
# used here because libgcc_s.so could be in a subdirectory of /lib for
|
||||
# multi-arch installations.
|
||||
cp --target-directory="$DESTDIR" --parents $(find /lib -type f -name libgcc_s.so.1)
|
||||
|
||||
for ii in $COPY_EXEC_LIST
|
||||
do
|
||||
copy_exec "$ii"
|
||||
done
|
||||
|
||||
for ii in $MANUAL_ADD_MODULES_LIST
|
||||
do
|
||||
manual_add_modules "$ii"
|
||||
done
|
||||
|
||||
if [ -f "/etc/hostname" ]
|
||||
then
|
||||
cp -p "/etc/hostname" "$DESTDIR/etc/"
|
||||
else
|
||||
hostname >"$DESTDIR/etc/hostname"
|
||||
fi
|
||||
|
||||
# ZoL 0.6.3 deprecated the hostid check.
|
||||
if [ -f /etc/hostid ]
|
||||
then
|
||||
cp -p /etc/hostid "$DESTDIR/etc/hostid"
|
||||
fi
|
||||
@@ -1,164 +0,0 @@
|
||||
# ZFS boot stub for initramfs-tools.
|
||||
#
|
||||
# In the initramfs environment, the /init script sources this stub to
|
||||
# override the default functions in the /scripts/local script.
|
||||
#
|
||||
# Enable this by passing boot=zfs on the kernel command line.
|
||||
#
|
||||
|
||||
|
||||
pre_mountroot()
|
||||
{
|
||||
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top"
|
||||
run_scripts /scripts/local-top
|
||||
[ "$quiet" != "y" ] && log_end_msg
|
||||
|
||||
if [ -r '/etc/default/zfs' ]
|
||||
then
|
||||
ZFS_INITRD_PRE_MOUNTROOT_SLEEP=0
|
||||
. '/etc/default/zfs'
|
||||
if [ "$ZFS_INITRD_PRE_MOUNTROOT_SLEEP" -gt '0' ]
|
||||
then
|
||||
[ "$quiet" != "y" ] && log_begin_msg "Sleeping for $ZFS_INITRD_PRE_MOUNTROOT_SLEEP seconds..."
|
||||
sleep "$ZFS_INITRD_PRE_MOUNTROOT_SLEEP"
|
||||
[ "$quiet" != "y" ] && log_end_msg
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Duplicates the functionality found under try_failure_hooks in functions
|
||||
# but invoking that would be inappropriate here.
|
||||
disable_plymouth()
|
||||
{
|
||||
if [ -x /bin/plymouth ] && /bin/plymouth --ping
|
||||
then
|
||||
/bin/plymouth hide-splash >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
mountroot()
|
||||
{
|
||||
pre_mountroot
|
||||
|
||||
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount"
|
||||
run_scripts /scripts/local-premount
|
||||
[ "$quiet" != "y" ] && log_end_msg
|
||||
|
||||
# Wait for all of the /dev/{hd,sd}[a-z] device nodes to appear.
|
||||
wait_for_udev
|
||||
|
||||
# Load the module now to get consistent automatic pool import behavior.
|
||||
/sbin/modprobe zfs
|
||||
|
||||
# Check the kernel command line for overrides.
|
||||
ZFS_RPOOL="${rpool#rpool=}"
|
||||
ZFS_BOOTFS="${bootfs#bootfs=}"
|
||||
|
||||
if [ -z "$ZFS_RPOOL" ]
|
||||
then
|
||||
# Check for the `-B zfs-bootfs=%s/%u,...` kind of parameter.
|
||||
#
|
||||
# The ${zfs-bootfs} variable is set at the kernel commmand
|
||||
# line, usually by GRUB, but it cannot be referenced here
|
||||
# directly because bourne variable names cannot contain a
|
||||
# hyphen.
|
||||
#
|
||||
# Reassign the variable by dumping the environment and
|
||||
# stripping the zfs-bootfs= prefix. Let the shell handle
|
||||
# quoting through the eval command.
|
||||
eval ZFS_RPOOL=$(set | sed -n -e 's,^zfs-bootfs=,,p')
|
||||
|
||||
# Only the pool name is relevant because the ZFS filesystem on
|
||||
# Linux is extrinsic and the userland cannot resolve a ZFS
|
||||
# object number.
|
||||
#
|
||||
# Strip everything after the first slash character.
|
||||
ZFS_RPOOL=$(echo "$ZFS_RPOOL" | sed -e 's,/.*,,')
|
||||
fi
|
||||
|
||||
# Use "rpool" as the default, like on most Solaris systems.
|
||||
[ -z "$ZFS_RPOOL" ] && ZFS_RPOOL='rpool'
|
||||
|
||||
# @FIXME: Forcing the import should not be necessary.
|
||||
#
|
||||
# Consider inhibiting automatic zpool imports in the initramfs
|
||||
# environment and doing a full import in the regular system instead.
|
||||
|
||||
[ "$quiet" != "y" ] && log_begin_msg "Importing ZFS root pool $ZFS_RPOOL"
|
||||
if [ -f /etc/zfs/zpool.cache ]
|
||||
then
|
||||
ZFS_STDERR=$(zpool list "$ZFS_RPOOL" 1>/dev/null 2>&1 \
|
||||
|| zpool import -f -N "$ZFS_RPOOL" 2>&1)
|
||||
ZFS_ERROR=$?
|
||||
else
|
||||
ZFS_STDERR=$(zpool import -f -N "$ZFS_RPOOL" 2>&1)
|
||||
ZFS_ERROR=$?
|
||||
fi
|
||||
[ "$quiet" != "y" ] && log_end_msg
|
||||
|
||||
if [ "$ZFS_ERROR" -ne 0 ]
|
||||
then
|
||||
disable_plymouth
|
||||
echo "Command: zpool import -f -N $ZFS_RPOOL"
|
||||
echo "Message: $ZFS_STDERR"
|
||||
echo "Error: $ZFS_ERROR"
|
||||
echo ""
|
||||
echo "Manually import the root pool at the command prompt and then exit."
|
||||
echo "Hint: Try: zpool import -f -R / -N $ZFS_RPOOL"
|
||||
/bin/sh
|
||||
fi
|
||||
|
||||
if [ -z "$ZFS_BOOTFS" ]
|
||||
then
|
||||
[ "$quiet" != "y" ] && log_begin_msg "Getting ZFS bootfs property"
|
||||
ZFS_BOOTFS=$(zpool list -H -o bootfs "$ZFS_RPOOL")
|
||||
ZFS_ERROR=$?
|
||||
[ "$quiet" != "y" ] && log_end_msg
|
||||
fi
|
||||
|
||||
if [ -z "$ZFS_BOOTFS" ]
|
||||
then
|
||||
disable_plymouth
|
||||
echo "Command: zpool list -H -o bootfs $ZFS_RPOOL"
|
||||
echo "Error: $ZFS_ERROR, unable to get the bootfs property."
|
||||
echo ""
|
||||
echo "Manually mount the root filesystem on $rootmnt and then exit."
|
||||
echo "Hint: Try: mount -t zfs -o zfsutil $ZFS_RPOOL/ROOT/system $rootmnt"
|
||||
/bin/sh
|
||||
fi
|
||||
|
||||
# Force the mountpoint to the only correct value for a root filesystem.
|
||||
[ "$quiet" != "y" ] && log_begin_msg "Setting mountpoint=/ on ZFS filesystem $ZFS_BOOTFS"
|
||||
ZFS_STDERR=$(zfs set mountpoint=/ "$ZFS_BOOTFS" 2>&1)
|
||||
[ "$quiet" != "y" ] && log_end_msg
|
||||
|
||||
# Ideally, the root filesystem would be mounted like this:
|
||||
#
|
||||
# zpool import -R "$rootmnt" -N "$ZFS_RPOOL"
|
||||
# zfs mount -o mountpoint=/ "$ZFS_BOOTFS"
|
||||
#
|
||||
# but the MOUNTPOINT prefix is preserved on descendent filesystem after
|
||||
# the pivot into the regular root, which later breaks things like
|
||||
# `zfs mount -a` and the /etc/mtab refresh.
|
||||
|
||||
[ "$quiet" != "y" ] && log_begin_msg "Mounting ZFS filesystem $ZFS_BOOTFS"
|
||||
ZFS_STDERR=$(mount -t zfs -o zfsutil "$ZFS_BOOTFS" "$rootmnt" 2>&1)
|
||||
ZFS_ERROR=$?
|
||||
[ "$quiet" != "y" ] && log_end_msg
|
||||
|
||||
if [ "$ZFS_ERROR" -ne 0 ]
|
||||
then
|
||||
disable_plymouth
|
||||
echo ""
|
||||
echo "Command: mount -t zfs -o zfsutil $ZFS_BOOTFS $rootmnt"
|
||||
echo "Message: $ZFS_STDERR"
|
||||
echo "Error: $ZFS_ERROR"
|
||||
echo ""
|
||||
echo "Manually mount the root filesystem on $rootmnt and then exit."
|
||||
/bin/sh
|
||||
fi
|
||||
|
||||
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-bottom"
|
||||
run_scripts /scripts/local-bottom
|
||||
[ "$quiet" != "y" ] && log_end_msg
|
||||
}
|
||||
@@ -1,391 +0,0 @@
|
||||
# Copyright (c) 2013, Aneurin Price <aneurin.price@gmail.com>
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation
|
||||
# files (the "Software"), to deal in the Software without
|
||||
# restriction, including without limitation the rights to use,
|
||||
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following
|
||||
# conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
if [[ -w /dev/zfs ]]; then
|
||||
__ZFS_CMD="zfs"
|
||||
__ZPOOL_CMD="zpool"
|
||||
else
|
||||
__ZFS_CMD="sudo zfs"
|
||||
__ZPOOL_CMD="sudo zpool"
|
||||
fi
|
||||
|
||||
__zfs_get_commands()
|
||||
{
|
||||
$__ZFS_CMD 2>&1 | awk '/^\t[a-z]/ {print $1}' | cut -f1 -d '|' | uniq
|
||||
}
|
||||
|
||||
__zfs_get_properties()
|
||||
{
|
||||
$__ZFS_CMD get 2>&1 | awk '$2 == "YES" || $2 == "NO" {print $1}'; echo all name space
|
||||
}
|
||||
|
||||
__zfs_get_editable_properties()
|
||||
{
|
||||
$__ZFS_CMD get 2>&1 | awk '$2 == "YES" {print $1"="}'
|
||||
}
|
||||
|
||||
__zfs_get_inheritable_properties()
|
||||
{
|
||||
$__ZFS_CMD get 2>&1 | awk '$3 == "YES" {print $1}'
|
||||
}
|
||||
|
||||
__zfs_list_datasets()
|
||||
{
|
||||
$__ZFS_CMD list -H -o name -t filesystem,volume
|
||||
}
|
||||
|
||||
__zfs_list_filesystems()
|
||||
{
|
||||
$__ZFS_CMD list -H -o name -t filesystem
|
||||
}
|
||||
|
||||
__zfs_match_snapshot()
|
||||
{
|
||||
local base_dataset=${cur%@*}
|
||||
if [[ $base_dataset != $cur ]]
|
||||
then
|
||||
$__ZFS_CMD list -H -o name -s name -t snapshot -d 1 $base_dataset
|
||||
else
|
||||
$__ZFS_CMD list -H -o name -t filesystem,volume | awk '{print $1"@"}'
|
||||
fi
|
||||
}
|
||||
|
||||
__zfs_match_explicit_snapshot()
|
||||
{
|
||||
local base_dataset=${cur%@*}
|
||||
if [[ $base_dataset != $cur ]]
|
||||
then
|
||||
$__ZFS_CMD list -H -o name -s name -t snapshot -d 1 $base_dataset
|
||||
fi
|
||||
}
|
||||
|
||||
__zfs_match_multiple_snapshots()
|
||||
{
|
||||
local existing_opts=$(expr "$cur" : '\(.*\)[%,]')
|
||||
if [[ $existing_opts ]]
|
||||
then
|
||||
local base_dataset=${cur%@*}
|
||||
if [[ $base_dataset != $cur ]]
|
||||
then
|
||||
local cur=${cur##*,}
|
||||
if [[ $cur =~ ^%|%.*% ]]
|
||||
then
|
||||
# correct range syntax is start%end
|
||||
return 1
|
||||
fi
|
||||
local range_start=$(expr "$cur" : '\(.*%\)')
|
||||
$__ZFS_CMD list -H -o name -s name -t snapshot -d 1 $base_dataset | sed 's$.*@$'$range_start'$g'
|
||||
fi
|
||||
else
|
||||
__zfs_match_explicit_snapshot; __zfs_list_datasets
|
||||
fi
|
||||
}
|
||||
|
||||
__zfs_list_volumes()
|
||||
{
|
||||
$__ZFS_CMD list -H -o name -t volume
|
||||
}
|
||||
|
||||
__zfs_argument_chosen()
|
||||
{
|
||||
local word property
|
||||
for word in $(seq $((COMP_CWORD-1)) -1 2)
|
||||
do
|
||||
local prev="${COMP_WORDS[$word]}"
|
||||
if [[ ${COMP_WORDS[$word-1]} != -[tos] ]]
|
||||
then
|
||||
if [[ "$prev" == [^,]*,* ]] || [[ "$prev" == *[@:]* ]]
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
for property in $@
|
||||
do
|
||||
if [[ $prev == "$property" ]]
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
__zfs_complete_ordered_arguments()
|
||||
{
|
||||
local list1=$1
|
||||
local list2=$2
|
||||
local cur=$3
|
||||
local extra=$4
|
||||
if __zfs_argument_chosen $list1
|
||||
then
|
||||
COMPREPLY=($(compgen -W "$list2 $extra" -- "$cur"))
|
||||
else
|
||||
COMPREPLY=($(compgen -W "$list1 $extra" -- "$cur"))
|
||||
fi
|
||||
}
|
||||
|
||||
__zfs_complete_multiple_options()
|
||||
{
|
||||
local options=$1
|
||||
local cur=$2
|
||||
|
||||
COMPREPLY=($(compgen -W "$options" -- "${cur##*,}"))
|
||||
local existing_opts=$(expr "$cur" : '\(.*,\)')
|
||||
if [[ $existing_opts ]]
|
||||
then
|
||||
COMPREPLY=( "${COMPREPLY[@]/#/${existing_opts}}" )
|
||||
fi
|
||||
}
|
||||
|
||||
__zfs_complete_switch()
|
||||
{
|
||||
local options=$1
|
||||
if [[ ${cur:0:1} == - ]]
|
||||
then
|
||||
COMPREPLY=($(compgen -W "-{$options}" -- "$cur"))
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
__zfs_complete()
|
||||
{
|
||||
local cur prev cmd cmds
|
||||
COMPREPLY=()
|
||||
# Don't split on colon
|
||||
_get_comp_words_by_ref -n : -c cur -p prev -w COMP_WORDS -i COMP_CWORD
|
||||
cmd="${COMP_WORDS[1]}"
|
||||
|
||||
if [[ ${prev##*/} == zfs ]]
|
||||
then
|
||||
cmds=$(__zfs_get_commands)
|
||||
COMPREPLY=($(compgen -W "$cmds -?" -- "$cur"))
|
||||
return 0
|
||||
fi
|
||||
|
||||
case "${cmd}" in
|
||||
clone)
|
||||
case "${prev}" in
|
||||
-o)
|
||||
COMPREPLY=($(compgen -W "$(__zfs_get_editable_properties)" -- "$cur"))
|
||||
;;
|
||||
*)
|
||||
if ! __zfs_complete_switch "o,p"
|
||||
then
|
||||
if __zfs_argument_chosen
|
||||
then
|
||||
COMPREPLY=($(compgen -W "$(__zfs_list_datasets)" -- "$cur"))
|
||||
else
|
||||
COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
get)
|
||||
case "${prev}" in
|
||||
-d)
|
||||
COMPREPLY=($(compgen -W "" -- "$cur"))
|
||||
;;
|
||||
-t)
|
||||
__zfs_complete_multiple_options "filesystem volume snapshot all" "$cur"
|
||||
;;
|
||||
-s)
|
||||
__zfs_complete_multiple_options "local default inherited temporary none" "$cur"
|
||||
;;
|
||||
-o)
|
||||
__zfs_complete_multiple_options "name property value source received all" "$cur"
|
||||
;;
|
||||
*)
|
||||
if ! __zfs_complete_switch "H,r,p,d,o,t,s"
|
||||
then
|
||||
if __zfs_argument_chosen $(__zfs_get_properties)
|
||||
then
|
||||
COMPREPLY=($(compgen -W "$(__zfs_match_explicit_snapshot) $(__zfs_list_datasets)" -- "$cur"))
|
||||
else
|
||||
__zfs_complete_multiple_options "$(__zfs_get_properties)" "$cur"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
inherit)
|
||||
if ! __zfs_complete_switch "r"
|
||||
then
|
||||
__zfs_complete_ordered_arguments "$(__zfs_get_inheritable_properties)" "$(__zfs_match_explicit_snapshot) $(__zfs_list_datasets)" $cur
|
||||
fi
|
||||
;;
|
||||
list)
|
||||
case "${prev}" in
|
||||
-d)
|
||||
COMPREPLY=($(compgen -W "" -- "$cur"))
|
||||
;;
|
||||
-t)
|
||||
__zfs_complete_multiple_options "filesystem volume snapshot all" "$cur"
|
||||
;;
|
||||
-o)
|
||||
__zfs_complete_multiple_options "$(__zfs_get_properties)" "$cur"
|
||||
;;
|
||||
-s|-S)
|
||||
COMPREPLY=($(compgen -W "$(__zfs_get_properties)" -- "$cur"))
|
||||
;;
|
||||
*)
|
||||
if ! __zfs_complete_switch "H,r,d,o,t,s,S"
|
||||
then
|
||||
COMPREPLY=($(compgen -W "$(__zfs_match_explicit_snapshot) $(__zfs_list_datasets)" -- "$cur"))
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
promote)
|
||||
COMPREPLY=($(compgen -W "$(__zfs_list_filesystems)" -- "$cur"))
|
||||
;;
|
||||
rollback)
|
||||
if ! __zfs_complete_switch "r,R,f"
|
||||
then
|
||||
COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
|
||||
fi
|
||||
;;
|
||||
send)
|
||||
if ! __zfs_complete_switch "d,n,P,p,R,v,i,I"
|
||||
then
|
||||
COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
|
||||
fi
|
||||
;;
|
||||
snapshot)
|
||||
case "${prev}" in
|
||||
-o)
|
||||
COMPREPLY=($(compgen -W "$(__zfs_get_editable_properties)" -- "$cur"))
|
||||
;;
|
||||
*)
|
||||
if ! __zfs_complete_switch "o,r"
|
||||
then
|
||||
COMPREPLY=($(compgen -W "$(__zfs_list_datasets | awk '{print $1"@"}')" -- "$cur"))
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
set)
|
||||
__zfs_complete_ordered_arguments "$(__zfs_get_editable_properties)" "$(__zfs_match_explicit_snapshot) $(__zfs_list_datasets)" $cur
|
||||
;;
|
||||
upgrade)
|
||||
case "${prev}" in
|
||||
-a|-V|-v)
|
||||
COMPREPLY=($(compgen -W "" -- "$cur"))
|
||||
;;
|
||||
*)
|
||||
if ! __zfs_complete_switch "a,V,v,r"
|
||||
then
|
||||
COMPREPLY=($(compgen -W "$(__zfs_list_filesystems)" -- "$cur"))
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
destroy)
|
||||
if ! __zfs_complete_switch "d,f,n,p,R,r,v"
|
||||
then
|
||||
__zfs_complete_multiple_options "$(__zfs_match_multiple_snapshots)" $cur
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=($(compgen -W "$(__zfs_match_explicit_snapshot) $(__zfs_list_datasets)" -- "$cur"))
|
||||
;;
|
||||
esac
|
||||
__ltrim_colon_completions "$cur"
|
||||
return 0
|
||||
}
|
||||
|
||||
__zpool_get_commands()
|
||||
{
|
||||
$__ZPOOL_CMD 2>&1 | awk '/^\t[a-z]/ {print $1}' | uniq
|
||||
}
|
||||
|
||||
__zpool_get_properties()
|
||||
{
|
||||
$__ZPOOL_CMD get 2>&1 | awk '$2 == "YES" || $2 == "NO" {print $1}'; echo all
|
||||
}
|
||||
|
||||
__zpool_get_editable_properties()
|
||||
{
|
||||
$__ZPOOL_CMD get 2>&1 | awk '$2 == "YES" {print $1"="}'
|
||||
}
|
||||
|
||||
__zpool_list_pools()
|
||||
{
|
||||
$__ZPOOL_CMD list -H -o name
|
||||
}
|
||||
|
||||
__zpool_complete()
|
||||
{
|
||||
local cur prev cmd cmds
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
cmd="${COMP_WORDS[1]}"
|
||||
|
||||
if [[ ${prev##*/} == zpool ]]
|
||||
then
|
||||
cmds=$(__zpool_get_commands)
|
||||
COMPREPLY=($(compgen -W "$cmds" -- "$cur"))
|
||||
return 0
|
||||
fi
|
||||
|
||||
case "${cmd}" in
|
||||
get)
|
||||
__zfs_complete_ordered_arguments "$(__zpool_get_properties)" "$(__zpool_list_pools)" $cur
|
||||
return 0
|
||||
;;
|
||||
import)
|
||||
if [[ $prev == -d ]]
|
||||
then
|
||||
_filedir -d
|
||||
else
|
||||
COMPREPLY=($(compgen -W "$(__zpool_list_pools) -d" -- "$cur"))
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
set)
|
||||
__zfs_complete_ordered_arguments "$(__zpool_get_editable_properties)" "$(__zpool_list_pools)" $cur
|
||||
return 0
|
||||
;;
|
||||
add|attach|clear|create|detach|offline|online|remove|replace)
|
||||
local pools="$(__zpool_list_pools)"
|
||||
if __zfs_argument_chosen $pools
|
||||
then
|
||||
_filedir
|
||||
else
|
||||
COMPREPLY=($(compgen -W "$pools" -- "$cur"))
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=($(compgen -W "$(__zpool_list_pools)" -- "$cur"))
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
complete -F __zfs_complete zfs
|
||||
complete -F __zpool_complete zpool
|
||||
@@ -1,28 +0,0 @@
|
||||
## Allow read-only ZoL commands to be called through sudo
|
||||
## without a password. Remove the first '#' column to enable.
|
||||
##
|
||||
## CAUTION: Any syntax error introduced here will break sudo.
|
||||
##
|
||||
## Cmnd alias specification
|
||||
#Cmnd_Alias C_ZFS = \
|
||||
# /sbin/zfs "", /sbin/zfs help *, \
|
||||
# /sbin/zfs get, /sbin/zfs get *, \
|
||||
# /sbin/zfs list, /sbin/zfs list *, \
|
||||
# /sbin/zpool "", /sbin/zpool help *, \
|
||||
# /sbin/zpool iostat, /sbin/zpool iostat *, \
|
||||
# /sbin/zpool list, /sbin/zpool list *, \
|
||||
# /sbin/zpool status, /sbin/zpool status *, \
|
||||
# /sbin/zpool upgrade, /sbin/zpool upgrade -v
|
||||
#
|
||||
#Runas_Alias R_ROOT = root
|
||||
#
|
||||
## User privilege specification
|
||||
#root ALL=(ALL) ALL
|
||||
#
|
||||
## Members of the admin group may gain root privileges
|
||||
#%adm ALL=(ALL) ALL # linux
|
||||
#%admin ALL=(ALL) ALL # linux
|
||||
#%staff ALL=(ALL) ALL # solaris
|
||||
#
|
||||
## allow any user to use basic read-only ZFS commands
|
||||
#ALL ALL = (R_ROOT) NOPASSWD: C_ZFS
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Sub-test to exclude ZVOLs
|
||||
set -e
|
||||
partition="$1"
|
||||
|
||||
. /usr/share/os-prober/common.sh
|
||||
|
||||
if [ "$(stat -L -c %t "$partition")" = "e6" ] ; then
|
||||
debug "$1 is a ZVOL; skipping"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# No ZVOLs found
|
||||
exit 1
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Add udev rules for ZoL to the initrd.
|
||||
#
|
||||
|
||||
PREREQ="udev"
|
||||
PREREQ_UDEV_RULES="60-zvol.rules 69-vdev.rules"
|
||||
COPY_EXEC_LIST="/lib/udev/vdev_id /lib/udev/zvol_id"
|
||||
|
||||
# Generic result code.
|
||||
RC=0
|
||||
|
||||
case $1 in
|
||||
prereqs)
|
||||
echo "$PREREQ"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
for ii in $COPY_EXEC_LIST
|
||||
do
|
||||
if [ ! -x "$ii" ]
|
||||
then
|
||||
echo "Error: $ii is not executable."
|
||||
RC=2
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$RC" -ne 0 ]
|
||||
then
|
||||
exit "$RC"
|
||||
fi
|
||||
|
||||
. /usr/share/initramfs-tools/hook-functions
|
||||
|
||||
mkdir -p "$DESTDIR/lib/udev/rules.d/"
|
||||
for ii in $PREREQ_UDEV_RULES
|
||||
do
|
||||
if [ -e "/etc/udev/rules.d/$ii" ]
|
||||
then
|
||||
cp -p "/etc/udev/rules.d/$ii" "$DESTDIR/lib/udev/rules.d/"
|
||||
elif [ -e "/lib/udev/rules.d/$ii" ]
|
||||
then
|
||||
cp -p "/lib/udev/rules.d/$ii" "$DESTDIR/lib/udev/rules.d/"
|
||||
else
|
||||
echo "Error: Missing udev rule: $ii"
|
||||
echo " This file must be in the /etc/udev/rules.d or /lib/udev/rules.d directory."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
for ii in $COPY_EXEC_LIST
|
||||
do
|
||||
copy_exec "$ii"
|
||||
done
|
||||
|
||||
if [ -f '/etc/default/zfs' -a -r '/etc/default/zfs' ]
|
||||
then
|
||||
mkdir -p "$DESTDIR/etc/default"
|
||||
cp -a '/etc/default/zfs' "$DESTDIR/etc/default/"
|
||||
fi
|
||||
|
||||
if [ -d '/etc/zfs' -a -r '/etc/zfs' ]
|
||||
then
|
||||
mkdir -p "$DESTDIR/etc"
|
||||
cp -a '/etc/zfs' "$DESTDIR/etc/"
|
||||
fi
|
||||
@@ -1,88 +0,0 @@
|
||||
BUILD_DEPENDS[0]="spl"
|
||||
AUTOINSTALL="yes"
|
||||
PACKAGE_NAME="zfs"
|
||||
PACKAGE_VERSION="#MODULE_VERSION#"
|
||||
PRE_BUILD="configure
|
||||
--prefix=/usr
|
||||
--with-config=kernel
|
||||
--with-linux=$(
|
||||
case `lsb_release -is` in
|
||||
(Debian)
|
||||
if [[ -e ${kernel_source_dir/%build/source} ]]
|
||||
then
|
||||
echo ${kernel_source_dir/%build/source}
|
||||
else
|
||||
# A kpkg exception for Proxmox 2.0
|
||||
echo ${kernel_source_dir}
|
||||
fi
|
||||
;;
|
||||
(*)
|
||||
echo ${kernel_source_dir}
|
||||
;;
|
||||
esac
|
||||
)
|
||||
--with-linux-obj=${kernel_source_dir}
|
||||
--with-spl=${source_tree}/spl-${PACKAGE_VERSION}
|
||||
--with-spl-obj=${dkms_tree}/spl/${PACKAGE_VERSION}/${kernelver}/${arch}
|
||||
$(
|
||||
[[ -r /etc/default/zfs ]] \
|
||||
&& source /etc/default/zfs \
|
||||
&& shopt -q -s extglob \
|
||||
&& \
|
||||
{
|
||||
if [[ ${ZFS_DKMS_ENABLE_DEBUG,,} == @(y|yes) ]]
|
||||
then
|
||||
echo --enable-debug
|
||||
fi
|
||||
if [[ ${ZFS_DKMS_ENABLE_DEBUG_DMU_TX,,} == @(y|yes) ]]
|
||||
then
|
||||
echo --enable-debug-dmu-tx
|
||||
fi
|
||||
}
|
||||
)
|
||||
"
|
||||
POST_BUILD="cp
|
||||
${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/zfs_config.h
|
||||
${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/module/Module.symvers
|
||||
${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/${kernelver}/${arch}/
|
||||
"
|
||||
REMAKE_INITRD="$(
|
||||
if [ -e /usr/share/initramfs-tools/hooks/zfs \
|
||||
-o -e /usr/share/dracut/modules.d/90zfs ]
|
||||
then
|
||||
echo -n yes
|
||||
else
|
||||
echo -n no
|
||||
fi
|
||||
)"
|
||||
MAKE[0]="make"
|
||||
STRIP[0]="$(
|
||||
[[ -r /etc/default/zfs ]] \
|
||||
&& source /etc/default/zfs \
|
||||
&& shopt -q -s extglob \
|
||||
&& [[ ${ZFS_DKMS_DISABLE_STRIP,,} == @(y|yes) ]] \
|
||||
&& echo -n no
|
||||
)"
|
||||
STRIP[1]="${STRIP[0]}"
|
||||
STRIP[2]="${STRIP[0]}"
|
||||
STRIP[3]="${STRIP[0]}"
|
||||
STRIP[4]="${STRIP[0]}"
|
||||
STRIP[5]="${STRIP[0]}"
|
||||
BUILT_MODULE_NAME[0]="zavl"
|
||||
BUILT_MODULE_LOCATION[0]="module/avl/"
|
||||
DEST_MODULE_LOCATION[0]="/extra/zfs/zavl"
|
||||
BUILT_MODULE_NAME[1]="zcommon"
|
||||
BUILT_MODULE_LOCATION[1]="module/zcommon/"
|
||||
DEST_MODULE_LOCATION[1]="/extra/zfs/zcommon"
|
||||
BUILT_MODULE_NAME[2]="znvpair"
|
||||
BUILT_MODULE_LOCATION[2]="module/nvpair/"
|
||||
DEST_MODULE_LOCATION[2]="/extra/zfs/znvpair"
|
||||
BUILT_MODULE_NAME[3]="zpios"
|
||||
BUILT_MODULE_LOCATION[3]="module/zpios/"
|
||||
DEST_MODULE_LOCATION[3]="/extra/zfs/zpios"
|
||||
BUILT_MODULE_NAME[4]="zunicode"
|
||||
BUILT_MODULE_LOCATION[4]="module/unicode/"
|
||||
DEST_MODULE_LOCATION[4]="/extra/zfs/zunicode"
|
||||
BUILT_MODULE_NAME[5]="zfs"
|
||||
BUILT_MODULE_LOCATION[5]="module/zfs/"
|
||||
DEST_MODULE_LOCATION[5]="/extra/zfs/zfs"
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
case $1 in
|
||||
(configure)
|
||||
[ -x /usr/share/update-notifier/notify-reboot-required ] \
|
||||
&& /usr/share/update-notifier/notify-reboot-required
|
||||
;;
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
#DEBHELPER#
|
||||
@@ -1,2 +0,0 @@
|
||||
COPYRIGHT
|
||||
OPENSOLARIS.LICENSE
|
||||
@@ -1,56 +0,0 @@
|
||||
etc/zfs/vdev_id.conf.alias.example
|
||||
etc/zfs/vdev_id.conf.multipath.example
|
||||
etc/zfs/vdev_id.conf.sas_direct.example
|
||||
etc/zfs/vdev_id.conf.sas_switch.example
|
||||
scripts/common.sh
|
||||
scripts/zconfig.sh
|
||||
scripts/zfault.sh
|
||||
scripts/zfs.sh
|
||||
scripts/zpios-profile/zpios-profile-disk.sh
|
||||
scripts/zpios-profile/zpios-profile-pids.sh
|
||||
scripts/zpios-profile/zpios-profile-post.sh
|
||||
scripts/zpios-profile/zpios-profile-pre.sh
|
||||
scripts/zpios-profile/zpios-profile.sh
|
||||
scripts/zpios-sanity.sh
|
||||
scripts/zpios-survey.sh
|
||||
scripts/zpios-test/16th-8192rc-4rs-1cs-4off.sh
|
||||
scripts/zpios-test/1th-16rc-4rs-1cs-4off.sh
|
||||
scripts/zpios-test/1x256th-65536rc-4rs-1cs-4off.sh
|
||||
scripts/zpios-test/256th-65536rc-4rs-1cs-4off.sh
|
||||
scripts/zpios-test/4th-1024rc-4rs-1cs-4off.sh
|
||||
scripts/zpios-test/large-thread-survey.sh
|
||||
scripts/zpios-test/large.sh
|
||||
scripts/zpios-test/lustre.sh
|
||||
scripts/zpios-test/medium.sh
|
||||
scripts/zpios-test/small.sh
|
||||
scripts/zpios-test/tiny.sh
|
||||
scripts/zpios.sh
|
||||
scripts/zpool-config/dm0-raid0.sh
|
||||
scripts/zpool-config/file-raid0.sh
|
||||
scripts/zpool-config/file-raid10.sh
|
||||
scripts/zpool-config/file-raidz.sh
|
||||
scripts/zpool-config/file-raidz2.sh
|
||||
scripts/zpool-config/hda-raid0.sh
|
||||
scripts/zpool-config/lo-faulty-raid0.sh
|
||||
scripts/zpool-config/lo-faulty-raid10.sh
|
||||
scripts/zpool-config/lo-faulty-raidz.sh
|
||||
scripts/zpool-config/lo-faulty-raidz2.sh
|
||||
scripts/zpool-config/lo-faulty-raidz3.sh
|
||||
scripts/zpool-config/lo-raid0.sh
|
||||
scripts/zpool-config/lo-raid10.sh
|
||||
scripts/zpool-config/lo-raidz.sh
|
||||
scripts/zpool-config/lo-raidz2.sh
|
||||
scripts/zpool-config/md0-raid10.sh
|
||||
scripts/zpool-config/md0-raid5.sh
|
||||
scripts/zpool-config/ram0-raid0.sh
|
||||
scripts/zpool-config/scsi_debug-noraid.sh
|
||||
scripts/zpool-config/scsi_debug-raid0.sh
|
||||
scripts/zpool-config/scsi_debug-raid10.sh
|
||||
scripts/zpool-config/scsi_debug-raidz.sh
|
||||
scripts/zpool-config/scsi_debug-raidz2.sh
|
||||
scripts/zpool-config/scsi_debug-raidz3.sh
|
||||
scripts/zpool-config/sda-raid0.sh
|
||||
scripts/zpool-config/zpool-raid0.sh
|
||||
scripts/zpool-config/zpool-raid10.sh
|
||||
scripts/zpool-config/zpool-raidz.sh
|
||||
scripts/zpool-create.sh
|
||||
@@ -1 +0,0 @@
|
||||
../tree/zfs-doc/* /
|
||||
@@ -1 +0,0 @@
|
||||
../tree/zfs-initramfs/* /
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# @FIXME: During system start, the /etc/init/mountall.conf on Ubuntu is unable
|
||||
# to generate the /etc/mtab file from the /proc/mounts file if a ZFS filesystem
|
||||
# is already mounted.
|
||||
|
||||
# This depends on mountall 2.18, which recognizes the link.
|
||||
ln -sf /proc/mounts /etc/mtab
|
||||
|
||||
#DEBHELPER#
|
||||
@@ -1,4 +0,0 @@
|
||||
../tree/zfsutils/* /
|
||||
sbin
|
||||
lib/udev
|
||||
usr/share/man
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
if dpkg-maintscript-helper supports rm_conffile 2>/dev/null
|
||||
then
|
||||
dpkg-maintscript-helper rm_conffile /etc/default/zfsload -- "$@"
|
||||
dpkg-maintscript-helper rm_conffile /etc/init.d/zfs -- "$@"
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
if dpkg-maintscript-helper supports rm_conffile 2>/dev/null
|
||||
then
|
||||
dpkg-maintscript-helper rm_conffile /etc/default/zfsload -- "$@"
|
||||
dpkg-maintscript-helper rm_conffile /etc/init.d/zfs -- "$@"
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
if dpkg-maintscript-helper supports rm_conffile 2>/dev/null
|
||||
then
|
||||
dpkg-maintscript-helper rm_conffile /etc/default/zfsload -- "$@"
|
||||
dpkg-maintscript-helper rm_conffile /etc/init.d/zfs -- "$@"
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
||||
@@ -1,4 +0,0 @@
|
||||
ENV{DEVTYPE}=="disk", IMPORT{program}="/lib/udev/vdev_id -d %k"
|
||||
KERNEL=="*[!0-9]", ENV{SUBSYSTEM}=="block", ENV{ID_VDEV}=="?*", SYMLINK+="$env{ID_VDEV_PATH}"
|
||||
KERNEL=="*[0-9]", ENV{SUBSYSTEM}=="block", ENV{DEVTYPE}=="partition", ENV{ID_VDEV}=="?*", SYMLINK+="$env{ID_VDEV_PATH}-part%n"
|
||||
KERNEL=="dm-[0-9]*", ENV{SUBSYSTEM}=="block", ENV{ID_VDEV}=="?*", SYMLINK+="$env{ID_VDEV_PATH}"
|
||||
@@ -1,80 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: zvol zfs
|
||||
# Required-Start: $local_fs
|
||||
# Required-Stop: $local_fs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Mount ZFS filesystems
|
||||
# Description: Run the `zfs mount -a` or `zfs umount -a` command.
|
||||
# This init script is deprecated and should be disabled in the
|
||||
# /etc/default/zfs options file. Instead, use the zfs-mount
|
||||
# package for Debian or the zfs-mountall package for Ubuntu
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/sbin:/bin
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
. /lib/init/vars.sh
|
||||
|
||||
[ -f /etc/default/zfs ] && . /etc/default/zfs
|
||||
|
||||
do_start()
|
||||
{
|
||||
log_begin_msg "Mounting ZFS filesystems"
|
||||
log_progress_msg "filesystems"
|
||||
zfs mount -a
|
||||
RET=$?
|
||||
|
||||
if [ $RET != 0 ] ; then
|
||||
log_end_msg $RET
|
||||
exit $RET
|
||||
fi
|
||||
|
||||
log_end_msg 0
|
||||
}
|
||||
|
||||
do_stop()
|
||||
{
|
||||
log_begin_msg "Unmounting ZFS filesystems"
|
||||
log_progress_msg "filesystems"
|
||||
zfs unmount -a
|
||||
RET=$?
|
||||
|
||||
# Ignore a non-zero `zfs` result so that a busy ZFS instance
|
||||
# does not hang the system during shutdown.
|
||||
if [ $RET != 0 ] ; then
|
||||
log_end_msg $RET
|
||||
fi
|
||||
|
||||
log_end_msg 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
(start)
|
||||
case "$ZFS_MOUNT" in
|
||||
([Oo][Ff][Ff]|[Nn][Oo]|'')
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
do_start
|
||||
;;
|
||||
(stop)
|
||||
case "$ZFS_UNMOUNT" in
|
||||
([Oo][Ff][Ff]|[Nn][Oo]|'')
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
do_stop
|
||||
;;
|
||||
(force-reload|reload|restart|status)
|
||||
# no-op
|
||||
;;
|
||||
|
||||
(*)
|
||||
[ -n "$1" ] && echo "Error: Unknown command $1."
|
||||
echo "Usage: $0 {start|stop}"
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
@@ -1,80 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: shareiscsi sharenfs sharesmb zfs-share
|
||||
# Required-Start: $local_fs $network $remote_fs
|
||||
# Required-Stop: $local_fs $network $remote_fs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Should-Start: iscsi iscsitarget istgt nfs-kernel-server samba
|
||||
# Should-Stop: iscsi iscsitarget istgt nfs-kernel-server samba
|
||||
# Short-Description: Network share OpenZFS datasets.
|
||||
# Description: Run the `zfs share -a` or `zfs unmount -a` commands
|
||||
# for controlling iSCSI, NFS, or CIFS network shares.
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
. /lib/init/vars.sh
|
||||
|
||||
[ -f /etc/default/zfs ] && . /etc/default/zfs
|
||||
|
||||
do_start()
|
||||
{
|
||||
log_begin_msg "Sharing OpenZFS filesystems"
|
||||
log_progress_msg "filesystems"
|
||||
zfs share -a
|
||||
RET=$?
|
||||
|
||||
if [ $RET != 0 ] ; then
|
||||
log_end_msg $RET
|
||||
exit $RET
|
||||
fi
|
||||
|
||||
log_end_msg 0
|
||||
}
|
||||
|
||||
do_stop()
|
||||
{
|
||||
log_begin_msg "Unsharing OpenZFS filesystems"
|
||||
log_progress_msg "filesystems"
|
||||
zfs unshare -a
|
||||
RET=$?
|
||||
|
||||
# Ignore a non-zero `zfs` result so that a busy OpenZFS instance
|
||||
# does not hang the system during shutdown.
|
||||
if [ $RET != 0 ] ; then
|
||||
log_end_msg $RET
|
||||
fi
|
||||
|
||||
log_end_msg 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
(start)
|
||||
case "$ZFS_SHARE" in
|
||||
([Oo][Ff][Ff]|[Nn][Oo]|'')
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
do_start
|
||||
;;
|
||||
(stop)
|
||||
case "$ZFS_UNSHARE" in
|
||||
([Oo][Ff][Ff]|[Nn][Oo]|'')
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
do_stop
|
||||
;;
|
||||
(force-reload|reload|restart|status)
|
||||
# no-op
|
||||
;;
|
||||
|
||||
(*)
|
||||
[ -n "$1" ] && echo "Error: Unknown command $1."
|
||||
echo "Usage: $0 {start|stop}"
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
@@ -1,15 +0,0 @@
|
||||
# ZoL userland configuration.
|
||||
|
||||
# uncomment the following line to mount zfs at startup
|
||||
#ZFS_MOUNT=yes
|
||||
|
||||
# Wait this many seconds during system start for pool member devices to appear
|
||||
# before attempting import and starting mountall.
|
||||
ZFS_AUTOIMPORT_TIMEOUT='30'
|
||||
|
||||
# Run `zfs share -a` during system start?
|
||||
# nb: The shareiscsi, sharenfs, and sharesmb dataset properties.
|
||||
ZFS_SHARE='no'
|
||||
|
||||
# Run `zfs unshare -a` during system stop?
|
||||
ZFS_UNSHARE='no'
|
||||
@@ -1 +0,0 @@
|
||||
KERNEL=="zd*" SUBSYSTEM=="block" ACTION=="add|change" PROGRAM="/lib/udev/zvol_id $tempnode" SYMLINK+="zvol/%c"
|
||||
@@ -0,0 +1,282 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
|
||||
Date: Mon, 6 Feb 2017 11:03:10 +0100
|
||||
Subject: [PATCH] remove DKMS, modules and dracut build
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
|
||||
---
|
||||
debian/control | 1 -
|
||||
debian/control.in | 40 ++-----------------
|
||||
debian/not-installed | 2 +
|
||||
debian/rules | 106 +--------------------------------------------------
|
||||
4 files changed, 7 insertions(+), 142 deletions(-)
|
||||
|
||||
diff --git a/debian/control b/debian/control
|
||||
index 9e4f8fa7..42fbec35 100644
|
||||
--- a/debian/control
|
||||
+++ b/debian/control
|
||||
@@ -9,7 +9,6 @@ Build-Depends: autotools-dev,
|
||||
debhelper (>= 10.2),
|
||||
dh-autoreconf,
|
||||
dh-python,
|
||||
- dkms (>> 2.1.1.2-5),
|
||||
libattr1-dev,
|
||||
libblkid-dev,
|
||||
libselinux1-dev,
|
||||
diff --git a/debian/control.in b/debian/control.in
|
||||
index e193f017..2cb2f614 100644
|
||||
--- a/debian/control.in
|
||||
+++ b/debian/control.in
|
||||
@@ -9,7 +9,6 @@ Build-Depends: autotools-dev,
|
||||
debhelper (>= 10.2),
|
||||
dh-autoreconf,
|
||||
dh-python,
|
||||
- dkms (>> 2.1.1.2-5),
|
||||
libattr1-dev,
|
||||
libblkid-dev,
|
||||
libselinux1-dev,
|
||||
@@ -86,26 +85,10 @@ Description: OpenZFS pool library for Linux
|
||||
.
|
||||
This zpool library provides support for managing zpools.
|
||||
|
||||
-Package: zfs-dkms
|
||||
-Architecture: all
|
||||
-Pre-Depends: spl-dkms (<<${source:Upstream-Version}.),
|
||||
- spl-dkms (>= ${source:Upstream-Version})
|
||||
-Depends: dkms (>> 2.1.1.2-5), lsb-release, ${misc:Depends}
|
||||
-Recommends: zfs-zed, zfsutils-linux (>= ${binary:Version}), @LINUX_COMPAT@
|
||||
-Provides: zfs-modules
|
||||
-Description: OpenZFS filesystem kernel modules for Linux
|
||||
- The Z file system is a pooled filesystem designed for maximum data
|
||||
- integrity, supporting data snapshots, multiple copies, and data
|
||||
- checksums.
|
||||
- .
|
||||
- This DKMS package includes the SPA, DMU, ZVOL, and ZPL components of
|
||||
- OpenZFS.
|
||||
-
|
||||
Package: zfs-initramfs
|
||||
Architecture: all
|
||||
Depends: busybox-initramfs | busybox-static | busybox,
|
||||
initramfs-tools,
|
||||
- zfs-modules | zfs-dkms,
|
||||
zfsutils-linux (>= ${binary:Version}),
|
||||
${misc:Depends}
|
||||
Description: OpenZFS root filesystem capabilities for Linux - initramfs
|
||||
@@ -116,29 +99,14 @@ Description: OpenZFS root filesystem capabilities for Linux - initramfs
|
||||
This package adds OpenZFS to the system initramfs with a hook
|
||||
for the initramfs-tools infrastructure.
|
||||
|
||||
-Package: zfs-dracut
|
||||
-Architecture: all
|
||||
-Depends: dracut,
|
||||
- zfs-modules | zfs-dkms,
|
||||
- zfsutils-linux (>= ${binary:Version}),
|
||||
- ${misc:Depends}
|
||||
-Description: OpenZFS root filesystem capabilities for Linux - dracut
|
||||
- The Z file system is a pooled filesystem designed for maximum data
|
||||
- integrity, supporting data snapshots, multiple copies, and data
|
||||
- checksums.
|
||||
- .
|
||||
- This package adds OpenZFS to the system initramfs with a hook
|
||||
- for the dracut infrastructure.
|
||||
-
|
||||
Package: zfsutils-linux
|
||||
Section: contrib/admin
|
||||
Architecture: linux-any
|
||||
Depends: python3, ${misc:Depends}, ${python3:Depends}, ${shlibs:Depends}
|
||||
-Recommends: lsb-base, zfs-modules | zfs-dkms, zfs-zed
|
||||
-Breaks: zfs-dkms (<< ${binary:Version}), zfs-dkms (>> ${binary:Version})
|
||||
+Recommends: lsb-base, zfs-zed
|
||||
Suggests: nfs-kernel-server,
|
||||
samba-common-bin (>= 3.0.23),
|
||||
- zfs-initramfs | zfs-dracut
|
||||
+ zfs-initramfs
|
||||
Conflicts: zfs, zfs-fuse
|
||||
Provides: zfsutils
|
||||
Description: command-line tools to manage OpenZFS filesystems
|
||||
@@ -152,8 +120,7 @@ Description: command-line tools to manage OpenZFS filesystems
|
||||
Package: zfs-zed
|
||||
Section: contrib/admin
|
||||
Architecture: linux-any
|
||||
-Depends: zfs-modules | zfs-dkms,
|
||||
- zfsutils-linux (>= ${binary:Version}),
|
||||
+Depends: zfsutils-linux (>= ${binary:Version}),
|
||||
${misc:Depends},
|
||||
${shlibs:Depends}
|
||||
Description: OpenZFS Event Daemon
|
||||
@@ -176,7 +143,6 @@ Depends: acl,
|
||||
python,
|
||||
sudo,
|
||||
sysstat,
|
||||
- zfs-modules | zfs-dkms,
|
||||
zfsutils-linux (>=${binary:Version}),
|
||||
${misc:Depends},
|
||||
${shlibs:Depends}
|
||||
diff --git a/debian/not-installed b/debian/not-installed
|
||||
index a008985c..c60b0016 100644
|
||||
--- a/debian/not-installed
|
||||
+++ b/debian/not-installed
|
||||
@@ -6,3 +6,5 @@ etc/zfs/vdev_id.conf.alias.example
|
||||
etc/zfs/vdev_id.conf.multipath.example
|
||||
etc/zfs/vdev_id.conf.sas_direct.example
|
||||
etc/zfs/vdev_id.conf.sas_switch.example
|
||||
+usr/lib/dracut
|
||||
+usr/share/zfs/enum-extract.pl
|
||||
diff --git a/debian/rules b/debian/rules
|
||||
index e2c5a25f..86b5994d 100755
|
||||
--- a/debian/rules
|
||||
+++ b/debian/rules
|
||||
@@ -5,9 +5,6 @@ include /usr/share/dpkg/default.mk
|
||||
LSB_DISTRIBUTOR := $(shell lsb_release -is)
|
||||
NAME := $(shell awk '$$1 == "Name:" { print $$2; }' META)
|
||||
|
||||
-DKMSFILES := module include config zfs.release.in autogen.sh META AUTHORS \
|
||||
- DISCLAIMER COPYRIGHT OPENSOLARIS.LICENSE README.markdown
|
||||
-
|
||||
ifndef BUILD_UDEB
|
||||
BUILD_UDEB=false
|
||||
endif
|
||||
@@ -17,21 +14,16 @@ KVERS=$(shell uname -r)
|
||||
endif
|
||||
|
||||
ifndef SPL
|
||||
-SPL=/usr/src/spl-$(DEB_VERSION_UPSTREAM)
|
||||
-endif
|
||||
-
|
||||
-ifndef SPLOBJ
|
||||
-SPLOBJ=/var/lib/dkms/spl/$(DEB_VERSION_UPSTREAM)/$(KVERS)/$(DEB_TARGET_GNU_CPU)
|
||||
+SPL=../spl-build
|
||||
endif
|
||||
|
||||
non_epoch_version=$(shell echo $(KVERS) | perl -pe 's/^\d+://')
|
||||
PACKAGE=zfs
|
||||
-pmodules = $(PACKAGE)-modules-$(non_epoch_version)
|
||||
|
||||
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
|
||||
%:
|
||||
- dh $@ --with autoreconf,dkms,python3,systemd --parallel
|
||||
+ dh $@ --with autoreconf,python3,systemd --parallel
|
||||
|
||||
override_dh_auto_configure:
|
||||
sed "s/@LINUX_COMPAT@/linux-libc-dev \(<< $(shell debian/get_next.sh)\)/" debian/control.in > debian/control
|
||||
@@ -74,37 +66,6 @@ override_dh_auto_install:
|
||||
$(INSTALL) -d '$(CURDIR)/debian/tmp/usr/sbin/'
|
||||
mv '$(CURDIR)/debian/tmp/sbin/zed' '$(CURDIR)/debian/tmp/usr/sbin/zed'
|
||||
|
||||
- @# Get a bare copy of the source code for DKMS.
|
||||
- @# This creates the $(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/ tree, which does not
|
||||
- @# contain the userland sources. NB: Remove-userland-dist-rules.patch
|
||||
- $(MAKE) distdir
|
||||
-
|
||||
- @# Install the DKMS source.
|
||||
- @# We only want the files needed to build the modules
|
||||
- mkdir -p '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/scripts'
|
||||
- cp '$(CURDIR)/scripts/enum-extract.pl' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/scripts'
|
||||
- $(foreach file,$(DKMSFILES),mv '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)' || exit 1;)
|
||||
- @# Hellish awk line:
|
||||
- @# * Deletes from configure.ac the parts not needed for building the kernel module
|
||||
- @# * It deletes from inside AC_CONFIG_FILES([]) everything except:
|
||||
- @# (Makefile$|include/|module/|*.release$)
|
||||
- @# * Takes care of spaces and tabs
|
||||
- awk '/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|zfs\.release([ \t]+)?$$))/){next} } {print}' \
|
||||
- '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac'
|
||||
- @# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
|
||||
- sed '1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \
|
||||
- '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am'
|
||||
- @# Sanity test
|
||||
- grep -q 'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am'
|
||||
- @# Run autogen on the stripped source tree
|
||||
- cd '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)'; ./autogen.sh
|
||||
- rm -fr '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/autom4te.cache'
|
||||
-
|
||||
- @# This shunt allows DKMS to install the Module.symvers and zfs_config.h
|
||||
- @# files to the ${dkms_tree} area through the POST_INSTALL directive.
|
||||
- printf '#!/bin/sh\ncp "$$@"\n' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/cp'
|
||||
- chmod 755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/cp'
|
||||
-
|
||||
mkdir -p $(CURDIR)/debian/tmp/usr/lib
|
||||
for i in `ls $(CURDIR)/debian/tmp/lib/*.so`; do \
|
||||
ln -s /lib/`readlink $${i}` $(CURDIR)/debian/tmp/usr/lib/`basename $${i}`; \
|
||||
@@ -114,9 +75,6 @@ override_dh_auto_install:
|
||||
chmod a-x $(CURDIR)/debian/tmp/etc/zfs/zfs-functions
|
||||
chmod a-x $(CURDIR)/debian/tmp/etc/default/zfs
|
||||
|
||||
-override_dh_dkms:
|
||||
- dh_dkms -V $(DEB_VERSION_UPSTREAM)
|
||||
-
|
||||
override_dh_makeshlibs:
|
||||
dh_makeshlibs -a -V
|
||||
ifeq ($(BUILD_UDEB), true)
|
||||
@@ -154,65 +112,5 @@ override_dh_install:
|
||||
|
||||
# ------------
|
||||
|
||||
-override_dh_prep-deb-files:
|
||||
- for templ in $(wildcard $(CURDIR)/debian/*_KVERS_*.in); do \
|
||||
- sed -e 's/##KVERS##/$(KVERS)/g ; s/#KVERS#/$(KVERS)/g ; s/_KVERS_/$(KVERS)/g ; s/##KDREV##/$(KDREV)/g ; s/#KDREV#/$(KDREV)/g ; s/_KDREV_/$(KDREV)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/' \
|
||||
- < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \
|
||||
- done
|
||||
- sed -e 's/##KVERS##/$(KVERS)/g ; s/#KVERS#/$(KVERS)/g ; s/_KVERS_/$(KVERS)/g ; s/##KDREV##/$(KDREV)/g ; s/#KDREV#/$(KDREV)/g ; s/_KDREV_/$(KDREV)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g' \
|
||||
- < debian/control.modules.in > debian/control
|
||||
-
|
||||
-override_dh_configure_modules_udeb: override_dh_configure_modules_udeb_stamp
|
||||
-override_dh_configure_modules_udeb_stamp:
|
||||
- ./configure \
|
||||
- --without-selinux \
|
||||
- --with-config=kernel \
|
||||
- --with-linux=$(KSRC) \
|
||||
- --with-linux-obj=$(KOBJ) \
|
||||
- --with-spl=$(SPL) \
|
||||
- --with-spl-obj=$(SPLOBJ)
|
||||
- touch override_dh_configure_modules_udeb_stamp
|
||||
-
|
||||
-override_dh_configure_modules: override_dh_configure_modules_stamp
|
||||
-override_dh_configure_modules_stamp:
|
||||
- ./configure \
|
||||
- --with-config=kernel \
|
||||
- --with-linux=$(KSRC) \
|
||||
- --with-linux-obj=$(KOBJ) \
|
||||
- --with-spl=$(SPL) \
|
||||
- --with-spl-obj=$(SPLOBJ)
|
||||
- touch override_dh_configure_modules_stamp
|
||||
-
|
||||
-override_dh_binary-modules-udeb: override_dh_prep-deb-files override_dh_configure_modules_udeb
|
||||
- dh_testdir
|
||||
- dh_testroot
|
||||
- dh_prep
|
||||
-
|
||||
- $(MAKE) -C $(CURDIR)/module modules
|
||||
-
|
||||
- dh_installdirs -p${pmodules}-di
|
||||
- dh_install -p${pmodules}-di
|
||||
- dh_gencontrol -p${pmodules}-di
|
||||
-
|
||||
- dh_builddeb -p${pmodules}-di
|
||||
-
|
||||
-override_dh_binary-modules: override_dh_prep-deb-files override_dh_configure_modules
|
||||
- dh_testdir
|
||||
- dh_testroot
|
||||
- dh_prep
|
||||
-
|
||||
- $(MAKE) -C $(CURDIR)/module modules
|
||||
-
|
||||
- dh_install -p${pmodules}
|
||||
- dh_installdocs -p${pmodules}
|
||||
- dh_installchangelogs -p${pmodules}
|
||||
- dh_compress -p${pmodules}
|
||||
- dh_strip -p${pmodules}
|
||||
- dh_fixperms -p${pmodules}
|
||||
- dh_installdeb -p${pmodules}
|
||||
- dh_gencontrol -p${pmodules}
|
||||
- dh_md5sums -p${pmodules}
|
||||
- dh_builddeb -p${pmodules}
|
||||
-
|
||||
debian-copyright:
|
||||
cme update dpkg-copyright -file debian/copyright.cme
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
|
||||
Date: Mon, 24 Oct 2016 13:47:06 +0200
|
||||
Subject: [PATCH] import with -d /dev/disk/by-id in scan service
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
|
||||
---
|
||||
etc/systemd/system/zfs-import-scan.service.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/etc/systemd/system/zfs-import-scan.service.in b/etc/systemd/system/zfs-import-scan.service.in
|
||||
index abc8e8e6..8fe2c107 100644
|
||||
--- a/etc/systemd/system/zfs-import-scan.service.in
|
||||
+++ b/etc/systemd/system/zfs-import-scan.service.in
|
||||
@@ -12,7 +12,7 @@ ConditionPathExists=!@sysconfdir@/zfs/zpool.cache
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStartPre=-/sbin/modprobe zfs
|
||||
-ExecStart=@sbindir@/zpool import -aN -o cachefile=none
|
||||
+ExecStart=@sbindir@/zpool import -aN -d /dev/disk/by-id -o cachefile=none
|
||||
|
||||
[Install]
|
||||
WantedBy=zfs-import.target
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
|
||||
Date: Fri, 19 Jan 2018 12:13:46 +0100
|
||||
Subject: [PATCH] always load ZFS module on boot
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
since zfs-import-scan.service is disabled by default, and
|
||||
zfs-import-cache.service only gets started if a cache file exists, this
|
||||
is needed for zfs-mount, zfs-share and zfs-zed services in case ZFS is
|
||||
not actually used.
|
||||
|
||||
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
|
||||
---
|
||||
etc/modules-load.d/zfs.conf.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/etc/modules-load.d/zfs.conf.in b/etc/modules-load.d/zfs.conf.in
|
||||
index 8b41baa3..59b058c9 100644
|
||||
--- a/etc/modules-load.d/zfs.conf.in
|
||||
+++ b/etc/modules-load.d/zfs.conf.in
|
||||
@@ -1,3 +1,3 @@
|
||||
# Always load kernel modules at boot. The default behavior is to load the
|
||||
# kernel modules in the zfs-import-*.service or when blkid(8) detects a pool.
|
||||
-#zfs
|
||||
+zfs
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Rohan Puri <rohan.puri15@gmail.com>
|
||||
Date: Sat, 28 Jul 2018 18:32:12 +0530
|
||||
Subject: [PATCH] Fix deadlock between zfs umount & snapentry_expire
|
||||
|
||||
zfs umount -> zfsctl_destroy() takes the zfs_snapshot_lock as a
|
||||
writer and calls zfsctl_snapshot_unmount_cancel(), which waits
|
||||
for snapentry_expire() if present (when snap is automounted).
|
||||
This snapentry_expire() itself then waits for zfs_snapshot_lock
|
||||
as a reader, resulting in a deadlock.
|
||||
|
||||
The fix is to only hold the zfs_snapshot_lock over the tree
|
||||
lookup and removal. After a successful lookup the lock can
|
||||
be dropped and zfs_snapentry_t will remain valid until the
|
||||
reference taken by the lookup is released.
|
||||
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Signed-off-by: Rohan Puri <rohan.puri15@gmail.com>
|
||||
Closes #7751
|
||||
Closes #7752
|
||||
|
||||
(Cherry-picked from fd7265c646f40e364396af5014bbb83e809e124a)
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
module/zfs/zfs_ctldir.c | 11 +++++------
|
||||
1 file changed, 5 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/module/zfs/zfs_ctldir.c b/module/zfs/zfs_ctldir.c
|
||||
index 3b5fb196..14af55c4 100644
|
||||
--- a/module/zfs/zfs_ctldir.c
|
||||
+++ b/module/zfs/zfs_ctldir.c
|
||||
@@ -358,8 +358,6 @@ snapentry_expire(void *data)
|
||||
static void
|
||||
zfsctl_snapshot_unmount_cancel(zfs_snapentry_t *se)
|
||||
{
|
||||
- ASSERT(RW_LOCK_HELD(&zfs_snapshot_lock));
|
||||
-
|
||||
if (taskq_cancel_id(system_delay_taskq, se->se_taskqid) == 0) {
|
||||
se->se_taskqid = TASKQID_INVALID;
|
||||
zfsctl_snapshot_rele(se);
|
||||
@@ -570,13 +568,14 @@ zfsctl_destroy(zfsvfs_t *zfsvfs)
|
||||
uint64_t objsetid = dmu_objset_id(zfsvfs->z_os);
|
||||
|
||||
rw_enter(&zfs_snapshot_lock, RW_WRITER);
|
||||
- if ((se = zfsctl_snapshot_find_by_objsetid(spa, objsetid))
|
||||
- != NULL) {
|
||||
- zfsctl_snapshot_unmount_cancel(se);
|
||||
+ se = zfsctl_snapshot_find_by_objsetid(spa, objsetid);
|
||||
+ if (se != NULL)
|
||||
zfsctl_snapshot_remove(se);
|
||||
+ rw_exit(&zfs_snapshot_lock);
|
||||
+ if (se != NULL) {
|
||||
+ zfsctl_snapshot_unmount_cancel(se);
|
||||
zfsctl_snapshot_rele(se);
|
||||
}
|
||||
- rw_exit(&zfs_snapshot_lock);
|
||||
} else if (zfsvfs->z_ctldir) {
|
||||
iput(zfsvfs->z_ctldir);
|
||||
zfsvfs->z_ctldir = NULL;
|
||||
@@ -0,0 +1,124 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Boris Protopopov <bprotopopov@users.noreply.github.com>
|
||||
Date: Wed, 9 Aug 2017 14:10:47 -0400
|
||||
Subject: [PATCH] zv_suspend_lock in zvol_open()/zvol_release()
|
||||
|
||||
Acquire zv_suspend_lock on first open and last close only.
|
||||
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Signed-off-by: Boris Protopopov <boris.protopopov@actifio.com>
|
||||
Closes #6342
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
module/zfs/zvol.c | 64 +++++++++++++++++++++++++++++++++++--------------------
|
||||
1 file changed, 41 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c
|
||||
index 3e7059b3..ffa5fac7 100644
|
||||
--- a/module/zfs/zvol.c
|
||||
+++ b/module/zfs/zvol.c
|
||||
@@ -1347,9 +1347,9 @@ zvol_open(struct block_device *bdev, fmode_t flag)
|
||||
{
|
||||
zvol_state_t *zv;
|
||||
int error = 0;
|
||||
- boolean_t drop_suspend = B_FALSE;
|
||||
+ boolean_t drop_suspend = B_TRUE;
|
||||
|
||||
- ASSERT(!mutex_owned(&zvol_state_lock));
|
||||
+ ASSERT(!MUTEX_HELD(&zvol_state_lock));
|
||||
|
||||
mutex_enter(&zvol_state_lock);
|
||||
/*
|
||||
@@ -1364,23 +1364,31 @@ zvol_open(struct block_device *bdev, fmode_t flag)
|
||||
return (SET_ERROR(-ENXIO));
|
||||
}
|
||||
|
||||
- /* take zv_suspend_lock before zv_state_lock */
|
||||
- rw_enter(&zv->zv_suspend_lock, RW_READER);
|
||||
-
|
||||
mutex_enter(&zv->zv_state_lock);
|
||||
-
|
||||
/*
|
||||
* make sure zvol is not suspended during first open
|
||||
- * (hold zv_suspend_lock), otherwise, drop the lock
|
||||
+ * (hold zv_suspend_lock) and respect proper lock acquisition
|
||||
+ * ordering - zv_suspend_lock before zv_state_lock
|
||||
*/
|
||||
if (zv->zv_open_count == 0) {
|
||||
- drop_suspend = B_TRUE;
|
||||
+ if (!rw_tryenter(&zv->zv_suspend_lock, RW_READER)) {
|
||||
+ mutex_exit(&zv->zv_state_lock);
|
||||
+ rw_enter(&zv->zv_suspend_lock, RW_READER);
|
||||
+ mutex_enter(&zv->zv_state_lock);
|
||||
+ /* check to see if zv_suspend_lock is needed */
|
||||
+ if (zv->zv_open_count != 0) {
|
||||
+ rw_exit(&zv->zv_suspend_lock);
|
||||
+ drop_suspend = B_FALSE;
|
||||
+ }
|
||||
+ }
|
||||
} else {
|
||||
- rw_exit(&zv->zv_suspend_lock);
|
||||
+ drop_suspend = B_FALSE;
|
||||
}
|
||||
-
|
||||
mutex_exit(&zvol_state_lock);
|
||||
|
||||
+ ASSERT(MUTEX_HELD(&zv->zv_state_lock));
|
||||
+ ASSERT(zv->zv_open_count != 0 || RW_READ_HELD(&zv->zv_suspend_lock));
|
||||
+
|
||||
if (zv->zv_open_count == 0) {
|
||||
error = zvol_first_open(zv);
|
||||
if (error)
|
||||
@@ -1417,28 +1425,38 @@ static int
|
||||
zvol_release(struct gendisk *disk, fmode_t mode)
|
||||
{
|
||||
zvol_state_t *zv;
|
||||
- boolean_t drop_suspend = B_FALSE;
|
||||
+ boolean_t drop_suspend = B_TRUE;
|
||||
|
||||
- ASSERT(!mutex_owned(&zvol_state_lock));
|
||||
+ ASSERT(!MUTEX_HELD(&zvol_state_lock));
|
||||
|
||||
mutex_enter(&zvol_state_lock);
|
||||
zv = disk->private_data;
|
||||
- ASSERT(zv && zv->zv_open_count > 0);
|
||||
-
|
||||
- /* take zv_suspend_lock before zv_state_lock */
|
||||
- rw_enter(&zv->zv_suspend_lock, RW_READER);
|
||||
|
||||
mutex_enter(&zv->zv_state_lock);
|
||||
- mutex_exit(&zvol_state_lock);
|
||||
-
|
||||
+ ASSERT(zv->zv_open_count > 0);
|
||||
/*
|
||||
* make sure zvol is not suspended during last close
|
||||
- * (hold zv_suspend_lock), otherwise, drop the lock
|
||||
+ * (hold zv_suspend_lock) and respect proper lock acquisition
|
||||
+ * ordering - zv_suspend_lock before zv_state_lock
|
||||
*/
|
||||
- if (zv->zv_open_count == 1)
|
||||
- drop_suspend = B_TRUE;
|
||||
- else
|
||||
- rw_exit(&zv->zv_suspend_lock);
|
||||
+ if (zv->zv_open_count == 1) {
|
||||
+ if (!rw_tryenter(&zv->zv_suspend_lock, RW_READER)) {
|
||||
+ mutex_exit(&zv->zv_state_lock);
|
||||
+ rw_enter(&zv->zv_suspend_lock, RW_READER);
|
||||
+ mutex_enter(&zv->zv_state_lock);
|
||||
+ /* check to see if zv_suspend_lock is needed */
|
||||
+ if (zv->zv_open_count != 1) {
|
||||
+ rw_exit(&zv->zv_suspend_lock);
|
||||
+ drop_suspend = B_FALSE;
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ drop_suspend = B_FALSE;
|
||||
+ }
|
||||
+ mutex_exit(&zvol_state_lock);
|
||||
+
|
||||
+ ASSERT(MUTEX_HELD(&zv->zv_state_lock));
|
||||
+ ASSERT(zv->zv_open_count != 1 || RW_READ_HELD(&zv->zv_suspend_lock));
|
||||
|
||||
zv->zv_open_count--;
|
||||
if (zv->zv_open_count == 0)
|
||||
@@ -0,0 +1,560 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Date: Sun, 12 Aug 2018 18:22:03 -0400
|
||||
Subject: [PATCH] Linux 4.18 compat: inode timespec -> timespec64
|
||||
|
||||
Commit torvalds/linux@95582b0 changes the inode i_atime, i_mtime,
|
||||
and i_ctime members form timespec's to timespec64's to make them
|
||||
2038 safe. As part of this change the current_time() function was
|
||||
also updated to return the timespec64 type.
|
||||
|
||||
Resolve this issue by introducing a new inode_timespec_t type which
|
||||
is defined to match the timespec type used by the inode. It should
|
||||
be used when working with inode timestamps to ensure matching types.
|
||||
|
||||
The timestruc_t type under Illumos was used in a similar fashion but
|
||||
was specified to always be a timespec_t. Rather than incorrectly
|
||||
define this type all timespec_t types have been replaced by the new
|
||||
inode_timespec_t type.
|
||||
|
||||
Finally, the kernel and user space 'sys/time.h' headers were aligned
|
||||
with each other. They define as appropriate for the context several
|
||||
constants as macros and include static inline implementation of
|
||||
gethrestime(), gethrestime_sec(), and gethrtime().
|
||||
|
||||
Reviewed-by: Chunwei Chen <tuxoko@gmail.com>
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Closes #7643
|
||||
Backported-by: Richard Yao <ryao@gentoo.org>
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
config/kernel-current-time.m4 | 7 +++----
|
||||
include/sys/dmu.h | 2 +-
|
||||
include/sys/dmu_objset.h | 2 +-
|
||||
include/sys/dsl_dir.h | 4 ++--
|
||||
include/sys/spa_impl.h | 2 +-
|
||||
include/sys/xvattr.h | 2 +-
|
||||
include/sys/zfs_context.h | 9 +--------
|
||||
include/sys/zfs_znode.h | 33 +++++++++++++++++++++++--------
|
||||
include/sys/zpl.h | 9 +++++++++
|
||||
lib/libspl/Makefile.am | 2 --
|
||||
lib/libspl/gethrestime.c | 38 ------------------------------------
|
||||
lib/libspl/gethrtime.c | 45 -------------------------------------------
|
||||
lib/libspl/include/sys/time.h | 37 +++++++++++++++++++++++++++--------
|
||||
lib/libzpool/kernel.c | 4 ++--
|
||||
module/zfs/dmu_objset.c | 2 +-
|
||||
module/zfs/dsl_dir.c | 6 +++---
|
||||
module/zfs/fm.c | 2 +-
|
||||
module/zfs/zfs_ctldir.c | 2 +-
|
||||
module/zfs/zfs_vnops.c | 4 ++--
|
||||
module/zfs/zfs_znode.c | 4 ++--
|
||||
module/zfs/zpl_inode.c | 5 +++--
|
||||
21 files changed, 88 insertions(+), 133 deletions(-)
|
||||
delete mode 100644 lib/libspl/gethrestime.c
|
||||
delete mode 100644 lib/libspl/gethrtime.c
|
||||
|
||||
diff --git a/config/kernel-current-time.m4 b/config/kernel-current-time.m4
|
||||
index 2ede9ff3..c7d5c9b5 100644
|
||||
--- a/config/kernel-current-time.m4
|
||||
+++ b/config/kernel-current-time.m4
|
||||
@@ -1,15 +1,14 @@
|
||||
dnl #
|
||||
dnl # 4.9, current_time() added
|
||||
+dnl # 4.18, return type changed from timespec to timespec64
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_CURRENT_TIME],
|
||||
[AC_MSG_CHECKING([whether current_time() exists])
|
||||
ZFS_LINUX_TRY_COMPILE_SYMBOL([
|
||||
#include <linux/fs.h>
|
||||
], [
|
||||
- struct inode ip;
|
||||
- struct timespec now __attribute__ ((unused));
|
||||
-
|
||||
- now = current_time(&ip);
|
||||
+ struct inode ip __attribute__ ((unused));
|
||||
+ ip.i_atime = current_time(&ip);
|
||||
], [current_time], [fs/inode.c], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_CURRENT_TIME, 1, [current_time() exists])
|
||||
diff --git a/include/sys/dmu.h b/include/sys/dmu.h
|
||||
index bcdf7d64..755a9056 100644
|
||||
--- a/include/sys/dmu.h
|
||||
+++ b/include/sys/dmu.h
|
||||
@@ -891,7 +891,7 @@ uint64_t dmu_objset_fsid_guid(objset_t *os);
|
||||
/*
|
||||
* Get the [cm]time for an objset's snapshot dir
|
||||
*/
|
||||
-timestruc_t dmu_objset_snap_cmtime(objset_t *os);
|
||||
+inode_timespec_t dmu_objset_snap_cmtime(objset_t *os);
|
||||
|
||||
int dmu_objset_is_snapshot(objset_t *os);
|
||||
|
||||
diff --git a/include/sys/dmu_objset.h b/include/sys/dmu_objset.h
|
||||
index a836e037..531e81d4 100644
|
||||
--- a/include/sys/dmu_objset.h
|
||||
+++ b/include/sys/dmu_objset.h
|
||||
@@ -179,7 +179,7 @@ int dmu_objset_find_dp(struct dsl_pool *dp, uint64_t ddobj,
|
||||
int func(struct dsl_pool *, struct dsl_dataset *, void *),
|
||||
void *arg, int flags);
|
||||
void dmu_objset_evict_dbufs(objset_t *os);
|
||||
-timestruc_t dmu_objset_snap_cmtime(objset_t *os);
|
||||
+inode_timespec_t dmu_objset_snap_cmtime(objset_t *os);
|
||||
|
||||
/* called from dsl */
|
||||
void dmu_objset_sync(objset_t *os, zio_t *zio, dmu_tx_t *tx);
|
||||
diff --git a/include/sys/dsl_dir.h b/include/sys/dsl_dir.h
|
||||
index 69b0b6a5..80e83fdc 100644
|
||||
--- a/include/sys/dsl_dir.h
|
||||
+++ b/include/sys/dsl_dir.h
|
||||
@@ -103,7 +103,7 @@ struct dsl_dir {
|
||||
/* Protected by dd_lock */
|
||||
kmutex_t dd_lock;
|
||||
list_t dd_props; /* list of dsl_prop_record_t's */
|
||||
- timestruc_t dd_snap_cmtime; /* last time snapshot namespace changed */
|
||||
+ inode_timespec_t dd_snap_cmtime; /* last snapshot namespace change */
|
||||
uint64_t dd_origin_txg;
|
||||
|
||||
/* gross estimate of space used by in-flight tx's */
|
||||
@@ -159,7 +159,7 @@ boolean_t dsl_dir_is_clone(dsl_dir_t *dd);
|
||||
void dsl_dir_new_refreservation(dsl_dir_t *dd, struct dsl_dataset *ds,
|
||||
uint64_t reservation, cred_t *cr, dmu_tx_t *tx);
|
||||
void dsl_dir_snap_cmtime_update(dsl_dir_t *dd);
|
||||
-timestruc_t dsl_dir_snap_cmtime(dsl_dir_t *dd);
|
||||
+inode_timespec_t dsl_dir_snap_cmtime(dsl_dir_t *dd);
|
||||
void dsl_dir_set_reservation_sync_impl(dsl_dir_t *dd, uint64_t value,
|
||||
dmu_tx_t *tx);
|
||||
void dsl_dir_zapify(dsl_dir_t *dd, dmu_tx_t *tx);
|
||||
diff --git a/include/sys/spa_impl.h b/include/sys/spa_impl.h
|
||||
index b1e78c1d..fa7490ac 100644
|
||||
--- a/include/sys/spa_impl.h
|
||||
+++ b/include/sys/spa_impl.h
|
||||
@@ -153,7 +153,7 @@ struct spa {
|
||||
uint64_t spa_freeze_txg; /* freeze pool at this txg */
|
||||
uint64_t spa_load_max_txg; /* best initial ub_txg */
|
||||
uint64_t spa_claim_max_txg; /* highest claimed birth txg */
|
||||
- timespec_t spa_loaded_ts; /* 1st successful open time */
|
||||
+ inode_timespec_t spa_loaded_ts; /* 1st successful open time */
|
||||
objset_t *spa_meta_objset; /* copy of dp->dp_meta_objset */
|
||||
kmutex_t spa_evicting_os_lock; /* Evicting objset list lock */
|
||||
list_t spa_evicting_os_list; /* Objsets being evicted. */
|
||||
diff --git a/include/sys/xvattr.h b/include/sys/xvattr.h
|
||||
index 4779b632..5d38927c 100644
|
||||
--- a/include/sys/xvattr.h
|
||||
+++ b/include/sys/xvattr.h
|
||||
@@ -47,7 +47,7 @@
|
||||
* Structure of all optional attributes.
|
||||
*/
|
||||
typedef struct xoptattr {
|
||||
- timestruc_t xoa_createtime; /* Create time of file */
|
||||
+ inode_timespec_t xoa_createtime; /* Create time of file */
|
||||
uint8_t xoa_archive;
|
||||
uint8_t xoa_system;
|
||||
uint8_t xoa_readonly;
|
||||
diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h
|
||||
index 4fe35342..68c58f95 100644
|
||||
--- a/include/sys/zfs_context.h
|
||||
+++ b/include/sys/zfs_context.h
|
||||
@@ -527,7 +527,7 @@ extern char *vn_dumpdir;
|
||||
#define AV_SCANSTAMP_SZ 32 /* length of anti-virus scanstamp */
|
||||
|
||||
typedef struct xoptattr {
|
||||
- timestruc_t xoa_createtime; /* Create time of file */
|
||||
+ inode_timespec_t xoa_createtime; /* Create time of file */
|
||||
uint8_t xoa_archive;
|
||||
uint8_t xoa_system;
|
||||
uint8_t xoa_readonly;
|
||||
@@ -640,13 +640,6 @@ extern void delay(clock_t ticks);
|
||||
#define USEC_TO_TICK(usec) ((usec) / (MICROSEC / hz))
|
||||
#define NSEC_TO_TICK(usec) ((usec) / (NANOSEC / hz))
|
||||
|
||||
-#define gethrestime_sec() time(NULL)
|
||||
-#define gethrestime(t) \
|
||||
- do {\
|
||||
- (t)->tv_sec = gethrestime_sec();\
|
||||
- (t)->tv_nsec = 0;\
|
||||
- } while (0);
|
||||
-
|
||||
#define max_ncpus 64
|
||||
#define boot_ncpus (sysconf(_SC_NPROCESSORS_ONLN))
|
||||
|
||||
diff --git a/include/sys/zfs_znode.h b/include/sys/zfs_znode.h
|
||||
index c292f037..26d1eb37 100644
|
||||
--- a/include/sys/zfs_znode.h
|
||||
+++ b/include/sys/zfs_znode.h
|
||||
@@ -270,19 +270,36 @@ typedef struct znode_hold {
|
||||
|
||||
extern unsigned int zfs_object_mutex_size;
|
||||
|
||||
-/* Encode ZFS stored time values from a struct timespec */
|
||||
+/*
|
||||
+ * Encode ZFS stored time values from a struct timespec / struct timespec64.
|
||||
+ */
|
||||
#define ZFS_TIME_ENCODE(tp, stmp) \
|
||||
-{ \
|
||||
+do { \
|
||||
(stmp)[0] = (uint64_t)(tp)->tv_sec; \
|
||||
(stmp)[1] = (uint64_t)(tp)->tv_nsec; \
|
||||
-}
|
||||
+} while (0)
|
||||
|
||||
-/* Decode ZFS stored time values to a struct timespec */
|
||||
+#if defined(HAVE_INODE_TIMESPEC64_TIMES)
|
||||
+/*
|
||||
+ * Decode ZFS stored time values to a struct timespec64
|
||||
+ * 4.18 and newer kernels.
|
||||
+ */
|
||||
#define ZFS_TIME_DECODE(tp, stmp) \
|
||||
-{ \
|
||||
- (tp)->tv_sec = (time_t)(stmp)[0]; \
|
||||
- (tp)->tv_nsec = (long)(stmp)[1]; \
|
||||
-}
|
||||
+do { \
|
||||
+ (tp)->tv_sec = (time64_t)(stmp)[0]; \
|
||||
+ (tp)->tv_nsec = (long)(stmp)[1]; \
|
||||
+} while (0)
|
||||
+#else
|
||||
+/*
|
||||
+ * Decode ZFS stored time values to a struct timespec
|
||||
+ * 4.17 and older kernels.
|
||||
+ */
|
||||
+#define ZFS_TIME_DECODE(tp, stmp) \
|
||||
+do { \
|
||||
+ (tp)->tv_sec = (time_t)(stmp)[0]; \
|
||||
+ (tp)->tv_nsec = (long)(stmp)[1]; \
|
||||
+} while (0)
|
||||
+#endif /* HAVE_INODE_TIMESPEC64_TIMES */
|
||||
|
||||
/*
|
||||
* Timestamp defines
|
||||
diff --git a/include/sys/zpl.h b/include/sys/zpl.h
|
||||
index 65ed4313..e433fbc6 100644
|
||||
--- a/include/sys/zpl.h
|
||||
+++ b/include/sys/zpl.h
|
||||
@@ -189,4 +189,13 @@ zpl_dir_emit_dots(struct file *file, zpl_dir_context_t *ctx)
|
||||
}
|
||||
#endif /* HAVE_VFS_ITERATE */
|
||||
|
||||
+/*
|
||||
+ * Linux 4.18, inode times converted from timespec to timespec64.
|
||||
+ */
|
||||
+#if defined(HAVE_INODE_TIMESPEC64_TIMES)
|
||||
+#define zpl_inode_timespec_trunc(ts, gran) timespec64_trunc(ts, gran)
|
||||
+#else
|
||||
+#define zpl_inode_timespec_trunc(ts, gran) timespec_trunc(ts, gran)
|
||||
+#endif
|
||||
+
|
||||
#endif /* _SYS_ZPL_H */
|
||||
diff --git a/lib/libspl/Makefile.am b/lib/libspl/Makefile.am
|
||||
index 59bc8ffb..a6e63cb8 100644
|
||||
--- a/lib/libspl/Makefile.am
|
||||
+++ b/lib/libspl/Makefile.am
|
||||
@@ -19,8 +19,6 @@ noinst_LTLIBRARIES = libspl.la
|
||||
|
||||
USER_C = \
|
||||
getexecname.c \
|
||||
- gethrtime.c \
|
||||
- gethrestime.c \
|
||||
getmntany.c \
|
||||
list.c \
|
||||
mkdirp.c \
|
||||
diff --git a/lib/libspl/gethrestime.c b/lib/libspl/gethrestime.c
|
||||
deleted file mode 100644
|
||||
index d37cc2d5..00000000
|
||||
--- a/lib/libspl/gethrestime.c
|
||||
+++ /dev/null
|
||||
@@ -1,38 +0,0 @@
|
||||
-/*
|
||||
- * CDDL HEADER START
|
||||
- *
|
||||
- * The contents of this file are subject to the terms of the
|
||||
- * Common Development and Distribution License (the "License").
|
||||
- * You may not use this file except in compliance with the License.
|
||||
- *
|
||||
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
- * or http://www.opensolaris.org/os/licensing.
|
||||
- * See the License for the specific language governing permissions
|
||||
- * and limitations under the License.
|
||||
- *
|
||||
- * When distributing Covered Code, include this CDDL HEADER in each
|
||||
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
- * If applicable, add the following below this CDDL HEADER, with the
|
||||
- * fields enclosed by brackets "[]" replaced with your own identifying
|
||||
- * information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
- *
|
||||
- * CDDL HEADER END
|
||||
- */
|
||||
-
|
||||
-/*
|
||||
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
- * Use is subject to license terms.
|
||||
- */
|
||||
-
|
||||
-#include <time.h>
|
||||
-#include <sys/time.h>
|
||||
-
|
||||
-void
|
||||
-gethrestime(timestruc_t *ts)
|
||||
-{
|
||||
- struct timeval tv;
|
||||
-
|
||||
- gettimeofday(&tv, NULL);
|
||||
- ts->tv_sec = tv.tv_sec;
|
||||
- ts->tv_nsec = tv.tv_usec * NSEC_PER_USEC;
|
||||
-}
|
||||
diff --git a/lib/libspl/gethrtime.c b/lib/libspl/gethrtime.c
|
||||
deleted file mode 100644
|
||||
index 95ceb18e..00000000
|
||||
--- a/lib/libspl/gethrtime.c
|
||||
+++ /dev/null
|
||||
@@ -1,45 +0,0 @@
|
||||
-/*
|
||||
- * CDDL HEADER START
|
||||
- *
|
||||
- * The contents of this file are subject to the terms of the
|
||||
- * Common Development and Distribution License (the "License").
|
||||
- * You may not use this file except in compliance with the License.
|
||||
- *
|
||||
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
- * or http://www.opensolaris.org/os/licensing.
|
||||
- * See the License for the specific language governing permissions
|
||||
- * and limitations under the License.
|
||||
- *
|
||||
- * When distributing Covered Code, include this CDDL HEADER in each
|
||||
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
- * If applicable, add the following below this CDDL HEADER, with the
|
||||
- * fields enclosed by brackets "[]" replaced with your own identifying
|
||||
- * information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
- *
|
||||
- * CDDL HEADER END
|
||||
- */
|
||||
-
|
||||
-/*
|
||||
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
- * Use is subject to license terms.
|
||||
- */
|
||||
-
|
||||
-#include <time.h>
|
||||
-#include <sys/time.h>
|
||||
-#include <stdlib.h>
|
||||
-#include <stdio.h>
|
||||
-
|
||||
-hrtime_t
|
||||
-gethrtime(void)
|
||||
-{
|
||||
- struct timespec ts;
|
||||
- int rc;
|
||||
-
|
||||
- rc = clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
- if (rc) {
|
||||
- fprintf(stderr, "Error: clock_gettime() = %d\n", rc);
|
||||
- abort();
|
||||
- }
|
||||
-
|
||||
- return ((((u_int64_t)ts.tv_sec) * NANOSEC) + ts.tv_nsec);
|
||||
-}
|
||||
diff --git a/lib/libspl/include/sys/time.h b/lib/libspl/include/sys/time.h
|
||||
index dc645fa5..04b3ba87 100644
|
||||
--- a/lib/libspl/include/sys/time.h
|
||||
+++ b/lib/libspl/include/sys/time.h
|
||||
@@ -27,8 +27,9 @@
|
||||
#ifndef _LIBSPL_SYS_TIME_H
|
||||
#define _LIBSPL_SYS_TIME_H
|
||||
|
||||
-#include_next <sys/time.h>
|
||||
+#include <time.h>
|
||||
#include <sys/types.h>
|
||||
+#include_next <sys/time.h>
|
||||
|
||||
#ifndef SEC
|
||||
#define SEC 1
|
||||
@@ -70,13 +71,33 @@
|
||||
#define SEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / SEC))
|
||||
#endif
|
||||
|
||||
-
|
||||
typedef long long hrtime_t;
|
||||
-typedef struct timespec timestruc_t;
|
||||
-typedef struct timespec timespec_t;
|
||||
-
|
||||
-
|
||||
-extern hrtime_t gethrtime(void);
|
||||
-extern void gethrestime(timestruc_t *);
|
||||
+typedef struct timespec timespec_t;
|
||||
+typedef struct timespec inode_timespec_t;
|
||||
+
|
||||
+static inline void
|
||||
+gethrestime(inode_timespec_t *ts)
|
||||
+{
|
||||
+ struct timeval tv;
|
||||
+ (void) gettimeofday(&tv, NULL);
|
||||
+ ts->tv_sec = tv.tv_sec;
|
||||
+ ts->tv_nsec = tv.tv_usec * NSEC_PER_USEC;
|
||||
+}
|
||||
+
|
||||
+static inline time_t
|
||||
+gethrestime_sec(void)
|
||||
+{
|
||||
+ struct timeval tv;
|
||||
+ (void) gettimeofday(&tv, NULL);
|
||||
+ return (tv.tv_sec);
|
||||
+}
|
||||
+
|
||||
+static inline hrtime_t
|
||||
+gethrtime(void)
|
||||
+{
|
||||
+ struct timespec ts;
|
||||
+ (void) clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
+ return ((((u_int64_t)ts.tv_sec) * NANOSEC) + ts.tv_nsec);
|
||||
+}
|
||||
|
||||
#endif /* _LIBSPL_SYS_TIME_H */
|
||||
diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c
|
||||
index e67d13c9..3ea8778b 100644
|
||||
--- a/lib/libzpool/kernel.c
|
||||
+++ b/lib/libzpool/kernel.c
|
||||
@@ -498,7 +498,7 @@ cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime)
|
||||
{
|
||||
int error;
|
||||
struct timeval tv;
|
||||
- timestruc_t ts;
|
||||
+ struct timespec ts;
|
||||
clock_t delta;
|
||||
|
||||
ASSERT3U(cv->cv_magic, ==, CV_MAGIC);
|
||||
@@ -536,7 +536,7 @@ cv_timedwait_hires(kcondvar_t *cv, kmutex_t *mp, hrtime_t tim, hrtime_t res,
|
||||
{
|
||||
int error;
|
||||
struct timeval tv;
|
||||
- timestruc_t ts;
|
||||
+ struct timespec ts;
|
||||
hrtime_t delta;
|
||||
|
||||
ASSERT(flag == 0 || flag == CALLOUT_FLAG_ABSOLUTE);
|
||||
diff --git a/module/zfs/dmu_objset.c b/module/zfs/dmu_objset.c
|
||||
index 3425d542..449ebedf 100644
|
||||
--- a/module/zfs/dmu_objset.c
|
||||
+++ b/module/zfs/dmu_objset.c
|
||||
@@ -860,7 +860,7 @@ dmu_objset_evict_done(objset_t *os)
|
||||
kmem_free(os, sizeof (objset_t));
|
||||
}
|
||||
|
||||
-timestruc_t
|
||||
+inode_timespec_t
|
||||
dmu_objset_snap_cmtime(objset_t *os)
|
||||
{
|
||||
return (dsl_dir_snap_cmtime(os->os_dsl_dataset->ds_dir));
|
||||
diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c
|
||||
index a3ef5896..deecf6bc 100644
|
||||
--- a/module/zfs/dsl_dir.c
|
||||
+++ b/module/zfs/dsl_dir.c
|
||||
@@ -1975,10 +1975,10 @@ dsl_dir_transfer_possible(dsl_dir_t *sdd, dsl_dir_t *tdd,
|
||||
return (0);
|
||||
}
|
||||
|
||||
-timestruc_t
|
||||
+inode_timespec_t
|
||||
dsl_dir_snap_cmtime(dsl_dir_t *dd)
|
||||
{
|
||||
- timestruc_t t;
|
||||
+ inode_timespec_t t;
|
||||
|
||||
mutex_enter(&dd->dd_lock);
|
||||
t = dd->dd_snap_cmtime;
|
||||
@@ -1990,7 +1990,7 @@ dsl_dir_snap_cmtime(dsl_dir_t *dd)
|
||||
void
|
||||
dsl_dir_snap_cmtime_update(dsl_dir_t *dd)
|
||||
{
|
||||
- timestruc_t t;
|
||||
+ inode_timespec_t t;
|
||||
|
||||
gethrestime(&t);
|
||||
mutex_enter(&dd->dd_lock);
|
||||
diff --git a/module/zfs/fm.c b/module/zfs/fm.c
|
||||
index cb148149..9d26cc99 100644
|
||||
--- a/module/zfs/fm.c
|
||||
+++ b/module/zfs/fm.c
|
||||
@@ -508,8 +508,8 @@ zfs_zevent_insert(zevent_t *ev)
|
||||
int
|
||||
zfs_zevent_post(nvlist_t *nvl, nvlist_t *detector, zevent_cb_t *cb)
|
||||
{
|
||||
+ inode_timespec_t tv;
|
||||
int64_t tv_array[2];
|
||||
- timestruc_t tv;
|
||||
uint64_t eid;
|
||||
size_t nvl_size = 0;
|
||||
zevent_t *ev;
|
||||
diff --git a/module/zfs/zfs_ctldir.c b/module/zfs/zfs_ctldir.c
|
||||
index 14af55c4..25edea78 100644
|
||||
--- a/module/zfs/zfs_ctldir.c
|
||||
+++ b/module/zfs/zfs_ctldir.c
|
||||
@@ -449,7 +449,7 @@ static struct inode *
|
||||
zfsctl_inode_alloc(zfsvfs_t *zfsvfs, uint64_t id,
|
||||
const struct file_operations *fops, const struct inode_operations *ops)
|
||||
{
|
||||
- struct timespec now;
|
||||
+ inode_timespec_t now;
|
||||
struct inode *ip;
|
||||
znode_t *zp;
|
||||
|
||||
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
|
||||
index 0d2b61a1..34ea751c 100644
|
||||
--- a/module/zfs/zfs_vnops.c
|
||||
+++ b/module/zfs/zfs_vnops.c
|
||||
@@ -3158,7 +3158,7 @@ top:
|
||||
|
||||
if (mask & (ATTR_MTIME | ATTR_SIZE)) {
|
||||
ZFS_TIME_ENCODE(&vap->va_mtime, mtime);
|
||||
- ZTOI(zp)->i_mtime = timespec_trunc(vap->va_mtime,
|
||||
+ ZTOI(zp)->i_mtime = zpl_inode_timespec_trunc(vap->va_mtime,
|
||||
ZTOI(zp)->i_sb->s_time_gran);
|
||||
|
||||
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MTIME(zfsvfs), NULL,
|
||||
@@ -3167,7 +3167,7 @@ top:
|
||||
|
||||
if (mask & (ATTR_CTIME | ATTR_SIZE)) {
|
||||
ZFS_TIME_ENCODE(&vap->va_ctime, ctime);
|
||||
- ZTOI(zp)->i_ctime = timespec_trunc(vap->va_ctime,
|
||||
+ ZTOI(zp)->i_ctime = zpl_inode_timespec_trunc(vap->va_ctime,
|
||||
ZTOI(zp)->i_sb->s_time_gran);
|
||||
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL,
|
||||
ctime, sizeof (ctime));
|
||||
diff --git a/module/zfs/zfs_znode.c b/module/zfs/zfs_znode.c
|
||||
index f508a248..e222c791 100644
|
||||
--- a/module/zfs/zfs_znode.c
|
||||
+++ b/module/zfs/zfs_znode.c
|
||||
@@ -700,7 +700,7 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr,
|
||||
uint64_t rdev = 0;
|
||||
zfsvfs_t *zfsvfs = ZTOZSB(dzp);
|
||||
dmu_buf_t *db;
|
||||
- timestruc_t now;
|
||||
+ inode_timespec_t now;
|
||||
uint64_t gen, obj;
|
||||
int bonuslen;
|
||||
int dnodesize;
|
||||
@@ -1349,7 +1349,7 @@ void
|
||||
zfs_tstamp_update_setup(znode_t *zp, uint_t flag, uint64_t mtime[2],
|
||||
uint64_t ctime[2])
|
||||
{
|
||||
- timestruc_t now;
|
||||
+ inode_timespec_t now;
|
||||
|
||||
gethrestime(&now);
|
||||
|
||||
diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c
|
||||
index 3b5643d0..41b91cab 100644
|
||||
--- a/module/zfs/zpl_inode.c
|
||||
+++ b/module/zfs/zpl_inode.c
|
||||
@@ -384,9 +384,10 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
|
||||
vap->va_mtime = ia->ia_mtime;
|
||||
vap->va_ctime = ia->ia_ctime;
|
||||
|
||||
- if (vap->va_mask & ATTR_ATIME)
|
||||
- ip->i_atime = timespec_trunc(ia->ia_atime,
|
||||
+ if (vap->va_mask & ATTR_ATIME) {
|
||||
+ ip->i_atime = zpl_inode_timespec_trunc(ia->ia_atime,
|
||||
ip->i_sb->s_time_gran);
|
||||
+ }
|
||||
|
||||
cookie = spl_fstrans_mark();
|
||||
error = -zfs_setattr(ip, vap, 0, cr);
|
||||
@@ -0,0 +1,808 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Date: Fri, 15 Jun 2018 15:05:21 -0700
|
||||
Subject: [PATCH] Linux compat 4.18: check_disk_size_change()
|
||||
|
||||
Added support for the bops->check_events() interface which was
|
||||
added in the 2.6.38 kernel to replace bops->media_changed().
|
||||
Fully implementing this functionality allows the volume resize
|
||||
code to rely on revalidate_disk(), which is the preferred
|
||||
mechanism, and removes the need to use check_disk_size_change().
|
||||
|
||||
In order for bops->check_events() to lookup the zvol_state_t
|
||||
stored in the disk->private_data the zvol_state_lock needs to
|
||||
be held. Since the check events interface may poll the mutex
|
||||
has been converted to a rwlock for better concurrently. The
|
||||
rwlock need only be taken as a writer in the zvol_free() path
|
||||
when disk->private_data is set to NULL.
|
||||
|
||||
The configure checks for the block_device_operations structure
|
||||
were consolidated in a single kernel-block-device-operations.m4
|
||||
file.
|
||||
|
||||
The ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS configure checks
|
||||
and assoicated dead code was removed. This interface was added
|
||||
to the 2.6.28 kernel which predates the oldest supported 2.6.32
|
||||
kernel and will therefore always be available.
|
||||
|
||||
Updated maximum Linux version in META file. The 4.17 kernel
|
||||
was released on 2018-06-03 and ZoL is compatible with the
|
||||
finalized kernel.
|
||||
|
||||
Reviewed-by: Boris Protopopov <boris.protopopov@actifio.com>
|
||||
Reviewed-by: Sara Hartse <sara.hartse@delphix.com>
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Closes #7611
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
config/kernel-bdev-block-device-operations.m4 | 34 ---
|
||||
.../kernel-block-device-operations-release-void.m4 | 29 ---
|
||||
config/kernel-block-device-operations.m4 | 57 +++++
|
||||
config/kernel.m4 | 2 +-
|
||||
include/linux/blkdev_compat.h | 1 +
|
||||
module/zfs/zvol.c | 259 +++++++++------------
|
||||
6 files changed, 174 insertions(+), 208 deletions(-)
|
||||
delete mode 100644 config/kernel-bdev-block-device-operations.m4
|
||||
delete mode 100644 config/kernel-block-device-operations-release-void.m4
|
||||
create mode 100644 config/kernel-block-device-operations.m4
|
||||
|
||||
diff --git a/config/kernel-bdev-block-device-operations.m4 b/config/kernel-bdev-block-device-operations.m4
|
||||
deleted file mode 100644
|
||||
index faacc195..00000000
|
||||
--- a/config/kernel-bdev-block-device-operations.m4
|
||||
+++ /dev/null
|
||||
@@ -1,34 +0,0 @@
|
||||
-dnl #
|
||||
-dnl # 2.6.x API change
|
||||
-dnl #
|
||||
-AC_DEFUN([ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS], [
|
||||
- AC_MSG_CHECKING([block device operation prototypes])
|
||||
- tmp_flags="$EXTRA_KCFLAGS"
|
||||
- EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
|
||||
- ZFS_LINUX_TRY_COMPILE([
|
||||
- #include <linux/blkdev.h>
|
||||
-
|
||||
- int blk_open(struct block_device *bdev, fmode_t mode)
|
||||
- { return 0; }
|
||||
- int blk_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
- unsigned x, unsigned long y) { return 0; }
|
||||
- int blk_compat_ioctl(struct block_device * bdev, fmode_t mode,
|
||||
- unsigned x, unsigned long y) { return 0; }
|
||||
-
|
||||
- static const struct block_device_operations
|
||||
- bops __attribute__ ((unused)) = {
|
||||
- .open = blk_open,
|
||||
- .release = NULL,
|
||||
- .ioctl = blk_ioctl,
|
||||
- .compat_ioctl = blk_compat_ioctl,
|
||||
- };
|
||||
- ],[
|
||||
- ],[
|
||||
- AC_MSG_RESULT(struct block_device)
|
||||
- AC_DEFINE(HAVE_BDEV_BLOCK_DEVICE_OPERATIONS, 1,
|
||||
- [struct block_device_operations use bdevs])
|
||||
- ],[
|
||||
- AC_MSG_RESULT(struct inode)
|
||||
- ])
|
||||
- EXTRA_KCFLAGS="$tmp_flags"
|
||||
-])
|
||||
diff --git a/config/kernel-block-device-operations-release-void.m4 b/config/kernel-block-device-operations-release-void.m4
|
||||
deleted file mode 100644
|
||||
index a73f8587..00000000
|
||||
--- a/config/kernel-block-device-operations-release-void.m4
|
||||
+++ /dev/null
|
||||
@@ -1,29 +0,0 @@
|
||||
-dnl #
|
||||
-dnl # 3.10.x API change
|
||||
-dnl #
|
||||
-AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
|
||||
- AC_MSG_CHECKING([whether block_device_operations.release is void])
|
||||
- tmp_flags="$EXTRA_KCFLAGS"
|
||||
- EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
|
||||
- ZFS_LINUX_TRY_COMPILE([
|
||||
- #include <linux/blkdev.h>
|
||||
-
|
||||
- void blk_release(struct gendisk *g, fmode_t mode) { return; }
|
||||
-
|
||||
- static const struct block_device_operations
|
||||
- bops __attribute__ ((unused)) = {
|
||||
- .open = NULL,
|
||||
- .release = blk_release,
|
||||
- .ioctl = NULL,
|
||||
- .compat_ioctl = NULL,
|
||||
- };
|
||||
- ],[
|
||||
- ],[
|
||||
- AC_MSG_RESULT(void)
|
||||
- AC_DEFINE(HAVE_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID, 1,
|
||||
- [struct block_device_operations.release returns void])
|
||||
- ],[
|
||||
- AC_MSG_RESULT(int)
|
||||
- ])
|
||||
- EXTRA_KCFLAGS="$tmp_flags"
|
||||
-])
|
||||
diff --git a/config/kernel-block-device-operations.m4 b/config/kernel-block-device-operations.m4
|
||||
new file mode 100644
|
||||
index 00000000..5f2811c1
|
||||
--- /dev/null
|
||||
+++ b/config/kernel-block-device-operations.m4
|
||||
@@ -0,0 +1,57 @@
|
||||
+dnl #
|
||||
+dnl # 2.6.38 API change
|
||||
+dnl #
|
||||
+AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [
|
||||
+ AC_MSG_CHECKING([whether bops->check_events() exists])
|
||||
+ tmp_flags="$EXTRA_KCFLAGS"
|
||||
+ EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
|
||||
+ ZFS_LINUX_TRY_COMPILE([
|
||||
+ #include <linux/blkdev.h>
|
||||
+
|
||||
+ unsigned int blk_check_events(struct gendisk *disk,
|
||||
+ unsigned int clearing) { return (0); }
|
||||
+
|
||||
+ static const struct block_device_operations
|
||||
+ bops __attribute__ ((unused)) = {
|
||||
+ .check_events = blk_check_events,
|
||||
+ };
|
||||
+ ],[
|
||||
+ ],[
|
||||
+ AC_MSG_RESULT(yes)
|
||||
+ AC_DEFINE(HAVE_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS, 1,
|
||||
+ [bops->check_events() exists])
|
||||
+ ],[
|
||||
+ AC_MSG_RESULT(no)
|
||||
+ ])
|
||||
+ EXTRA_KCFLAGS="$tmp_flags"
|
||||
+])
|
||||
+
|
||||
+dnl #
|
||||
+dnl # 3.10.x API change
|
||||
+dnl #
|
||||
+AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
|
||||
+ AC_MSG_CHECKING([whether bops->release() is void])
|
||||
+ tmp_flags="$EXTRA_KCFLAGS"
|
||||
+ EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
|
||||
+ ZFS_LINUX_TRY_COMPILE([
|
||||
+ #include <linux/blkdev.h>
|
||||
+
|
||||
+ void blk_release(struct gendisk *g, fmode_t mode) { return; }
|
||||
+
|
||||
+ static const struct block_device_operations
|
||||
+ bops __attribute__ ((unused)) = {
|
||||
+ .open = NULL,
|
||||
+ .release = blk_release,
|
||||
+ .ioctl = NULL,
|
||||
+ .compat_ioctl = NULL,
|
||||
+ };
|
||||
+ ],[
|
||||
+ ],[
|
||||
+ AC_MSG_RESULT(void)
|
||||
+ AC_DEFINE(HAVE_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID, 1,
|
||||
+ [bops->release() returns void])
|
||||
+ ],[
|
||||
+ AC_MSG_RESULT(int)
|
||||
+ ])
|
||||
+ EXTRA_KCFLAGS="$tmp_flags"
|
||||
+])
|
||||
diff --git a/config/kernel.m4 b/config/kernel.m4
|
||||
index 375e4b79..c7ca260c 100644
|
||||
--- a/config/kernel.m4
|
||||
+++ b/config/kernel.m4
|
||||
@@ -12,7 +12,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
|
||||
ZFS_AC_KERNEL_CURRENT_BIO_TAIL
|
||||
ZFS_AC_KERNEL_SUPER_USER_NS
|
||||
ZFS_AC_KERNEL_SUBMIT_BIO
|
||||
- ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS
|
||||
+ ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
|
||||
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
|
||||
ZFS_AC_KERNEL_TYPE_FMODE_T
|
||||
ZFS_AC_KERNEL_3ARG_BLKDEV_GET
|
||||
diff --git a/include/linux/blkdev_compat.h b/include/linux/blkdev_compat.h
|
||||
index f99980ab..27f05662 100644
|
||||
--- a/include/linux/blkdev_compat.h
|
||||
+++ b/include/linux/blkdev_compat.h
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/elevator.h>
|
||||
#include <linux/backing-dev.h>
|
||||
+#include <linux/msdos_fs.h> /* for SECTOR_* */
|
||||
|
||||
#ifndef HAVE_FMODE_T
|
||||
typedef unsigned __bitwise__ fmode_t;
|
||||
diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c
|
||||
index ffa5fac7..03f95630 100644
|
||||
--- a/module/zfs/zvol.c
|
||||
+++ b/module/zfs/zvol.c
|
||||
@@ -99,7 +99,7 @@ unsigned long zvol_max_discard_blocks = 16384;
|
||||
unsigned int zvol_volmode = ZFS_VOLMODE_GEOM;
|
||||
|
||||
static taskq_t *zvol_taskq;
|
||||
-static kmutex_t zvol_state_lock;
|
||||
+static krwlock_t zvol_state_lock;
|
||||
static list_t zvol_state_list;
|
||||
|
||||
#define ZVOL_HT_SIZE 1024
|
||||
@@ -176,17 +176,17 @@ zvol_find_by_dev(dev_t dev)
|
||||
{
|
||||
zvol_state_t *zv;
|
||||
|
||||
- mutex_enter(&zvol_state_lock);
|
||||
+ rw_enter(&zvol_state_lock, RW_READER);
|
||||
for (zv = list_head(&zvol_state_list); zv != NULL;
|
||||
zv = list_next(&zvol_state_list, zv)) {
|
||||
mutex_enter(&zv->zv_state_lock);
|
||||
if (zv->zv_dev == dev) {
|
||||
- mutex_exit(&zvol_state_lock);
|
||||
+ rw_exit(&zvol_state_lock);
|
||||
return (zv);
|
||||
}
|
||||
mutex_exit(&zv->zv_state_lock);
|
||||
}
|
||||
- mutex_exit(&zvol_state_lock);
|
||||
+ rw_exit(&zvol_state_lock);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
@@ -204,7 +204,7 @@ zvol_find_by_name_hash(const char *name, uint64_t hash, int mode)
|
||||
zvol_state_t *zv;
|
||||
struct hlist_node *p = NULL;
|
||||
|
||||
- mutex_enter(&zvol_state_lock);
|
||||
+ rw_enter(&zvol_state_lock, RW_READER);
|
||||
hlist_for_each(p, ZVOL_HT_HEAD(hash)) {
|
||||
zv = hlist_entry(p, zvol_state_t, zv_hlink);
|
||||
mutex_enter(&zv->zv_state_lock);
|
||||
@@ -227,12 +227,12 @@ zvol_find_by_name_hash(const char *name, uint64_t hash, int mode)
|
||||
strncmp(zv->zv_name, name, MAXNAMELEN)
|
||||
== 0);
|
||||
}
|
||||
- mutex_exit(&zvol_state_lock);
|
||||
+ rw_exit(&zvol_state_lock);
|
||||
return (zv);
|
||||
}
|
||||
mutex_exit(&zv->zv_state_lock);
|
||||
}
|
||||
- mutex_exit(&zvol_state_lock);
|
||||
+ rw_exit(&zvol_state_lock);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
@@ -339,24 +339,6 @@ zvol_get_stats(objset_t *os, nvlist_t *nv)
|
||||
return (SET_ERROR(error));
|
||||
}
|
||||
|
||||
-static void
|
||||
-zvol_size_changed(zvol_state_t *zv, uint64_t volsize)
|
||||
-{
|
||||
- struct block_device *bdev;
|
||||
-
|
||||
- ASSERT(MUTEX_HELD(&zv->zv_state_lock));
|
||||
-
|
||||
- bdev = bdget_disk(zv->zv_disk, 0);
|
||||
- if (bdev == NULL)
|
||||
- return;
|
||||
-
|
||||
- set_capacity(zv->zv_disk, volsize >> 9);
|
||||
- zv->zv_volsize = volsize;
|
||||
- check_disk_size_change(zv->zv_disk, bdev);
|
||||
-
|
||||
- bdput(bdev);
|
||||
-}
|
||||
-
|
||||
/*
|
||||
* Sanity check volume size.
|
||||
*/
|
||||
@@ -409,31 +391,17 @@ zvol_update_volsize(uint64_t volsize, objset_t *os)
|
||||
return (error);
|
||||
}
|
||||
|
||||
-static int
|
||||
-zvol_update_live_volsize(zvol_state_t *zv, uint64_t volsize)
|
||||
-{
|
||||
- zvol_size_changed(zv, volsize);
|
||||
-
|
||||
- /*
|
||||
- * We should post a event here describing the expansion. However,
|
||||
- * the zfs_ereport_post() interface doesn't nicely support posting
|
||||
- * events for zvols, it assumes events relate to vdevs or zios.
|
||||
- */
|
||||
-
|
||||
- return (0);
|
||||
-}
|
||||
-
|
||||
/*
|
||||
- * Set ZFS_PROP_VOLSIZE set entry point.
|
||||
+ * Set ZFS_PROP_VOLSIZE set entry point. Note that modifying the volume
|
||||
+ * size will result in a udev "change" event being generated.
|
||||
*/
|
||||
int
|
||||
zvol_set_volsize(const char *name, uint64_t volsize)
|
||||
{
|
||||
- zvol_state_t *zv = NULL;
|
||||
objset_t *os = NULL;
|
||||
- int error;
|
||||
- dmu_object_info_t *doi;
|
||||
+ struct gendisk *disk = NULL;
|
||||
uint64_t readonly;
|
||||
+ int error;
|
||||
boolean_t owned = B_FALSE;
|
||||
|
||||
error = dsl_prop_get_integer(name,
|
||||
@@ -443,7 +411,7 @@ zvol_set_volsize(const char *name, uint64_t volsize)
|
||||
if (readonly)
|
||||
return (SET_ERROR(EROFS));
|
||||
|
||||
- zv = zvol_find_by_name(name, RW_READER);
|
||||
+ zvol_state_t *zv = zvol_find_by_name(name, RW_READER);
|
||||
|
||||
ASSERT(zv == NULL || (MUTEX_HELD(&zv->zv_state_lock) &&
|
||||
RW_READ_HELD(&zv->zv_suspend_lock)));
|
||||
@@ -464,16 +432,18 @@ zvol_set_volsize(const char *name, uint64_t volsize)
|
||||
os = zv->zv_objset;
|
||||
}
|
||||
|
||||
- doi = kmem_alloc(sizeof (dmu_object_info_t), KM_SLEEP);
|
||||
+ dmu_object_info_t *doi = kmem_alloc(sizeof (*doi), KM_SLEEP);
|
||||
|
||||
if ((error = dmu_object_info(os, ZVOL_OBJ, doi)) ||
|
||||
(error = zvol_check_volsize(volsize, doi->doi_data_block_size)))
|
||||
goto out;
|
||||
|
||||
error = zvol_update_volsize(volsize, os);
|
||||
-
|
||||
- if (error == 0 && zv != NULL)
|
||||
- error = zvol_update_live_volsize(zv, volsize);
|
||||
+ if (error == 0 && zv != NULL) {
|
||||
+ zv->zv_volsize = volsize;
|
||||
+ zv->zv_changed = 1;
|
||||
+ disk = zv->zv_disk;
|
||||
+ }
|
||||
out:
|
||||
kmem_free(doi, sizeof (dmu_object_info_t));
|
||||
|
||||
@@ -488,6 +458,9 @@ out:
|
||||
if (zv != NULL)
|
||||
mutex_exit(&zv->zv_state_lock);
|
||||
|
||||
+ if (disk != NULL)
|
||||
+ revalidate_disk(disk);
|
||||
+
|
||||
return (SET_ERROR(error));
|
||||
}
|
||||
|
||||
@@ -543,8 +516,8 @@ zvol_set_volblocksize(const char *name, uint64_t volblocksize)
|
||||
if (zv == NULL)
|
||||
return (SET_ERROR(ENXIO));
|
||||
|
||||
- ASSERT(MUTEX_HELD(&zv->zv_state_lock) &&
|
||||
- RW_READ_HELD(&zv->zv_suspend_lock));
|
||||
+ ASSERT(MUTEX_HELD(&zv->zv_state_lock));
|
||||
+ ASSERT(RW_READ_HELD(&zv->zv_suspend_lock));
|
||||
|
||||
if (zv->zv_flags & ZVOL_RDONLY) {
|
||||
mutex_exit(&zv->zv_state_lock);
|
||||
@@ -1120,7 +1093,7 @@ zvol_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio)
|
||||
static void
|
||||
zvol_insert(zvol_state_t *zv)
|
||||
{
|
||||
- ASSERT(MUTEX_HELD(&zvol_state_lock));
|
||||
+ ASSERT(RW_WRITE_HELD(&zvol_state_lock));
|
||||
ASSERT3U(MINOR(zv->zv_dev) & ZVOL_MINOR_MASK, ==, 0);
|
||||
list_insert_head(&zvol_state_list, zv);
|
||||
hlist_add_head(&zv->zv_hlink, ZVOL_HT_HEAD(zv->zv_hash));
|
||||
@@ -1132,7 +1105,7 @@ zvol_insert(zvol_state_t *zv)
|
||||
static void
|
||||
zvol_remove(zvol_state_t *zv)
|
||||
{
|
||||
- ASSERT(MUTEX_HELD(&zvol_state_lock));
|
||||
+ ASSERT(RW_WRITE_HELD(&zvol_state_lock));
|
||||
list_remove(&zvol_state_list, zv);
|
||||
hlist_del(&zv->zv_hlink);
|
||||
}
|
||||
@@ -1148,8 +1121,8 @@ zvol_setup_zv(zvol_state_t *zv)
|
||||
uint64_t ro;
|
||||
objset_t *os = zv->zv_objset;
|
||||
|
||||
- ASSERT(MUTEX_HELD(&zv->zv_state_lock) &&
|
||||
- RW_LOCK_HELD(&zv->zv_suspend_lock));
|
||||
+ ASSERT(MUTEX_HELD(&zv->zv_state_lock));
|
||||
+ ASSERT(RW_LOCK_HELD(&zv->zv_suspend_lock));
|
||||
|
||||
error = dsl_prop_get_integer(zv->zv_name, "readonly", &ro, NULL);
|
||||
if (error)
|
||||
@@ -1227,8 +1200,8 @@ zvol_suspend(const char *name)
|
||||
return (NULL);
|
||||
|
||||
/* block all I/O, release in zvol_resume. */
|
||||
- ASSERT(MUTEX_HELD(&zv->zv_state_lock) &&
|
||||
- RW_WRITE_HELD(&zv->zv_suspend_lock));
|
||||
+ ASSERT(MUTEX_HELD(&zv->zv_state_lock));
|
||||
+ ASSERT(RW_WRITE_HELD(&zv->zv_suspend_lock));
|
||||
|
||||
atomic_inc(&zv->zv_suspend_ref);
|
||||
|
||||
@@ -1349,9 +1322,7 @@ zvol_open(struct block_device *bdev, fmode_t flag)
|
||||
int error = 0;
|
||||
boolean_t drop_suspend = B_TRUE;
|
||||
|
||||
- ASSERT(!MUTEX_HELD(&zvol_state_lock));
|
||||
-
|
||||
- mutex_enter(&zvol_state_lock);
|
||||
+ rw_enter(&zvol_state_lock, RW_READER);
|
||||
/*
|
||||
* Obtain a copy of private_data under the zvol_state_lock to make
|
||||
* sure that either the result of zvol free code path setting
|
||||
@@ -1360,7 +1331,7 @@ zvol_open(struct block_device *bdev, fmode_t flag)
|
||||
*/
|
||||
zv = bdev->bd_disk->private_data;
|
||||
if (zv == NULL) {
|
||||
- mutex_exit(&zvol_state_lock);
|
||||
+ rw_exit(&zvol_state_lock);
|
||||
return (SET_ERROR(-ENXIO));
|
||||
}
|
||||
|
||||
@@ -1384,7 +1355,7 @@ zvol_open(struct block_device *bdev, fmode_t flag)
|
||||
} else {
|
||||
drop_suspend = B_FALSE;
|
||||
}
|
||||
- mutex_exit(&zvol_state_lock);
|
||||
+ rw_exit(&zvol_state_lock);
|
||||
|
||||
ASSERT(MUTEX_HELD(&zv->zv_state_lock));
|
||||
ASSERT(zv->zv_open_count != 0 || RW_READ_HELD(&zv->zv_suspend_lock));
|
||||
@@ -1402,11 +1373,18 @@ zvol_open(struct block_device *bdev, fmode_t flag)
|
||||
|
||||
zv->zv_open_count++;
|
||||
|
||||
+ mutex_exit(&zv->zv_state_lock);
|
||||
+ if (drop_suspend)
|
||||
+ rw_exit(&zv->zv_suspend_lock);
|
||||
+
|
||||
check_disk_change(bdev);
|
||||
|
||||
+ return (0);
|
||||
+
|
||||
out_open_count:
|
||||
if (zv->zv_open_count == 0)
|
||||
zvol_last_close(zv);
|
||||
+
|
||||
out_mutex:
|
||||
mutex_exit(&zv->zv_state_lock);
|
||||
if (drop_suspend)
|
||||
@@ -1427,9 +1405,7 @@ zvol_release(struct gendisk *disk, fmode_t mode)
|
||||
zvol_state_t *zv;
|
||||
boolean_t drop_suspend = B_TRUE;
|
||||
|
||||
- ASSERT(!MUTEX_HELD(&zvol_state_lock));
|
||||
-
|
||||
- mutex_enter(&zvol_state_lock);
|
||||
+ rw_enter(&zvol_state_lock, RW_READER);
|
||||
zv = disk->private_data;
|
||||
|
||||
mutex_enter(&zv->zv_state_lock);
|
||||
@@ -1453,7 +1429,7 @@ zvol_release(struct gendisk *disk, fmode_t mode)
|
||||
} else {
|
||||
drop_suspend = B_FALSE;
|
||||
}
|
||||
- mutex_exit(&zvol_state_lock);
|
||||
+ rw_exit(&zvol_state_lock);
|
||||
|
||||
ASSERT(MUTEX_HELD(&zv->zv_state_lock));
|
||||
ASSERT(zv->zv_open_count != 1 || RW_READ_HELD(&zv->zv_suspend_lock));
|
||||
@@ -1479,7 +1455,7 @@ zvol_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
zvol_state_t *zv = bdev->bd_disk->private_data;
|
||||
int error = 0;
|
||||
|
||||
- ASSERT(zv && zv->zv_open_count > 0);
|
||||
+ ASSERT3U(zv->zv_open_count, >, 0);
|
||||
|
||||
switch (cmd) {
|
||||
case BLKFLSBUF:
|
||||
@@ -1519,23 +1495,62 @@ zvol_compat_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
#define zvol_compat_ioctl NULL
|
||||
#endif
|
||||
|
||||
+/*
|
||||
+ * Linux 2.6.38 preferred interface.
|
||||
+ */
|
||||
+#ifdef HAVE_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
|
||||
+static unsigned int
|
||||
+zvol_check_events(struct gendisk *disk, unsigned int clearing)
|
||||
+{
|
||||
+ unsigned int mask = 0;
|
||||
+
|
||||
+ rw_enter(&zvol_state_lock, RW_READER);
|
||||
+
|
||||
+ zvol_state_t *zv = disk->private_data;
|
||||
+ if (zv != NULL) {
|
||||
+ mutex_enter(&zv->zv_state_lock);
|
||||
+ mask = zv->zv_changed ? DISK_EVENT_MEDIA_CHANGE : 0;
|
||||
+ zv->zv_changed = 0;
|
||||
+ mutex_exit(&zv->zv_state_lock);
|
||||
+ }
|
||||
+
|
||||
+ rw_exit(&zvol_state_lock);
|
||||
+
|
||||
+ return (mask);
|
||||
+}
|
||||
+#else
|
||||
static int zvol_media_changed(struct gendisk *disk)
|
||||
{
|
||||
+ int changed = 0;
|
||||
+
|
||||
+ rw_enter(&zvol_state_lock, RW_READER);
|
||||
+
|
||||
zvol_state_t *zv = disk->private_data;
|
||||
+ if (zv != NULL) {
|
||||
+ mutex_enter(&zv->zv_state_lock);
|
||||
+ changed = zv->zv_changed;
|
||||
+ zv->zv_changed = 0;
|
||||
+ mutex_exit(&zv->zv_state_lock);
|
||||
+ }
|
||||
|
||||
- ASSERT(zv && zv->zv_open_count > 0);
|
||||
+ rw_exit(&zvol_state_lock);
|
||||
|
||||
- return (zv->zv_changed);
|
||||
+ return (changed);
|
||||
}
|
||||
+#endif
|
||||
|
||||
static int zvol_revalidate_disk(struct gendisk *disk)
|
||||
{
|
||||
- zvol_state_t *zv = disk->private_data;
|
||||
+ rw_enter(&zvol_state_lock, RW_READER);
|
||||
|
||||
- ASSERT(zv && zv->zv_open_count > 0);
|
||||
+ zvol_state_t *zv = disk->private_data;
|
||||
+ if (zv != NULL) {
|
||||
+ mutex_enter(&zv->zv_state_lock);
|
||||
+ set_capacity(zv->zv_disk, zv->zv_volsize >> SECTOR_BITS);
|
||||
+ mutex_exit(&zv->zv_state_lock);
|
||||
+ }
|
||||
|
||||
- zv->zv_changed = 0;
|
||||
- set_capacity(zv->zv_disk, zv->zv_volsize >> 9);
|
||||
+ rw_exit(&zvol_state_lock);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -1552,7 +1567,7 @@ zvol_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
||||
zvol_state_t *zv = bdev->bd_disk->private_data;
|
||||
sector_t sectors;
|
||||
|
||||
- ASSERT(zv && zv->zv_open_count > 0);
|
||||
+ ASSERT3U(zv->zv_open_count, >, 0);
|
||||
|
||||
sectors = get_capacity(zv->zv_disk);
|
||||
|
||||
@@ -1585,68 +1600,20 @@ zvol_probe(dev_t dev, int *part, void *arg)
|
||||
return (kobj);
|
||||
}
|
||||
|
||||
-#ifdef HAVE_BDEV_BLOCK_DEVICE_OPERATIONS
|
||||
static struct block_device_operations zvol_ops = {
|
||||
.open = zvol_open,
|
||||
.release = zvol_release,
|
||||
.ioctl = zvol_ioctl,
|
||||
.compat_ioctl = zvol_compat_ioctl,
|
||||
- .media_changed = zvol_media_changed,
|
||||
- .revalidate_disk = zvol_revalidate_disk,
|
||||
- .getgeo = zvol_getgeo,
|
||||
- .owner = THIS_MODULE,
|
||||
-};
|
||||
-
|
||||
-#else /* HAVE_BDEV_BLOCK_DEVICE_OPERATIONS */
|
||||
-
|
||||
-static int
|
||||
-zvol_open_by_inode(struct inode *inode, struct file *file)
|
||||
-{
|
||||
- return (zvol_open(inode->i_bdev, file->f_mode));
|
||||
-}
|
||||
-
|
||||
-static int
|
||||
-zvol_release_by_inode(struct inode *inode, struct file *file)
|
||||
-{
|
||||
- return (zvol_release(inode->i_bdev->bd_disk, file->f_mode));
|
||||
-}
|
||||
-
|
||||
-static int
|
||||
-zvol_ioctl_by_inode(struct inode *inode, struct file *file,
|
||||
- unsigned int cmd, unsigned long arg)
|
||||
-{
|
||||
- if (file == NULL || inode == NULL)
|
||||
- return (SET_ERROR(-EINVAL));
|
||||
-
|
||||
- return (zvol_ioctl(inode->i_bdev, file->f_mode, cmd, arg));
|
||||
-}
|
||||
-
|
||||
-#ifdef CONFIG_COMPAT
|
||||
-static long
|
||||
-zvol_compat_ioctl_by_inode(struct file *file,
|
||||
- unsigned int cmd, unsigned long arg)
|
||||
-{
|
||||
- if (file == NULL)
|
||||
- return (SET_ERROR(-EINVAL));
|
||||
-
|
||||
- return (zvol_compat_ioctl(file->f_dentry->d_inode->i_bdev,
|
||||
- file->f_mode, cmd, arg));
|
||||
-}
|
||||
+#ifdef HAVE_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
|
||||
+ .check_events = zvol_check_events,
|
||||
#else
|
||||
-#define zvol_compat_ioctl_by_inode NULL
|
||||
-#endif
|
||||
-
|
||||
-static struct block_device_operations zvol_ops = {
|
||||
- .open = zvol_open_by_inode,
|
||||
- .release = zvol_release_by_inode,
|
||||
- .ioctl = zvol_ioctl_by_inode,
|
||||
- .compat_ioctl = zvol_compat_ioctl_by_inode,
|
||||
.media_changed = zvol_media_changed,
|
||||
+#endif
|
||||
.revalidate_disk = zvol_revalidate_disk,
|
||||
.getgeo = zvol_getgeo,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
-#endif /* HAVE_BDEV_BLOCK_DEVICE_OPERATIONS */
|
||||
|
||||
/*
|
||||
* Allocate memory for a new zvol_state_t and setup the required
|
||||
@@ -1699,6 +1666,10 @@ zvol_alloc(dev_t dev, const char *name)
|
||||
rw_init(&zv->zv_suspend_lock, NULL, RW_DEFAULT, NULL);
|
||||
|
||||
zv->zv_disk->major = zvol_major;
|
||||
+#ifdef HAVE_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
|
||||
+ zv->zv_disk->events = DISK_EVENT_MEDIA_CHANGE;
|
||||
+#endif
|
||||
+
|
||||
if (volmode == ZFS_VOLMODE_DEV) {
|
||||
/*
|
||||
* ZFS_VOLMODE_DEV disable partitioning on ZVOL devices: set
|
||||
@@ -1743,7 +1714,6 @@ zvol_free(void *arg)
|
||||
{
|
||||
zvol_state_t *zv = arg;
|
||||
|
||||
- ASSERT(!MUTEX_HELD(&zvol_state_lock));
|
||||
ASSERT(!RW_LOCK_HELD(&zv->zv_suspend_lock));
|
||||
ASSERT(!MUTEX_HELD(&zv->zv_state_lock));
|
||||
ASSERT(zv->zv_open_count == 0);
|
||||
@@ -1870,9 +1840,9 @@ out_doi:
|
||||
kmem_free(doi, sizeof (dmu_object_info_t));
|
||||
|
||||
if (error == 0) {
|
||||
- mutex_enter(&zvol_state_lock);
|
||||
+ rw_enter(&zvol_state_lock, RW_WRITER);
|
||||
zvol_insert(zv);
|
||||
- mutex_exit(&zvol_state_lock);
|
||||
+ rw_exit(&zvol_state_lock);
|
||||
add_disk(zv->zv_disk);
|
||||
} else {
|
||||
ida_simple_remove(&zvol_ida, idx);
|
||||
@@ -1889,7 +1859,7 @@ zvol_rename_minor(zvol_state_t *zv, const char *newname)
|
||||
{
|
||||
int readonly = get_disk_ro(zv->zv_disk);
|
||||
|
||||
- ASSERT(MUTEX_HELD(&zvol_state_lock));
|
||||
+ ASSERT(RW_LOCK_HELD(&zvol_state_lock));
|
||||
ASSERT(MUTEX_HELD(&zv->zv_state_lock));
|
||||
|
||||
strlcpy(zv->zv_name, newname, sizeof (zv->zv_name));
|
||||
@@ -2129,7 +2099,7 @@ zvol_remove_minors_impl(const char *name)
|
||||
list_create(&free_list, sizeof (zvol_state_t),
|
||||
offsetof(zvol_state_t, zv_next));
|
||||
|
||||
- mutex_enter(&zvol_state_lock);
|
||||
+ rw_enter(&zvol_state_lock, RW_WRITER);
|
||||
|
||||
for (zv = list_head(&zvol_state_list); zv != NULL; zv = zv_next) {
|
||||
zv_next = list_next(&zvol_state_list, zv);
|
||||
@@ -2154,15 +2124,15 @@ zvol_remove_minors_impl(const char *name)
|
||||
zvol_remove(zv);
|
||||
|
||||
/*
|
||||
- * clear this while holding zvol_state_lock so
|
||||
- * zvol_open won't open it
|
||||
+ * Cleared while holding zvol_state_lock as a writer
|
||||
+ * which will prevent zvol_open() from opening it.
|
||||
*/
|
||||
zv->zv_disk->private_data = NULL;
|
||||
|
||||
/* Drop zv_state_lock before zvol_free() */
|
||||
mutex_exit(&zv->zv_state_lock);
|
||||
|
||||
- /* try parallel zv_free, if failed do it in place */
|
||||
+ /* Try parallel zv_free, if failed do it in place */
|
||||
t = taskq_dispatch(system_taskq, zvol_free, zv,
|
||||
TQ_SLEEP);
|
||||
if (t == TASKQID_INVALID)
|
||||
@@ -2173,11 +2143,9 @@ zvol_remove_minors_impl(const char *name)
|
||||
mutex_exit(&zv->zv_state_lock);
|
||||
}
|
||||
}
|
||||
- mutex_exit(&zvol_state_lock);
|
||||
+ rw_exit(&zvol_state_lock);
|
||||
|
||||
- /*
|
||||
- * Drop zvol_state_lock before calling zvol_free()
|
||||
- */
|
||||
+ /* Drop zvol_state_lock before calling zvol_free() */
|
||||
while ((zv = list_head(&free_list)) != NULL) {
|
||||
list_remove(&free_list, zv);
|
||||
zvol_free(zv);
|
||||
@@ -2196,7 +2164,7 @@ zvol_remove_minor_impl(const char *name)
|
||||
if (zvol_inhibit_dev)
|
||||
return;
|
||||
|
||||
- mutex_enter(&zvol_state_lock);
|
||||
+ rw_enter(&zvol_state_lock, RW_WRITER);
|
||||
|
||||
for (zv = list_head(&zvol_state_list); zv != NULL; zv = zv_next) {
|
||||
zv_next = list_next(&zvol_state_list, zv);
|
||||
@@ -2216,7 +2184,10 @@ zvol_remove_minor_impl(const char *name)
|
||||
}
|
||||
zvol_remove(zv);
|
||||
|
||||
- /* clear this so zvol_open won't open it */
|
||||
+ /*
|
||||
+ * Cleared while holding zvol_state_lock as a writer
|
||||
+ * which will prevent zvol_open() from opening it.
|
||||
+ */
|
||||
zv->zv_disk->private_data = NULL;
|
||||
|
||||
mutex_exit(&zv->zv_state_lock);
|
||||
@@ -2227,7 +2198,7 @@ zvol_remove_minor_impl(const char *name)
|
||||
}
|
||||
|
||||
/* Drop zvol_state_lock before calling zvol_free() */
|
||||
- mutex_exit(&zvol_state_lock);
|
||||
+ rw_exit(&zvol_state_lock);
|
||||
|
||||
if (zv != NULL)
|
||||
zvol_free(zv);
|
||||
@@ -2248,7 +2219,7 @@ zvol_rename_minors_impl(const char *oldname, const char *newname)
|
||||
oldnamelen = strlen(oldname);
|
||||
newnamelen = strlen(newname);
|
||||
|
||||
- mutex_enter(&zvol_state_lock);
|
||||
+ rw_enter(&zvol_state_lock, RW_READER);
|
||||
|
||||
for (zv = list_head(&zvol_state_list); zv != NULL; zv = zv_next) {
|
||||
zv_next = list_next(&zvol_state_list, zv);
|
||||
@@ -2276,7 +2247,7 @@ zvol_rename_minors_impl(const char *oldname, const char *newname)
|
||||
mutex_exit(&zv->zv_state_lock);
|
||||
}
|
||||
|
||||
- mutex_exit(&zvol_state_lock);
|
||||
+ rw_exit(&zvol_state_lock);
|
||||
}
|
||||
|
||||
typedef struct zvol_snapdev_cb_arg {
|
||||
@@ -2653,7 +2624,7 @@ zvol_init(void)
|
||||
|
||||
list_create(&zvol_state_list, sizeof (zvol_state_t),
|
||||
offsetof(zvol_state_t, zv_next));
|
||||
- mutex_init(&zvol_state_lock, NULL, MUTEX_DEFAULT, NULL);
|
||||
+ rw_init(&zvol_state_lock, NULL, RW_DEFAULT, NULL);
|
||||
ida_init(&zvol_ida);
|
||||
|
||||
zvol_taskq = taskq_create(ZVOL_DRIVER, threads, maxclsyspri,
|
||||
@@ -2690,7 +2661,7 @@ out_taskq:
|
||||
taskq_destroy(zvol_taskq);
|
||||
out:
|
||||
ida_destroy(&zvol_ida);
|
||||
- mutex_destroy(&zvol_state_lock);
|
||||
+ rw_destroy(&zvol_state_lock);
|
||||
list_destroy(&zvol_state_list);
|
||||
|
||||
return (SET_ERROR(error));
|
||||
@@ -2707,7 +2678,7 @@ zvol_fini(void)
|
||||
|
||||
taskq_destroy(zvol_taskq);
|
||||
list_destroy(&zvol_state_list);
|
||||
- mutex_destroy(&zvol_state_lock);
|
||||
+ rw_destroy(&zvol_state_lock);
|
||||
|
||||
ida_destroy(&zvol_ida);
|
||||
}
|
||||
@@ -0,0 +1,368 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Prakash Surya <prakash.surya@delphix.com>
|
||||
Date: Mon, 8 Jan 2018 13:45:53 -0800
|
||||
Subject: [PATCH] OpenZFS 8997 - ztest assertion failure in zil_lwb_write_issue
|
||||
|
||||
PROBLEM
|
||||
=======
|
||||
|
||||
When `dmu_tx_assign` is called from `zil_lwb_write_issue`, it's possible
|
||||
for either `ERESTART` or `EIO` to be returned.
|
||||
|
||||
If `ERESTART` is returned, this will cause an assertion to fail directly
|
||||
in `zil_lwb_write_issue`, where the code assumes the return value is
|
||||
`EIO` if `dmu_tx_assign` returns a non-zero value. This can occur if the
|
||||
SPA is suspended when `dmu_tx_assign` is called, and most often occurs
|
||||
when running `zloop`.
|
||||
|
||||
If `EIO` is returned, this can cause assertions to fail elsewhere in the
|
||||
ZIL code. For example, `zil_commit_waiter_timeout` contains the
|
||||
following logic:
|
||||
|
||||
lwb_t *nlwb = zil_lwb_write_issue(zilog, lwb);
|
||||
ASSERT3S(lwb->lwb_state, !=, LWB_STATE_OPENED);
|
||||
|
||||
In this case, if `dmu_tx_assign` returned `EIO` from within
|
||||
`zil_lwb_write_issue`, the `lwb` variable passed in will not be issued
|
||||
to disk. Thus, it's `lwb_state` field will remain `LWB_STATE_OPENED` and
|
||||
this assertion will fail. `zil_commit_waiter_timeout` assumes that after
|
||||
it calls `zil_lwb_write_issue`, the `lwb` will be issued to disk, and
|
||||
doesn't handle the case where this is not true; i.e. it doesn't handle
|
||||
the case where `dmu_tx_assign` returns `EIO`.
|
||||
|
||||
SOLUTION
|
||||
========
|
||||
|
||||
This change modifies the `dmu_tx_assign` function such that `txg_how` is
|
||||
a bitmask, rather than of the `txg_how_t` enum type. Now, the previous
|
||||
`TXG_WAITED` semantics can be used via `TXG_NOTHROTTLE`, along with
|
||||
specifying either `TXG_NOWAIT` or `TXG_WAIT` semantics.
|
||||
|
||||
Previously, when `TXG_WAITED` was specified, `TXG_NOWAIT` semantics was
|
||||
automatically invoked. This was not ideal when using `TXG_WAITED` within
|
||||
`zil_lwb_write_issued`, leading the problem described above. Rather, we
|
||||
want to achieve the semantics of `TXG_WAIT`, while also preventing the
|
||||
`tx` from being penalized via the dirty delay throttling.
|
||||
|
||||
With this change, `zil_lwb_write_issued` can acheive the semtantics that
|
||||
it requires by passing in the value `TXG_WAIT | TXG_NOTHROTTLE` to
|
||||
`dmu_tx_assign`.
|
||||
|
||||
Further, consumers of `dmu_tx_assign` wishing to achieve the old
|
||||
`TXG_WAITED` semantics can pass in the value `TXG_NOWAIT | TXG_NOTHROTTLE`.
|
||||
|
||||
Authored by: Prakash Surya <prakash.surya@delphix.com>
|
||||
Approved by: Robert Mustacchi <rm@joyent.com>
|
||||
Reviewed by: Matt Ahrens <mahrens@delphix.com>
|
||||
Reviewed by: Andriy Gapon <avg@FreeBSD.org>
|
||||
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
|
||||
Porting Notes:
|
||||
- Additionally updated `zfs_tmpfile` to use `TXG_NOTHROTTLE`
|
||||
|
||||
OpenZFS-issue: https://www.illumos.org/issues/8997
|
||||
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/19ea6cb0f9
|
||||
Closes #7084
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
include/sys/dmu.h | 15 +++++++------
|
||||
include/sys/dmu_tx.h | 8 +++----
|
||||
module/zfs/dmu_tx.c | 57 ++++++++++++++++++++++++++------------------------
|
||||
module/zfs/zfs_vnops.c | 21 ++++++++++---------
|
||||
module/zfs/zil.c | 10 ++++++++-
|
||||
5 files changed, 63 insertions(+), 48 deletions(-)
|
||||
|
||||
diff --git a/include/sys/dmu.h b/include/sys/dmu.h
|
||||
index 755a9056..5b355afb 100644
|
||||
--- a/include/sys/dmu.h
|
||||
+++ b/include/sys/dmu.h
|
||||
@@ -227,11 +227,14 @@ typedef enum dmu_object_type {
|
||||
DMU_OTN_ZAP_METADATA = DMU_OT(DMU_BSWAP_ZAP, B_TRUE),
|
||||
} dmu_object_type_t;
|
||||
|
||||
-typedef enum txg_how {
|
||||
- TXG_WAIT = 1,
|
||||
- TXG_NOWAIT,
|
||||
- TXG_WAITED,
|
||||
-} txg_how_t;
|
||||
+/*
|
||||
+ * These flags are intended to be used to specify the "txg_how"
|
||||
+ * parameter when calling the dmu_tx_assign() function. See the comment
|
||||
+ * above dmu_tx_assign() for more details on the meaning of these flags.
|
||||
+ */
|
||||
+#define TXG_NOWAIT (0ULL)
|
||||
+#define TXG_WAIT (1ULL<<0)
|
||||
+#define TXG_NOTHROTTLE (1ULL<<1)
|
||||
|
||||
void byteswap_uint64_array(void *buf, size_t size);
|
||||
void byteswap_uint32_array(void *buf, size_t size);
|
||||
@@ -694,7 +697,7 @@ void dmu_tx_hold_spill(dmu_tx_t *tx, uint64_t object);
|
||||
void dmu_tx_hold_sa(dmu_tx_t *tx, struct sa_handle *hdl, boolean_t may_grow);
|
||||
void dmu_tx_hold_sa_create(dmu_tx_t *tx, int total_size);
|
||||
void dmu_tx_abort(dmu_tx_t *tx);
|
||||
-int dmu_tx_assign(dmu_tx_t *tx, enum txg_how txg_how);
|
||||
+int dmu_tx_assign(dmu_tx_t *tx, uint64_t txg_how);
|
||||
void dmu_tx_wait(dmu_tx_t *tx);
|
||||
void dmu_tx_commit(dmu_tx_t *tx);
|
||||
void dmu_tx_mark_netfree(dmu_tx_t *tx);
|
||||
diff --git a/include/sys/dmu_tx.h b/include/sys/dmu_tx.h
|
||||
index d82a7931..74b7e111 100644
|
||||
--- a/include/sys/dmu_tx.h
|
||||
+++ b/include/sys/dmu_tx.h
|
||||
@@ -67,9 +67,6 @@ struct dmu_tx {
|
||||
/* placeholder for syncing context, doesn't need specific holds */
|
||||
boolean_t tx_anyobj;
|
||||
|
||||
- /* has this transaction already been delayed? */
|
||||
- boolean_t tx_waited;
|
||||
-
|
||||
/* transaction is marked as being a "net free" of space */
|
||||
boolean_t tx_netfree;
|
||||
|
||||
@@ -79,6 +76,9 @@ struct dmu_tx {
|
||||
/* need to wait for sufficient dirty space */
|
||||
boolean_t tx_wait_dirty;
|
||||
|
||||
+ /* has this transaction already been delayed? */
|
||||
+ boolean_t tx_dirty_delayed;
|
||||
+
|
||||
int tx_err;
|
||||
};
|
||||
|
||||
@@ -138,7 +138,7 @@ extern dmu_tx_stats_t dmu_tx_stats;
|
||||
* These routines are defined in dmu.h, and are called by the user.
|
||||
*/
|
||||
dmu_tx_t *dmu_tx_create(objset_t *dd);
|
||||
-int dmu_tx_assign(dmu_tx_t *tx, txg_how_t txg_how);
|
||||
+int dmu_tx_assign(dmu_tx_t *tx, uint64_t txg_how);
|
||||
void dmu_tx_commit(dmu_tx_t *tx);
|
||||
void dmu_tx_abort(dmu_tx_t *tx);
|
||||
uint64_t dmu_tx_get_txg(dmu_tx_t *tx);
|
||||
diff --git a/module/zfs/dmu_tx.c b/module/zfs/dmu_tx.c
|
||||
index c3cc03a6..6ebff267 100644
|
||||
--- a/module/zfs/dmu_tx.c
|
||||
+++ b/module/zfs/dmu_tx.c
|
||||
@@ -854,7 +854,7 @@ dmu_tx_delay(dmu_tx_t *tx, uint64_t dirty)
|
||||
* decreasing performance.
|
||||
*/
|
||||
static int
|
||||
-dmu_tx_try_assign(dmu_tx_t *tx, txg_how_t txg_how)
|
||||
+dmu_tx_try_assign(dmu_tx_t *tx, uint64_t txg_how)
|
||||
{
|
||||
spa_t *spa = tx->tx_pool->dp_spa;
|
||||
|
||||
@@ -878,13 +878,13 @@ dmu_tx_try_assign(dmu_tx_t *tx, txg_how_t txg_how)
|
||||
* of the failuremode setting.
|
||||
*/
|
||||
if (spa_get_failmode(spa) == ZIO_FAILURE_MODE_CONTINUE &&
|
||||
- txg_how != TXG_WAIT)
|
||||
+ !(txg_how & TXG_WAIT))
|
||||
return (SET_ERROR(EIO));
|
||||
|
||||
return (SET_ERROR(ERESTART));
|
||||
}
|
||||
|
||||
- if (!tx->tx_waited &&
|
||||
+ if (!tx->tx_dirty_delayed &&
|
||||
dsl_pool_need_dirty_delay(tx->tx_pool)) {
|
||||
tx->tx_wait_dirty = B_TRUE;
|
||||
DMU_TX_STAT_BUMP(dmu_tx_dirty_delay);
|
||||
@@ -976,41 +976,44 @@ dmu_tx_unassign(dmu_tx_t *tx)
|
||||
}
|
||||
|
||||
/*
|
||||
- * Assign tx to a transaction group. txg_how can be one of:
|
||||
+ * Assign tx to a transaction group; txg_how is a bitmask:
|
||||
*
|
||||
- * (1) TXG_WAIT. If the current open txg is full, waits until there's
|
||||
- * a new one. This should be used when you're not holding locks.
|
||||
- * It will only fail if we're truly out of space (or over quota).
|
||||
+ * If TXG_WAIT is set and the currently open txg is full, this function
|
||||
+ * will wait until there's a new txg. This should be used when no locks
|
||||
+ * are being held. With this bit set, this function will only fail if
|
||||
+ * we're truly out of space (or over quota).
|
||||
*
|
||||
- * (2) TXG_NOWAIT. If we can't assign into the current open txg without
|
||||
- * blocking, returns immediately with ERESTART. This should be used
|
||||
- * whenever you're holding locks. On an ERESTART error, the caller
|
||||
- * should drop locks, do a dmu_tx_wait(tx), and try again.
|
||||
+ * If TXG_WAIT is *not* set and we can't assign into the currently open
|
||||
+ * txg without blocking, this function will return immediately with
|
||||
+ * ERESTART. This should be used whenever locks are being held. On an
|
||||
+ * ERESTART error, the caller should drop all locks, call dmu_tx_wait(),
|
||||
+ * and try again.
|
||||
*
|
||||
- * (3) TXG_WAITED. Like TXG_NOWAIT, but indicates that dmu_tx_wait()
|
||||
- * has already been called on behalf of this operation (though
|
||||
- * most likely on a different tx).
|
||||
+ * If TXG_NOTHROTTLE is set, this indicates that this tx should not be
|
||||
+ * delayed due on the ZFS Write Throttle (see comments in dsl_pool.c for
|
||||
+ * details on the throttle). This is used by the VFS operations, after
|
||||
+ * they have already called dmu_tx_wait() (though most likely on a
|
||||
+ * different tx).
|
||||
*/
|
||||
int
|
||||
-dmu_tx_assign(dmu_tx_t *tx, txg_how_t txg_how)
|
||||
+dmu_tx_assign(dmu_tx_t *tx, uint64_t txg_how)
|
||||
{
|
||||
int err;
|
||||
|
||||
ASSERT(tx->tx_txg == 0);
|
||||
- ASSERT(txg_how == TXG_WAIT || txg_how == TXG_NOWAIT ||
|
||||
- txg_how == TXG_WAITED);
|
||||
+ ASSERT0(txg_how & ~(TXG_WAIT | TXG_NOTHROTTLE));
|
||||
ASSERT(!dsl_pool_sync_context(tx->tx_pool));
|
||||
|
||||
- if (txg_how == TXG_WAITED)
|
||||
- tx->tx_waited = B_TRUE;
|
||||
-
|
||||
/* If we might wait, we must not hold the config lock. */
|
||||
- ASSERT(txg_how != TXG_WAIT || !dsl_pool_config_held(tx->tx_pool));
|
||||
+ IMPLY((txg_how & TXG_WAIT), !dsl_pool_config_held(tx->tx_pool));
|
||||
+
|
||||
+ if ((txg_how & TXG_NOTHROTTLE))
|
||||
+ tx->tx_dirty_delayed = B_TRUE;
|
||||
|
||||
while ((err = dmu_tx_try_assign(tx, txg_how)) != 0) {
|
||||
dmu_tx_unassign(tx);
|
||||
|
||||
- if (err != ERESTART || txg_how != TXG_WAIT)
|
||||
+ if (err != ERESTART || !(txg_how & TXG_WAIT))
|
||||
return (err);
|
||||
|
||||
dmu_tx_wait(tx);
|
||||
@@ -1054,12 +1057,12 @@ dmu_tx_wait(dmu_tx_t *tx)
|
||||
tx->tx_wait_dirty = B_FALSE;
|
||||
|
||||
/*
|
||||
- * Note: setting tx_waited only has effect if the caller
|
||||
- * used TX_WAIT. Otherwise they are going to destroy
|
||||
- * this tx and try again. The common case, zfs_write(),
|
||||
- * uses TX_WAIT.
|
||||
+ * Note: setting tx_dirty_delayed only has effect if the
|
||||
+ * caller used TX_WAIT. Otherwise they are going to
|
||||
+ * destroy this tx and try again. The common case,
|
||||
+ * zfs_write(), uses TX_WAIT.
|
||||
*/
|
||||
- tx->tx_waited = B_TRUE;
|
||||
+ tx->tx_dirty_delayed = B_TRUE;
|
||||
} else if (spa_suspended(spa) || tx->tx_lasttried_txg == 0) {
|
||||
/*
|
||||
* If the pool is suspended we need to wait until it
|
||||
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
|
||||
index 34ea751c..4805f897 100644
|
||||
--- a/module/zfs/zfs_vnops.c
|
||||
+++ b/module/zfs/zfs_vnops.c
|
||||
@@ -129,7 +129,7 @@
|
||||
*
|
||||
* If dmu_tx_assign() returns ERESTART and zfsvfs->z_assign is TXG_NOWAIT,
|
||||
* then drop all locks, call dmu_tx_wait(), and try again. On subsequent
|
||||
- * calls to dmu_tx_assign(), pass TXG_WAITED rather than TXG_NOWAIT,
|
||||
+ * calls to dmu_tx_assign(), pass TXG_NOTHROTTLE in addition to TXG_NOWAIT,
|
||||
* to indicate that this operation has already called dmu_tx_wait().
|
||||
* This will ensure that we don't retry forever, waiting a short bit
|
||||
* each time.
|
||||
@@ -154,7 +154,7 @@
|
||||
* rw_enter(...); // grab any other locks you need
|
||||
* tx = dmu_tx_create(...); // get DMU tx
|
||||
* dmu_tx_hold_*(); // hold each object you might modify
|
||||
- * error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT);
|
||||
+ * error = dmu_tx_assign(tx, (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT);
|
||||
* if (error) {
|
||||
* rw_exit(...); // drop locks
|
||||
* zfs_dirent_unlock(dl); // unlock directory entry
|
||||
@@ -1427,7 +1427,8 @@ top:
|
||||
dmu_tx_hold_write(tx, DMU_NEW_OBJECT,
|
||||
0, acl_ids.z_aclp->z_acl_bytes);
|
||||
}
|
||||
- error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT);
|
||||
+ error = dmu_tx_assign(tx,
|
||||
+ (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT);
|
||||
if (error) {
|
||||
zfs_dirent_unlock(dl);
|
||||
if (error == ERESTART) {
|
||||
@@ -1602,7 +1603,7 @@ top:
|
||||
dmu_tx_hold_write(tx, DMU_NEW_OBJECT,
|
||||
0, acl_ids.z_aclp->z_acl_bytes);
|
||||
}
|
||||
- error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT);
|
||||
+ error = dmu_tx_assign(tx, (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT);
|
||||
if (error) {
|
||||
if (error == ERESTART) {
|
||||
waited = B_TRUE;
|
||||
@@ -1775,7 +1776,7 @@ top:
|
||||
*/
|
||||
dmu_tx_mark_netfree(tx);
|
||||
|
||||
- error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT);
|
||||
+ error = dmu_tx_assign(tx, (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT);
|
||||
if (error) {
|
||||
zfs_dirent_unlock(dl);
|
||||
if (error == ERESTART) {
|
||||
@@ -2017,7 +2018,7 @@ top:
|
||||
dmu_tx_hold_sa_create(tx, acl_ids.z_aclp->z_acl_bytes +
|
||||
ZFS_SA_BASE_ATTR_SIZE);
|
||||
|
||||
- error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT);
|
||||
+ error = dmu_tx_assign(tx, (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT);
|
||||
if (error) {
|
||||
zfs_dirent_unlock(dl);
|
||||
if (error == ERESTART) {
|
||||
@@ -2156,7 +2157,7 @@ top:
|
||||
zfs_sa_upgrade_txholds(tx, zp);
|
||||
zfs_sa_upgrade_txholds(tx, dzp);
|
||||
dmu_tx_mark_netfree(tx);
|
||||
- error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT);
|
||||
+ error = dmu_tx_assign(tx, (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT);
|
||||
if (error) {
|
||||
rw_exit(&zp->z_parent_lock);
|
||||
rw_exit(&zp->z_name_lock);
|
||||
@@ -3623,7 +3624,7 @@ top:
|
||||
|
||||
zfs_sa_upgrade_txholds(tx, szp);
|
||||
dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL);
|
||||
- error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT);
|
||||
+ error = dmu_tx_assign(tx, (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT);
|
||||
if (error) {
|
||||
if (zl != NULL)
|
||||
zfs_rename_unlock(&zl);
|
||||
@@ -3815,7 +3816,7 @@ top:
|
||||
}
|
||||
if (fuid_dirtied)
|
||||
zfs_fuid_txhold(zfsvfs, tx);
|
||||
- error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT);
|
||||
+ error = dmu_tx_assign(tx, (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT);
|
||||
if (error) {
|
||||
zfs_dirent_unlock(dl);
|
||||
if (error == ERESTART) {
|
||||
@@ -4041,7 +4042,7 @@ top:
|
||||
|
||||
zfs_sa_upgrade_txholds(tx, szp);
|
||||
zfs_sa_upgrade_txholds(tx, dzp);
|
||||
- error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT);
|
||||
+ error = dmu_tx_assign(tx, (waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT);
|
||||
if (error) {
|
||||
zfs_dirent_unlock(dl);
|
||||
if (error == ERESTART) {
|
||||
diff --git a/module/zfs/zil.c b/module/zfs/zil.c
|
||||
index 645b1d4d..a2bbdcb9 100644
|
||||
--- a/module/zfs/zil.c
|
||||
+++ b/module/zfs/zil.c
|
||||
@@ -1009,7 +1009,15 @@ zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb)
|
||||
* to clean up in the event of allocation failure or I/O failure.
|
||||
*/
|
||||
tx = dmu_tx_create(zilog->zl_os);
|
||||
- VERIFY(dmu_tx_assign(tx, TXG_WAIT) == 0);
|
||||
+
|
||||
+ /*
|
||||
+ * Since we are not going to create any new dirty data, and we
|
||||
+ * can even help with clearing the existing dirty data, we
|
||||
+ * should not be subject to the dirty data based delays. We
|
||||
+ * use TXG_NOTHROTTLE to bypass the delay mechanism.
|
||||
+ */
|
||||
+ VERIFY0(dmu_tx_assign(tx, TXG_WAIT | TXG_NOTHROTTLE));
|
||||
+
|
||||
dsl_dataset_dirty(dmu_objset_ds(zilog->zl_os), tx);
|
||||
txg = dmu_tx_get_txg(tx);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Olaf Faaland <faaland1@llnl.gov>
|
||||
Date: Fri, 6 Apr 2018 13:29:11 -0700
|
||||
Subject: [PATCH] Fix divide-by-zero in mmp_delay_update()
|
||||
|
||||
vdev_count_leaves() in the denominator may return 0, caught by Coverity.
|
||||
Introduced by
|
||||
|
||||
* 533ea04 Update mmp_delay on sync or skipped, failed write
|
||||
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
|
||||
Reviewed-by: George Melikov <mail@gmelikov.ru>
|
||||
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
|
||||
Closes #7391
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
module/zfs/mmp.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c
|
||||
index 1ae5f31f..3b74a6b6 100644
|
||||
--- a/module/zfs/mmp.c
|
||||
+++ b/module/zfs/mmp.c
|
||||
@@ -327,7 +327,7 @@ mmp_delay_update(spa_t *spa, boolean_t write_completed)
|
||||
*/
|
||||
if (delay < mts->mmp_delay) {
|
||||
hrtime_t min_delay = MSEC2NSEC(zfs_multihost_interval) /
|
||||
- vdev_count_leaves(spa);
|
||||
+ MAX(1, vdev_count_leaves(spa));
|
||||
mts->mmp_delay = MAX(((delay + mts->mmp_delay * 127) / 128),
|
||||
min_delay);
|
||||
}
|
||||
@@ -0,0 +1,867 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Chunwei Chen <tuxoko@gmail.com>
|
||||
Date: Wed, 18 Apr 2018 14:19:50 -0700
|
||||
Subject: [PATCH] Fix ENOSPC in "Handle zap_add() failures in ..."
|
||||
|
||||
Commit cc63068 caused ENOSPC error when copy a large amount of files
|
||||
between two directories. The reason is that the patch limits zap leaf
|
||||
expansion to 2 retries, and return ENOSPC when failed.
|
||||
|
||||
The intent for limiting retries is to prevent pointlessly growing table
|
||||
to max size when adding a block full of entries with same name in
|
||||
different case in mixed mode. However, it turns out we cannot use any
|
||||
limit on the retry. When we copy files from one directory in readdir
|
||||
order, we are copying in hash order, one leaf block at a time. Which
|
||||
means that if the leaf block in source directory has expanded 6 times,
|
||||
and you copy those entries in that block, by the time you need to expand
|
||||
the leaf in destination directory, you need to expand it 6 times in one
|
||||
go. So any limit on the retry will result in error where it shouldn't.
|
||||
|
||||
Note that while we do use different salt for different directories, it
|
||||
seems that the salt/hash function doesn't provide enough randomization
|
||||
to the hash distance to prevent this from happening.
|
||||
|
||||
Since cc63068 has already been reverted. This patch adds it back and
|
||||
removes the retry limit.
|
||||
|
||||
Also, as it turn out, failing on zap_add() has a serious side effect for
|
||||
mzap_upgrade(). When upgrading from micro zap to fat zap, it will
|
||||
call zap_add() to transfer entries one at a time. If it hit any error
|
||||
halfway through, the remaining entries will be lost, causing those files
|
||||
to become orphan. This patch add a VERIFY to catch it.
|
||||
|
||||
Reviewed-by: Sanjeev Bagewadi <sanjeev.bagewadi@gmail.com>
|
||||
Reviewed-by: Richard Yao <ryao@gentoo.org>
|
||||
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
|
||||
Reviewed-by: Albert Lee <trisk@forkgnu.org>
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
|
||||
Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
|
||||
Closes #7401
|
||||
Closes #7421
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
configure.ac | 1 +
|
||||
include/sys/zap_leaf.h | 15 ++-
|
||||
module/zfs/zap.c | 10 +-
|
||||
module/zfs/zap_leaf.c | 2 +-
|
||||
module/zfs/zap_micro.c | 47 ++++++-
|
||||
module/zfs/zfs_dir.c | 29 ++++-
|
||||
module/zfs/zfs_vnops.c | 74 ++++++++---
|
||||
tests/runfiles/linux.run | 6 +-
|
||||
tests/zfs-tests/tests/functional/Makefile.am | 1 +
|
||||
.../tests/functional/casenorm/Makefile.am | 1 +
|
||||
.../functional/casenorm/mixed_create_failure.ksh | 136 +++++++++++++++++++++
|
||||
.../zfs-tests/tests/functional/cp_files/.gitignore | 1 +
|
||||
.../tests/functional/cp_files/Makefile.am | 13 ++
|
||||
.../tests/functional/cp_files/cleanup.ksh | 34 ++++++
|
||||
.../zfs-tests/tests/functional/cp_files/cp_files.c | 58 +++++++++
|
||||
.../tests/functional/cp_files/cp_files_001_pos.ksh | 74 +++++++++++
|
||||
.../zfs-tests/tests/functional/cp_files/setup.ksh | 35 ++++++
|
||||
17 files changed, 500 insertions(+), 37 deletions(-)
|
||||
create mode 100755 tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh
|
||||
create mode 100644 tests/zfs-tests/tests/functional/cp_files/.gitignore
|
||||
create mode 100644 tests/zfs-tests/tests/functional/cp_files/Makefile.am
|
||||
create mode 100755 tests/zfs-tests/tests/functional/cp_files/cleanup.ksh
|
||||
create mode 100644 tests/zfs-tests/tests/functional/cp_files/cp_files.c
|
||||
create mode 100755 tests/zfs-tests/tests/functional/cp_files/cp_files_001_pos.ksh
|
||||
create mode 100755 tests/zfs-tests/tests/functional/cp_files/setup.ksh
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index d9441a0f..3f4925c3 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -238,6 +238,7 @@ AC_CONFIG_FILES([
|
||||
tests/zfs-tests/tests/functional/cli_user/zpool_iostat/Makefile
|
||||
tests/zfs-tests/tests/functional/cli_user/zpool_list/Makefile
|
||||
tests/zfs-tests/tests/functional/compression/Makefile
|
||||
+ tests/zfs-tests/tests/functional/cp_files/Makefile
|
||||
tests/zfs-tests/tests/functional/ctime/Makefile
|
||||
tests/zfs-tests/tests/functional/delegate/Makefile
|
||||
tests/zfs-tests/tests/functional/devices/Makefile
|
||||
diff --git a/include/sys/zap_leaf.h b/include/sys/zap_leaf.h
|
||||
index e784c596..a3da1036 100644
|
||||
--- a/include/sys/zap_leaf.h
|
||||
+++ b/include/sys/zap_leaf.h
|
||||
@@ -46,10 +46,15 @@ struct zap_stats;
|
||||
* block size (1<<l->l_bs) - hash entry size (2) * number of hash
|
||||
* entries - header space (2*chunksize)
|
||||
*/
|
||||
-#define ZAP_LEAF_NUMCHUNKS(l) \
|
||||
- (((1<<(l)->l_bs) - 2*ZAP_LEAF_HASH_NUMENTRIES(l)) / \
|
||||
+#define ZAP_LEAF_NUMCHUNKS_BS(bs) \
|
||||
+ (((1<<(bs)) - 2*ZAP_LEAF_HASH_NUMENTRIES_BS(bs)) / \
|
||||
ZAP_LEAF_CHUNKSIZE - 2)
|
||||
|
||||
+#define ZAP_LEAF_NUMCHUNKS(l) (ZAP_LEAF_NUMCHUNKS_BS(((l)->l_bs)))
|
||||
+
|
||||
+#define ZAP_LEAF_NUMCHUNKS_DEF \
|
||||
+ (ZAP_LEAF_NUMCHUNKS_BS(fzap_default_block_shift))
|
||||
+
|
||||
/*
|
||||
* The amount of space within the chunk available for the array is:
|
||||
* chunk size - space for type (1) - space for next pointer (2)
|
||||
@@ -74,8 +79,10 @@ struct zap_stats;
|
||||
* which is less than block size / CHUNKSIZE (24) / minimum number of
|
||||
* chunks per entry (3).
|
||||
*/
|
||||
-#define ZAP_LEAF_HASH_SHIFT(l) ((l)->l_bs - 5)
|
||||
-#define ZAP_LEAF_HASH_NUMENTRIES(l) (1 << ZAP_LEAF_HASH_SHIFT(l))
|
||||
+#define ZAP_LEAF_HASH_SHIFT_BS(bs) ((bs) - 5)
|
||||
+#define ZAP_LEAF_HASH_NUMENTRIES_BS(bs) (1 << ZAP_LEAF_HASH_SHIFT_BS(bs))
|
||||
+#define ZAP_LEAF_HASH_SHIFT(l) (ZAP_LEAF_HASH_SHIFT_BS(((l)->l_bs)))
|
||||
+#define ZAP_LEAF_HASH_NUMENTRIES(l) (ZAP_LEAF_HASH_NUMENTRIES_BS(((l)->l_bs)))
|
||||
|
||||
/*
|
||||
* The chunks start immediately after the hash table. The end of the
|
||||
diff --git a/module/zfs/zap.c b/module/zfs/zap.c
|
||||
index ee9962bf..47b4c1ab 100644
|
||||
--- a/module/zfs/zap.c
|
||||
+++ b/module/zfs/zap.c
|
||||
@@ -853,8 +853,16 @@ retry:
|
||||
} else if (err == EAGAIN) {
|
||||
err = zap_expand_leaf(zn, l, tag, tx, &l);
|
||||
zap = zn->zn_zap; /* zap_expand_leaf() may change zap */
|
||||
- if (err == 0)
|
||||
+ if (err == 0) {
|
||||
goto retry;
|
||||
+ } else if (err == ENOSPC) {
|
||||
+ /*
|
||||
+ * If we failed to expand the leaf, then bailout
|
||||
+ * as there is no point trying
|
||||
+ * zap_put_leaf_maybe_grow_ptrtbl().
|
||||
+ */
|
||||
+ return (err);
|
||||
+ }
|
||||
}
|
||||
|
||||
out:
|
||||
diff --git a/module/zfs/zap_leaf.c b/module/zfs/zap_leaf.c
|
||||
index c342695c..526e4660 100644
|
||||
--- a/module/zfs/zap_leaf.c
|
||||
+++ b/module/zfs/zap_leaf.c
|
||||
@@ -53,7 +53,7 @@ static uint16_t *zap_leaf_rehash_entry(zap_leaf_t *l, uint16_t entry);
|
||||
((h) >> \
|
||||
(64 - ZAP_LEAF_HASH_SHIFT(l) - zap_leaf_phys(l)->l_hdr.lh_prefix_len)))
|
||||
|
||||
-#define LEAF_HASH_ENTPTR(l, h) (&zap_leaf_phys(l)->l_hash[LEAF_HASH(l, h)])
|
||||
+#define LEAF_HASH_ENTPTR(l, h) (&zap_leaf_phys(l)->l_hash[LEAF_HASH(l, h)])
|
||||
|
||||
extern inline zap_leaf_phys_t *zap_leaf_phys(zap_leaf_t *l);
|
||||
|
||||
diff --git a/module/zfs/zap_micro.c b/module/zfs/zap_micro.c
|
||||
index 3ebf995c..60e193ef 100644
|
||||
--- a/module/zfs/zap_micro.c
|
||||
+++ b/module/zfs/zap_micro.c
|
||||
@@ -363,6 +363,41 @@ mze_find_unused_cd(zap_t *zap, uint64_t hash)
|
||||
return (cd);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Each mzap entry requires at max : 4 chunks
|
||||
+ * 3 chunks for names + 1 chunk for value.
|
||||
+ */
|
||||
+#define MZAP_ENT_CHUNKS (1 + ZAP_LEAF_ARRAY_NCHUNKS(MZAP_NAME_LEN) + \
|
||||
+ ZAP_LEAF_ARRAY_NCHUNKS(sizeof (uint64_t)))
|
||||
+
|
||||
+/*
|
||||
+ * Check if the current entry keeps the colliding entries under the fatzap leaf
|
||||
+ * size.
|
||||
+ */
|
||||
+static boolean_t
|
||||
+mze_canfit_fzap_leaf(zap_name_t *zn, uint64_t hash)
|
||||
+{
|
||||
+ zap_t *zap = zn->zn_zap;
|
||||
+ mzap_ent_t mze_tofind;
|
||||
+ mzap_ent_t *mze;
|
||||
+ avl_index_t idx;
|
||||
+ avl_tree_t *avl = &zap->zap_m.zap_avl;
|
||||
+ uint32_t mzap_ents = 0;
|
||||
+
|
||||
+ mze_tofind.mze_hash = hash;
|
||||
+ mze_tofind.mze_cd = 0;
|
||||
+
|
||||
+ for (mze = avl_find(avl, &mze_tofind, &idx);
|
||||
+ mze && mze->mze_hash == hash; mze = AVL_NEXT(avl, mze)) {
|
||||
+ mzap_ents++;
|
||||
+ }
|
||||
+
|
||||
+ /* Include the new entry being added */
|
||||
+ mzap_ents++;
|
||||
+
|
||||
+ return (ZAP_LEAF_NUMCHUNKS_DEF > (mzap_ents * MZAP_ENT_CHUNKS));
|
||||
+}
|
||||
+
|
||||
static void
|
||||
mze_remove(zap_t *zap, mzap_ent_t *mze)
|
||||
{
|
||||
@@ -639,16 +674,15 @@ mzap_upgrade(zap_t **zapp, void *tag, dmu_tx_t *tx, zap_flags_t flags)
|
||||
dprintf("adding %s=%llu\n",
|
||||
mze->mze_name, mze->mze_value);
|
||||
zn = zap_name_alloc(zap, mze->mze_name, 0);
|
||||
- err = fzap_add_cd(zn, 8, 1, &mze->mze_value, mze->mze_cd,
|
||||
- tag, tx);
|
||||
+ /* If we fail here, we would end up losing entries */
|
||||
+ VERIFY0(fzap_add_cd(zn, 8, 1, &mze->mze_value, mze->mze_cd,
|
||||
+ tag, tx));
|
||||
zap = zn->zn_zap; /* fzap_add_cd() may change zap */
|
||||
zap_name_free(zn);
|
||||
- if (err)
|
||||
- break;
|
||||
}
|
||||
vmem_free(mzp, sz);
|
||||
*zapp = zap;
|
||||
- return (err);
|
||||
+ return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1191,7 +1225,8 @@ zap_add_impl(zap_t *zap, const char *key,
|
||||
err = fzap_add(zn, integer_size, num_integers, val, tag, tx);
|
||||
zap = zn->zn_zap; /* fzap_add() may change zap */
|
||||
} else if (integer_size != 8 || num_integers != 1 ||
|
||||
- strlen(key) >= MZAP_NAME_LEN) {
|
||||
+ strlen(key) >= MZAP_NAME_LEN ||
|
||||
+ !mze_canfit_fzap_leaf(zn, zn->zn_hash)) {
|
||||
err = mzap_upgrade(&zn->zn_zap, tag, tx, 0);
|
||||
if (err == 0) {
|
||||
err = fzap_add(zn, integer_size, num_integers, val,
|
||||
diff --git a/module/zfs/zfs_dir.c b/module/zfs/zfs_dir.c
|
||||
index 9a8bbccd..6398a1d1 100644
|
||||
--- a/module/zfs/zfs_dir.c
|
||||
+++ b/module/zfs/zfs_dir.c
|
||||
@@ -742,7 +742,11 @@ zfs_dirent(znode_t *zp, uint64_t mode)
|
||||
}
|
||||
|
||||
/*
|
||||
- * Link zp into dl. Can only fail if zp has been unlinked.
|
||||
+ * Link zp into dl. Can fail in the following cases :
|
||||
+ * - if zp has been unlinked.
|
||||
+ * - if the number of entries with the same hash (aka. colliding entries)
|
||||
+ * exceed the capacity of a leaf-block of fatzap and splitting of the
|
||||
+ * leaf-block does not help.
|
||||
*/
|
||||
int
|
||||
zfs_link_create(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag)
|
||||
@@ -776,6 +780,24 @@ zfs_link_create(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag)
|
||||
NULL, &links, sizeof (links));
|
||||
}
|
||||
}
|
||||
+
|
||||
+ value = zfs_dirent(zp, zp->z_mode);
|
||||
+ error = zap_add(ZTOZSB(zp)->z_os, dzp->z_id, dl->dl_name, 8, 1,
|
||||
+ &value, tx);
|
||||
+
|
||||
+ /*
|
||||
+ * zap_add could fail to add the entry if it exceeds the capacity of the
|
||||
+ * leaf-block and zap_leaf_split() failed to help.
|
||||
+ * The caller of this routine is responsible for failing the transaction
|
||||
+ * which will rollback the SA updates done above.
|
||||
+ */
|
||||
+ if (error != 0) {
|
||||
+ if (!(flag & ZRENAMING) && !(flag & ZNEW))
|
||||
+ drop_nlink(ZTOI(zp));
|
||||
+ mutex_exit(&zp->z_lock);
|
||||
+ return (error);
|
||||
+ }
|
||||
+
|
||||
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_PARENT(zfsvfs), NULL,
|
||||
&dzp->z_id, sizeof (dzp->z_id));
|
||||
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_FLAGS(zfsvfs), NULL,
|
||||
@@ -813,11 +835,6 @@ zfs_link_create(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag)
|
||||
ASSERT(error == 0);
|
||||
mutex_exit(&dzp->z_lock);
|
||||
|
||||
- value = zfs_dirent(zp, zp->z_mode);
|
||||
- error = zap_add(ZTOZSB(zp)->z_os, dzp->z_id, dl->dl_name,
|
||||
- 8, 1, &value, tx);
|
||||
- ASSERT(error == 0);
|
||||
-
|
||||
return (0);
|
||||
}
|
||||
|
||||
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
|
||||
index 4805f897..5a2e55eb 100644
|
||||
--- a/module/zfs/zfs_vnops.c
|
||||
+++ b/module/zfs/zfs_vnops.c
|
||||
@@ -1427,6 +1427,7 @@ top:
|
||||
dmu_tx_hold_write(tx, DMU_NEW_OBJECT,
|
||||
0, acl_ids.z_aclp->z_acl_bytes);
|
||||
}
|
||||
+
|
||||
error = dmu_tx_assign(tx,
|
||||
(waited ? TXG_NOTHROTTLE : 0) | TXG_NOWAIT);
|
||||
if (error) {
|
||||
@@ -1444,10 +1445,22 @@ top:
|
||||
}
|
||||
zfs_mknode(dzp, vap, tx, cr, 0, &zp, &acl_ids);
|
||||
|
||||
+ error = zfs_link_create(dl, zp, tx, ZNEW);
|
||||
+ if (error != 0) {
|
||||
+ /*
|
||||
+ * Since, we failed to add the directory entry for it,
|
||||
+ * delete the newly created dnode.
|
||||
+ */
|
||||
+ zfs_znode_delete(zp, tx);
|
||||
+ remove_inode_hash(ZTOI(zp));
|
||||
+ zfs_acl_ids_free(&acl_ids);
|
||||
+ dmu_tx_commit(tx);
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
if (fuid_dirtied)
|
||||
zfs_fuid_sync(zfsvfs, tx);
|
||||
|
||||
- (void) zfs_link_create(dl, zp, tx, ZNEW);
|
||||
txtype = zfs_log_create_txtype(Z_FILE, vsecp, vap);
|
||||
if (flag & FIGNORECASE)
|
||||
txtype |= TX_CI;
|
||||
@@ -2038,13 +2051,18 @@ top:
|
||||
*/
|
||||
zfs_mknode(dzp, vap, tx, cr, 0, &zp, &acl_ids);
|
||||
|
||||
- if (fuid_dirtied)
|
||||
- zfs_fuid_sync(zfsvfs, tx);
|
||||
-
|
||||
/*
|
||||
* Now put new name in parent dir.
|
||||
*/
|
||||
- (void) zfs_link_create(dl, zp, tx, ZNEW);
|
||||
+ error = zfs_link_create(dl, zp, tx, ZNEW);
|
||||
+ if (error != 0) {
|
||||
+ zfs_znode_delete(zp, tx);
|
||||
+ remove_inode_hash(ZTOI(zp));
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (fuid_dirtied)
|
||||
+ zfs_fuid_sync(zfsvfs, tx);
|
||||
|
||||
*ipp = ZTOI(zp);
|
||||
|
||||
@@ -2054,6 +2072,7 @@ top:
|
||||
zfs_log_create(zilog, tx, txtype, dzp, zp, dirname, vsecp,
|
||||
acl_ids.z_fuidp, vap);
|
||||
|
||||
+out:
|
||||
zfs_acl_ids_free(&acl_ids);
|
||||
|
||||
dmu_tx_commit(tx);
|
||||
@@ -2063,10 +2082,14 @@ top:
|
||||
if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
|
||||
zil_commit(zilog, 0);
|
||||
|
||||
- zfs_inode_update(dzp);
|
||||
- zfs_inode_update(zp);
|
||||
+ if (error != 0) {
|
||||
+ iput(ZTOI(zp));
|
||||
+ } else {
|
||||
+ zfs_inode_update(dzp);
|
||||
+ zfs_inode_update(zp);
|
||||
+ }
|
||||
ZFS_EXIT(zfsvfs);
|
||||
- return (0);
|
||||
+ return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3684,6 +3707,13 @@ top:
|
||||
VERIFY3U(zfs_link_destroy(tdl, szp, tx,
|
||||
ZRENAMING, NULL), ==, 0);
|
||||
}
|
||||
+ } else {
|
||||
+ /*
|
||||
+ * If we had removed the existing target, subsequent
|
||||
+ * call to zfs_link_create() to add back the same entry
|
||||
+ * but, the new dnode (szp) should not fail.
|
||||
+ */
|
||||
+ ASSERT(tzp == NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3854,14 +3884,18 @@ top:
|
||||
/*
|
||||
* Insert the new object into the directory.
|
||||
*/
|
||||
- (void) zfs_link_create(dl, zp, tx, ZNEW);
|
||||
-
|
||||
- if (flags & FIGNORECASE)
|
||||
- txtype |= TX_CI;
|
||||
- zfs_log_symlink(zilog, tx, txtype, dzp, zp, name, link);
|
||||
+ error = zfs_link_create(dl, zp, tx, ZNEW);
|
||||
+ if (error != 0) {
|
||||
+ zfs_znode_delete(zp, tx);
|
||||
+ remove_inode_hash(ZTOI(zp));
|
||||
+ } else {
|
||||
+ if (flags & FIGNORECASE)
|
||||
+ txtype |= TX_CI;
|
||||
+ zfs_log_symlink(zilog, tx, txtype, dzp, zp, name, link);
|
||||
|
||||
- zfs_inode_update(dzp);
|
||||
- zfs_inode_update(zp);
|
||||
+ zfs_inode_update(dzp);
|
||||
+ zfs_inode_update(zp);
|
||||
+ }
|
||||
|
||||
zfs_acl_ids_free(&acl_ids);
|
||||
|
||||
@@ -3869,10 +3903,14 @@ top:
|
||||
|
||||
zfs_dirent_unlock(dl);
|
||||
|
||||
- *ipp = ZTOI(zp);
|
||||
+ if (error == 0) {
|
||||
+ *ipp = ZTOI(zp);
|
||||
|
||||
- if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
|
||||
- zil_commit(zilog, 0);
|
||||
+ if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
|
||||
+ zil_commit(zilog, 0);
|
||||
+ } else {
|
||||
+ iput(ZTOI(zp));
|
||||
+ }
|
||||
|
||||
ZFS_EXIT(zfsvfs);
|
||||
return (error);
|
||||
diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run
|
||||
index 272c8c77..379c9f73 100644
|
||||
--- a/tests/runfiles/linux.run
|
||||
+++ b/tests/runfiles/linux.run
|
||||
@@ -55,7 +55,7 @@ tags = ['functional', 'cachefile']
|
||||
# 'mixed_none_lookup', 'mixed_none_lookup_ci', 'mixed_none_delete',
|
||||
# 'mixed_formd_lookup', 'mixed_formd_lookup_ci', 'mixed_formd_delete']
|
||||
[tests/functional/casenorm]
|
||||
-tests = ['case_all_values', 'norm_all_values']
|
||||
+tests = ['case_all_values', 'norm_all_values', 'mixed_create_failure']
|
||||
tags = ['functional', 'casenorm']
|
||||
|
||||
[tests/functional/chattr]
|
||||
@@ -394,6 +394,10 @@ tests = ['compress_001_pos', 'compress_002_pos', 'compress_003_pos',
|
||||
'compress_004_pos']
|
||||
tags = ['functional', 'compression']
|
||||
|
||||
+[tests/functional/cp_files]
|
||||
+tests = ['cp_files_001_pos']
|
||||
+tags = ['functional', 'cp_files']
|
||||
+
|
||||
[tests/functional/ctime]
|
||||
tests = ['ctime_001_pos' ]
|
||||
tags = ['functional', 'ctime']
|
||||
diff --git a/tests/zfs-tests/tests/functional/Makefile.am b/tests/zfs-tests/tests/functional/Makefile.am
|
||||
index cd60324f..ea52205a 100644
|
||||
--- a/tests/zfs-tests/tests/functional/Makefile.am
|
||||
+++ b/tests/zfs-tests/tests/functional/Makefile.am
|
||||
@@ -11,6 +11,7 @@ SUBDIRS = \
|
||||
cli_root \
|
||||
cli_user \
|
||||
compression \
|
||||
+ cp_files \
|
||||
ctime \
|
||||
delegate \
|
||||
devices \
|
||||
diff --git a/tests/zfs-tests/tests/functional/casenorm/Makefile.am b/tests/zfs-tests/tests/functional/casenorm/Makefile.am
|
||||
index 65dd156e..b284a256 100644
|
||||
--- a/tests/zfs-tests/tests/functional/casenorm/Makefile.am
|
||||
+++ b/tests/zfs-tests/tests/functional/casenorm/Makefile.am
|
||||
@@ -7,6 +7,7 @@ dist_pkgdata_SCRIPTS = \
|
||||
insensitive_formd_lookup.ksh \
|
||||
insensitive_none_delete.ksh \
|
||||
insensitive_none_lookup.ksh \
|
||||
+ mixed_create_failure.ksh \
|
||||
mixed_formd_delete.ksh \
|
||||
mixed_formd_lookup_ci.ksh \
|
||||
mixed_formd_lookup.ksh \
|
||||
diff --git a/tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh b/tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh
|
||||
new file mode 100755
|
||||
index 00000000..51b5bb3f
|
||||
--- /dev/null
|
||||
+++ b/tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh
|
||||
@@ -0,0 +1,136 @@
|
||||
+#!/bin/ksh -p
|
||||
+#
|
||||
+#
|
||||
+# This file and its contents are supplied under the terms of the
|
||||
+# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
+# You may only use this file in accordance with the terms of version
|
||||
+# 1.0 of the CDDL.
|
||||
+#
|
||||
+# A full copy of the text of the CDDL should have accompanied this
|
||||
+# source. A copy of the CDDL is also available via the Internet at
|
||||
+# http://www.illumos.org/license/CDDL.
|
||||
+#
|
||||
+#
|
||||
+# Copyright 2018 Nutanix Inc. All rights reserved.
|
||||
+#
|
||||
+
|
||||
+. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
|
||||
+
|
||||
+# DESCRIPTION:
|
||||
+# For the filesystem with casesensitivity=mixed, normalization=none,
|
||||
+# when multiple files with the same name (differing only in case) are created,
|
||||
+# the number of files is limited to what can fit in a fatzap leaf-block.
|
||||
+# And beyond that, it fails with ENOSPC.
|
||||
+#
|
||||
+# Ensure that the create/rename operations fail gracefully and not trigger an
|
||||
+# ASSERT.
|
||||
+#
|
||||
+# STRATEGY:
|
||||
+# Repeat the below steps for objects: files, directories, symlinks and hardlinks
|
||||
+# 1. Create objects with same name but varying in case.
|
||||
+# E.g. 'abcdefghijklmnop', 'Abcdefghijklmnop', 'ABcdefghijklmnop' etc.
|
||||
+# The create should fail with ENOSPC.
|
||||
+# 2. Create an object with name 'tmp_obj' and try to rename it to name that we
|
||||
+# failed to add in step 1 above.
|
||||
+# This should fail as well.
|
||||
+
|
||||
+verify_runnable "global"
|
||||
+
|
||||
+function cleanup
|
||||
+{
|
||||
+ destroy_testfs
|
||||
+}
|
||||
+
|
||||
+log_onexit cleanup
|
||||
+log_assert "With mixed mode: ensure create fails with ENOSPC beyond a certain limit"
|
||||
+
|
||||
+create_testfs "-o casesensitivity=mixed -o normalization=none"
|
||||
+
|
||||
+# Different object types
|
||||
+obj_type=('file' 'dir' 'symlink' 'hardlink')
|
||||
+
|
||||
+# Commands to create different object types
|
||||
+typeset -A ops
|
||||
+ops['file']='touch'
|
||||
+ops['dir']='mkdir'
|
||||
+ops['symlink']='ln -s'
|
||||
+ops['hardlink']='ln'
|
||||
+
|
||||
+# This function tests the following for a give object type :
|
||||
+# - Create multiple objects with the same name (varying only in case).
|
||||
+# Ensure that it eventually fails once the leaf-block limit is exceeded.
|
||||
+# - Create another object with a different name. And attempt rename it to the
|
||||
+# name (for which the create had failed in the previous step).
|
||||
+# This should fail as well.
|
||||
+# Args :
|
||||
+# $1 - object type (file/dir/symlink/hardlink)
|
||||
+# $2 - test directory
|
||||
+#
|
||||
+function test_ops
|
||||
+{
|
||||
+ typeset obj_type=$1
|
||||
+ typeset testdir=$2
|
||||
+
|
||||
+ target_obj='target-file'
|
||||
+
|
||||
+ op="${ops[$obj_type]}"
|
||||
+
|
||||
+ log_note "The op : $op"
|
||||
+ log_note "testdir=$testdir obj_type=$obj_type"
|
||||
+
|
||||
+ test_path="$testdir/$obj_type"
|
||||
+ mkdir $test_path
|
||||
+ log_note "Created test dir $test_path"
|
||||
+
|
||||
+ if [[ $obj_type = "symlink" || $obj_type = "hardlink" ]]; then
|
||||
+ touch $test_path/$target_obj
|
||||
+ log_note "Created target: $test_path/$target_obj"
|
||||
+ op="$op $test_path/$target_obj"
|
||||
+ fi
|
||||
+
|
||||
+ log_note "op : $op"
|
||||
+ names='{a,A}{b,B}{c,C}{d,D}{e,E}{f,F}{g,G}{h,H}{i,I}{j,J}{k,K}{l,L}'
|
||||
+ for name in $names; do
|
||||
+ cmd="$op $test_path/$name"
|
||||
+ out=$($cmd 2>&1)
|
||||
+ ret=$?
|
||||
+ log_note "cmd: $cmd ret: $ret out=$out"
|
||||
+ if (($ret != 0)); then
|
||||
+ if [[ $out = *@(No space left on device)* ]]; then
|
||||
+ save_name="$test_path/$name"
|
||||
+ break;
|
||||
+ else
|
||||
+ log_err "$cmd failed with unexpected error : $out"
|
||||
+ fi
|
||||
+ fi
|
||||
+ done
|
||||
+
|
||||
+ log_note 'Test rename \"sample_name\" rename'
|
||||
+ TMP_OBJ="$test_path/tmp_obj"
|
||||
+ cmd="$op $TMP_OBJ"
|
||||
+ out=$($cmd 2>&1)
|
||||
+ ret=$?
|
||||
+ if (($ret != 0)); then
|
||||
+ log_err "cmd:$cmd failed out:$out"
|
||||
+ fi
|
||||
+
|
||||
+ # Now, try to rename the tmp_obj to the name which we failed to add earlier.
|
||||
+ # This should fail as well.
|
||||
+ out=$(mv $TMP_OBJ $save_name 2>&1)
|
||||
+ ret=$?
|
||||
+ if (($ret != 0)); then
|
||||
+ if [[ $out = *@(No space left on device)* ]]; then
|
||||
+ log_note "$cmd failed as expected : $out"
|
||||
+ else
|
||||
+ log_err "$cmd failed with : $out"
|
||||
+ fi
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+for obj_type in ${obj_type[*]};
|
||||
+do
|
||||
+ log_note "Testing create of $obj_type"
|
||||
+ test_ops $obj_type $TESTDIR
|
||||
+done
|
||||
+
|
||||
+log_pass "Mixed mode FS: Ops on large number of colliding names fail gracefully"
|
||||
diff --git a/tests/zfs-tests/tests/functional/cp_files/.gitignore b/tests/zfs-tests/tests/functional/cp_files/.gitignore
|
||||
new file mode 100644
|
||||
index 00000000..eac05e15
|
||||
--- /dev/null
|
||||
+++ b/tests/zfs-tests/tests/functional/cp_files/.gitignore
|
||||
@@ -0,0 +1 @@
|
||||
+/cp_files
|
||||
diff --git a/tests/zfs-tests/tests/functional/cp_files/Makefile.am b/tests/zfs-tests/tests/functional/cp_files/Makefile.am
|
||||
new file mode 100644
|
||||
index 00000000..06c31f5f
|
||||
--- /dev/null
|
||||
+++ b/tests/zfs-tests/tests/functional/cp_files/Makefile.am
|
||||
@@ -0,0 +1,13 @@
|
||||
+include $(top_srcdir)/config/Rules.am
|
||||
+
|
||||
+pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cp_files
|
||||
+
|
||||
+dist_pkgdata_SCRIPTS = \
|
||||
+ cp_files_001_pos.ksh \
|
||||
+ cleanup.ksh \
|
||||
+ setup.ksh
|
||||
+
|
||||
+pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cp_files
|
||||
+
|
||||
+pkgexec_PROGRAMS = cp_files
|
||||
+cp_files_SOURCES= cp_files.c
|
||||
diff --git a/tests/zfs-tests/tests/functional/cp_files/cleanup.ksh b/tests/zfs-tests/tests/functional/cp_files/cleanup.ksh
|
||||
new file mode 100755
|
||||
index 00000000..3166bd6e
|
||||
--- /dev/null
|
||||
+++ b/tests/zfs-tests/tests/functional/cp_files/cleanup.ksh
|
||||
@@ -0,0 +1,34 @@
|
||||
+#!/bin/ksh -p
|
||||
+#
|
||||
+# CDDL HEADER START
|
||||
+#
|
||||
+# The contents of this file are subject to the terms of the
|
||||
+# Common Development and Distribution License (the "License").
|
||||
+# You may not use this file except in compliance with the License.
|
||||
+#
|
||||
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
+# or http://www.opensolaris.org/os/licensing.
|
||||
+# See the License for the specific language governing permissions
|
||||
+# and limitations under the License.
|
||||
+#
|
||||
+# When distributing Covered Code, include this CDDL HEADER in each
|
||||
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
+# If applicable, add the following below this CDDL HEADER, with the
|
||||
+# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
+# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
+#
|
||||
+# CDDL HEADER END
|
||||
+#
|
||||
+
|
||||
+#
|
||||
+# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
+# Use is subject to license terms.
|
||||
+#
|
||||
+
|
||||
+#
|
||||
+# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
+#
|
||||
+
|
||||
+. $STF_SUITE/include/libtest.shlib
|
||||
+
|
||||
+default_cleanup
|
||||
diff --git a/tests/zfs-tests/tests/functional/cp_files/cp_files.c b/tests/zfs-tests/tests/functional/cp_files/cp_files.c
|
||||
new file mode 100644
|
||||
index 00000000..9af64a11
|
||||
--- /dev/null
|
||||
+++ b/tests/zfs-tests/tests/functional/cp_files/cp_files.c
|
||||
@@ -0,0 +1,58 @@
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/stat.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <dirent.h>
|
||||
+#include <errno.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+int
|
||||
+main(int argc, char *argv[])
|
||||
+{
|
||||
+ int tfd;
|
||||
+ DIR *sdir;
|
||||
+ struct dirent *dirent;
|
||||
+
|
||||
+ if (argc != 3) {
|
||||
+ fprintf(stderr, "Usage: %s SRC DST\n", argv[0]);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
+ sdir = opendir(argv[1]);
|
||||
+ if (sdir == NULL) {
|
||||
+ fprintf(stderr, "Failed to open %s: %s\n",
|
||||
+ argv[1], strerror(errno));
|
||||
+ exit(2);
|
||||
+ }
|
||||
+
|
||||
+ tfd = open(argv[2], O_DIRECTORY);
|
||||
+ if (tfd < 0) {
|
||||
+ fprintf(stderr, "Failed to open %s: %s\n",
|
||||
+ argv[2], strerror(errno));
|
||||
+ closedir(sdir);
|
||||
+ exit(3);
|
||||
+ }
|
||||
+
|
||||
+ while ((dirent = readdir(sdir)) != NULL) {
|
||||
+ if (dirent->d_name[0] == '.' &&
|
||||
+ (dirent->d_name[1] == '.' || dirent->d_name[1] == '\0'))
|
||||
+ continue;
|
||||
+
|
||||
+ int fd = openat(tfd, dirent->d_name, O_CREAT|O_WRONLY, 0666);
|
||||
+ if (fd < 0) {
|
||||
+ fprintf(stderr, "Failed to create %s/%s: %s\n",
|
||||
+ argv[2], dirent->d_name, strerror(errno));
|
||||
+ closedir(sdir);
|
||||
+ close(tfd);
|
||||
+ exit(4);
|
||||
+ }
|
||||
+ close(fd);
|
||||
+ }
|
||||
+
|
||||
+ closedir(sdir);
|
||||
+ close(tfd);
|
||||
+
|
||||
+ return (0);
|
||||
+}
|
||||
diff --git a/tests/zfs-tests/tests/functional/cp_files/cp_files_001_pos.ksh b/tests/zfs-tests/tests/functional/cp_files/cp_files_001_pos.ksh
|
||||
new file mode 100755
|
||||
index 00000000..3e138cfc
|
||||
--- /dev/null
|
||||
+++ b/tests/zfs-tests/tests/functional/cp_files/cp_files_001_pos.ksh
|
||||
@@ -0,0 +1,74 @@
|
||||
+#! /bin/ksh -p
|
||||
+#
|
||||
+# CDDL HEADER START
|
||||
+#
|
||||
+# The contents of this file are subject to the terms of the
|
||||
+# Common Development and Distribution License (the "License").
|
||||
+# You may not use this file except in compliance with the License.
|
||||
+#
|
||||
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
+# or http://www.opensolaris.org/os/licensing.
|
||||
+# See the License for the specific language governing permissions
|
||||
+# and limitations under the License.
|
||||
+#
|
||||
+# When distributing Covered Code, include this CDDL HEADER in each
|
||||
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
+# If applicable, add the following below this CDDL HEADER, with the
|
||||
+# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
+# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
+#
|
||||
+# CDDL HEADER END
|
||||
+#
|
||||
+
|
||||
+#
|
||||
+# Copyright (c) 2018 by Nutanix. All rights reserved.
|
||||
+#
|
||||
+
|
||||
+. $STF_SUITE/include/libtest.shlib
|
||||
+
|
||||
+#
|
||||
+# DESCRIPTION:
|
||||
+# Copy a large number of files between 2 directories
|
||||
+# within a zfs filesystem works without errors.
|
||||
+# This make sure zap upgrading and expanding works.
|
||||
+#
|
||||
+# STRATEGY:
|
||||
+#
|
||||
+# 1. Create NR_FILES files in directory src
|
||||
+# 2. Check the number of files is correct
|
||||
+# 3. Copy files from src to dst in readdir order
|
||||
+# 4. Check the number of files is correct
|
||||
+#
|
||||
+
|
||||
+verify_runnable "global"
|
||||
+
|
||||
+function cleanup
|
||||
+{
|
||||
+ rm -rf $TESTDIR/src $TESTDIR/dst
|
||||
+}
|
||||
+
|
||||
+log_assert "Copy a large number of files between 2 directories" \
|
||||
+ "within a zfs filesystem works without errors"
|
||||
+
|
||||
+log_onexit cleanup
|
||||
+
|
||||
+NR_FILES=60000
|
||||
+BATCH=1000
|
||||
+
|
||||
+log_must mkdir $TESTDIR/src
|
||||
+log_must mkdir $TESTDIR/dst
|
||||
+
|
||||
+WD=$(pwd)
|
||||
+cd $TESTDIR/src
|
||||
+# create NR_FILES in BATCH at a time to prevent overflowing argument buffer
|
||||
+for i in $(seq $(($NR_FILES/$BATCH))); do touch $(seq $((($i-1)*$BATCH+1)) $(($i*$BATCH))); done
|
||||
+cd $WD
|
||||
+
|
||||
+log_must test $NR_FILES -eq $(ls -U $TESTDIR/src | wc -l)
|
||||
+
|
||||
+# copy files from src to dst, use cp_files to make sure we copy in readdir order
|
||||
+log_must $STF_SUITE/tests/functional/cp_files/cp_files $TESTDIR/src $TESTDIR/dst
|
||||
+
|
||||
+log_must test $NR_FILES -eq $(ls -U $TESTDIR/dst | wc -l)
|
||||
+
|
||||
+log_pass
|
||||
diff --git a/tests/zfs-tests/tests/functional/cp_files/setup.ksh b/tests/zfs-tests/tests/functional/cp_files/setup.ksh
|
||||
new file mode 100755
|
||||
index 00000000..fc5cec30
|
||||
--- /dev/null
|
||||
+++ b/tests/zfs-tests/tests/functional/cp_files/setup.ksh
|
||||
@@ -0,0 +1,35 @@
|
||||
+#!/bin/ksh -p
|
||||
+#
|
||||
+# CDDL HEADER START
|
||||
+#
|
||||
+# The contents of this file are subject to the terms of the
|
||||
+# Common Development and Distribution License (the "License").
|
||||
+# You may not use this file except in compliance with the License.
|
||||
+#
|
||||
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
+# or http://www.opensolaris.org/os/licensing.
|
||||
+# See the License for the specific language governing permissions
|
||||
+# and limitations under the License.
|
||||
+#
|
||||
+# When distributing Covered Code, include this CDDL HEADER in each
|
||||
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
+# If applicable, add the following below this CDDL HEADER, with the
|
||||
+# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
+# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
+#
|
||||
+# CDDL HEADER END
|
||||
+#
|
||||
+
|
||||
+#
|
||||
+# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
+# Use is subject to license terms.
|
||||
+#
|
||||
+
|
||||
+#
|
||||
+# Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
+#
|
||||
+
|
||||
+. $STF_SUITE/include/libtest.shlib
|
||||
+
|
||||
+DISK=${DISKS%% *}
|
||||
+default_setup $DISK
|
||||
@@ -0,0 +1,155 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Date: Tue, 5 Sep 2017 13:41:32 -0700
|
||||
Subject: [PATCH] Trim new line from zfs_vdev_scheduler
|
||||
|
||||
Add a helper function to trim the tailing new line. While we're
|
||||
here use this new hook to immediately apply the new scheduler.
|
||||
|
||||
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Closes #3356
|
||||
Closes #6573
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
module/zfs/vdev_disk.c | 71 +++++++++++++++++++++++++++++++++++++-------------
|
||||
1 file changed, 53 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c
|
||||
index 5ae50a31..d6212835 100644
|
||||
--- a/module/zfs/vdev_disk.c
|
||||
+++ b/module/zfs/vdev_disk.c
|
||||
@@ -27,13 +27,14 @@
|
||||
*/
|
||||
|
||||
#include <sys/zfs_context.h>
|
||||
-#include <sys/spa.h>
|
||||
+#include <sys/spa_impl.h>
|
||||
#include <sys/vdev_disk.h>
|
||||
#include <sys/vdev_impl.h>
|
||||
#include <sys/abd.h>
|
||||
#include <sys/fs/zfs.h>
|
||||
#include <sys/zio.h>
|
||||
#include <sys/sunldi.h>
|
||||
+#include <linux/mod_compat.h>
|
||||
|
||||
char *zfs_vdev_scheduler = VDEV_SCHEDULER;
|
||||
static void *zfs_vdev_holder = VDEV_HOLDER;
|
||||
@@ -113,15 +114,23 @@ vdev_disk_error(zio_t *zio)
|
||||
* physical device. This yields the largest possible requests for
|
||||
* the device with the lowest total overhead.
|
||||
*/
|
||||
-static int
|
||||
+static void
|
||||
vdev_elevator_switch(vdev_t *v, char *elevator)
|
||||
{
|
||||
vdev_disk_t *vd = v->vdev_tsd;
|
||||
- struct block_device *bdev = vd->vd_bdev;
|
||||
- struct request_queue *q = bdev_get_queue(bdev);
|
||||
- char *device = bdev->bd_disk->disk_name;
|
||||
+ struct request_queue *q;
|
||||
+ char *device;
|
||||
int error;
|
||||
|
||||
+ for (int c = 0; c < v->vdev_children; c++)
|
||||
+ vdev_elevator_switch(v->vdev_child[c], elevator);
|
||||
+
|
||||
+ if (!v->vdev_ops->vdev_op_leaf || vd->vd_bdev == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ q = bdev_get_queue(vd->vd_bdev);
|
||||
+ device = vd->vd_bdev->bd_disk->disk_name;
|
||||
+
|
||||
/*
|
||||
* Skip devices which are not whole disks (partitions).
|
||||
* Device-mapper devices are excepted since they may be whole
|
||||
@@ -131,15 +140,15 @@ vdev_elevator_switch(vdev_t *v, char *elevator)
|
||||
* "Skip devices without schedulers" check below will fail.
|
||||
*/
|
||||
if (!v->vdev_wholedisk && strncmp(device, "dm-", 3) != 0)
|
||||
- return (0);
|
||||
+ return;
|
||||
|
||||
/* Skip devices without schedulers (loop, ram, dm, etc) */
|
||||
if (!q->elevator || !blk_queue_stackable(q))
|
||||
- return (0);
|
||||
+ return;
|
||||
|
||||
/* Leave existing scheduler when set to "none" */
|
||||
if ((strncmp(elevator, "none", 4) == 0) && (strlen(elevator) == 4))
|
||||
- return (0);
|
||||
+ return;
|
||||
|
||||
#ifdef HAVE_ELEVATOR_CHANGE
|
||||
error = elevator_change(q, elevator);
|
||||
@@ -156,20 +165,16 @@ vdev_elevator_switch(vdev_t *v, char *elevator)
|
||||
" 2>/dev/null; " \
|
||||
"echo %s"
|
||||
|
||||
- {
|
||||
- char *argv[] = { "/bin/sh", "-c", NULL, NULL };
|
||||
- char *envp[] = { NULL };
|
||||
+ char *argv[] = { "/bin/sh", "-c", NULL, NULL };
|
||||
+ char *envp[] = { NULL };
|
||||
|
||||
- argv[2] = kmem_asprintf(SET_SCHEDULER_CMD, device, elevator);
|
||||
- error = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
|
||||
- strfree(argv[2]);
|
||||
- }
|
||||
+ argv[2] = kmem_asprintf(SET_SCHEDULER_CMD, device, elevator);
|
||||
+ error = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
|
||||
+ strfree(argv[2]);
|
||||
#endif /* HAVE_ELEVATOR_CHANGE */
|
||||
if (error)
|
||||
printk("ZFS: Unable to set \"%s\" scheduler for %s (%s): %d\n",
|
||||
elevator, v->vdev_path, device, error);
|
||||
-
|
||||
- return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -798,6 +803,35 @@ vdev_disk_rele(vdev_t *vd)
|
||||
/* XXX: Implement me as a vnode rele for the device */
|
||||
}
|
||||
|
||||
+static int
|
||||
+param_set_vdev_scheduler(const char *val, zfs_kernel_param_t *kp)
|
||||
+{
|
||||
+ spa_t *spa = NULL;
|
||||
+ char *p;
|
||||
+
|
||||
+ if (val == NULL)
|
||||
+ return (SET_ERROR(-EINVAL));
|
||||
+
|
||||
+ if ((p = strchr(val, '\n')) != NULL)
|
||||
+ *p = '\0';
|
||||
+
|
||||
+ mutex_enter(&spa_namespace_lock);
|
||||
+ while ((spa = spa_next(spa)) != NULL) {
|
||||
+ if (spa_state(spa) != POOL_STATE_ACTIVE ||
|
||||
+ !spa_writeable(spa) || spa_suspended(spa))
|
||||
+ continue;
|
||||
+
|
||||
+ spa_open_ref(spa, FTAG);
|
||||
+ mutex_exit(&spa_namespace_lock);
|
||||
+ vdev_elevator_switch(spa->spa_root_vdev, (char *)val);
|
||||
+ mutex_enter(&spa_namespace_lock);
|
||||
+ spa_close(spa, FTAG);
|
||||
+ }
|
||||
+ mutex_exit(&spa_namespace_lock);
|
||||
+
|
||||
+ return (param_set_charp(val, kp));
|
||||
+}
|
||||
+
|
||||
vdev_ops_t vdev_disk_ops = {
|
||||
vdev_disk_open,
|
||||
vdev_disk_close,
|
||||
@@ -812,5 +846,6 @@ vdev_ops_t vdev_disk_ops = {
|
||||
B_TRUE /* leaf vdev */
|
||||
};
|
||||
|
||||
-module_param(zfs_vdev_scheduler, charp, 0644);
|
||||
+module_param_call(zfs_vdev_scheduler, param_set_vdev_scheduler,
|
||||
+ param_get_charp, &zfs_vdev_scheduler, 0644);
|
||||
MODULE_PARM_DESC(zfs_vdev_scheduler, "I/O scheduler");
|
||||
@@ -0,0 +1,84 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Olaf Faaland <faaland1@llnl.gov>
|
||||
Date: Fri, 11 May 2018 12:46:07 -0700
|
||||
Subject: [PATCH] module param callbacks check for initialized spa
|
||||
|
||||
Callbacks provided for module parameters are executed both
|
||||
after the module is loaded, when a user alters it via sysfs, e.g
|
||||
echo bar > /sys/modules/zfs/parameters/foo
|
||||
|
||||
as well as when the module is loaded with an argument, e.g.
|
||||
modprobe zfs foo=bar
|
||||
|
||||
In the latter case, the init functions likely have not run yet,
|
||||
including spa_init() which initializes the namespace lock so it is safe
|
||||
to use.
|
||||
|
||||
Instead of immediately taking the namespace lock and attemping to
|
||||
iterate over initialized spa structures, check whether spa_mode_global
|
||||
is nonzero. This is set by spa_init() after it has initialized the
|
||||
namespace lock.
|
||||
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Reviewed-by: Tim Chase <tim@chase2k.com>
|
||||
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
|
||||
Closes #7496
|
||||
Closes #7521
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
module/zfs/mmp.c | 3 ++-
|
||||
module/zfs/vdev_disk.c | 24 +++++++++++++-----------
|
||||
2 files changed, 15 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c
|
||||
index 3b74a6b6..7523310c 100644
|
||||
--- a/module/zfs/mmp.c
|
||||
+++ b/module/zfs/mmp.c
|
||||
@@ -607,7 +607,8 @@ param_set_multihost_interval(const char *val, zfs_kernel_param_t *kp)
|
||||
if (ret < 0)
|
||||
return (ret);
|
||||
|
||||
- mmp_signal_all_threads();
|
||||
+ if (spa_mode_global != 0)
|
||||
+ mmp_signal_all_threads();
|
||||
|
||||
return (ret);
|
||||
}
|
||||
diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c
|
||||
index d6212835..6761e755 100644
|
||||
--- a/module/zfs/vdev_disk.c
|
||||
+++ b/module/zfs/vdev_disk.c
|
||||
@@ -815,19 +815,21 @@ param_set_vdev_scheduler(const char *val, zfs_kernel_param_t *kp)
|
||||
if ((p = strchr(val, '\n')) != NULL)
|
||||
*p = '\0';
|
||||
|
||||
- mutex_enter(&spa_namespace_lock);
|
||||
- while ((spa = spa_next(spa)) != NULL) {
|
||||
- if (spa_state(spa) != POOL_STATE_ACTIVE ||
|
||||
- !spa_writeable(spa) || spa_suspended(spa))
|
||||
- continue;
|
||||
-
|
||||
- spa_open_ref(spa, FTAG);
|
||||
- mutex_exit(&spa_namespace_lock);
|
||||
- vdev_elevator_switch(spa->spa_root_vdev, (char *)val);
|
||||
+ if (spa_mode_global != 0) {
|
||||
mutex_enter(&spa_namespace_lock);
|
||||
- spa_close(spa, FTAG);
|
||||
+ while ((spa = spa_next(spa)) != NULL) {
|
||||
+ if (spa_state(spa) != POOL_STATE_ACTIVE ||
|
||||
+ !spa_writeable(spa) || spa_suspended(spa))
|
||||
+ continue;
|
||||
+
|
||||
+ spa_open_ref(spa, FTAG);
|
||||
+ mutex_exit(&spa_namespace_lock);
|
||||
+ vdev_elevator_switch(spa->spa_root_vdev, (char *)val);
|
||||
+ mutex_enter(&spa_namespace_lock);
|
||||
+ spa_close(spa, FTAG);
|
||||
+ }
|
||||
+ mutex_exit(&spa_namespace_lock);
|
||||
}
|
||||
- mutex_exit(&spa_namespace_lock);
|
||||
|
||||
return (param_set_charp(val, kp));
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Russo <antonio.e.russo@gmail.com>
|
||||
Date: Sat, 26 May 2018 13:56:24 -0400
|
||||
Subject: [PATCH] Support Debian DKMS builds
|
||||
|
||||
scripts/dkms.mkconf calls configure with
|
||||
`--with-linux=${kernel_source_dir}`, but Debian puts it kernel source at
|
||||
`/lib/modules/<version>/source`. This patch adds the same logic to the
|
||||
DKMS file produced by `scripts/dkms.mkconf` that Debian has shipped in
|
||||
its official ZFS packaging: at DKMS build time, it checks if the system
|
||||
is a Debian system, and adjusts the path accordingly.
|
||||
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Reviewed-by: George Melikov <mail@gmelikov.ru>
|
||||
Signed-off-by: Antonio Russo <antonio.e.russo@gmail.com>
|
||||
Closes #7358
|
||||
Closes #7540
|
||||
Closes #7554
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
scripts/dkms.mkconf | 17 ++++++++++++++++-
|
||||
1 file changed, 16 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/scripts/dkms.mkconf b/scripts/dkms.mkconf
|
||||
index 880510ab..88c28938 100755
|
||||
--- a/scripts/dkms.mkconf
|
||||
+++ b/scripts/dkms.mkconf
|
||||
@@ -25,7 +25,22 @@ PACKAGE_CONFIG="${pkgcfg}"
|
||||
PRE_BUILD="configure
|
||||
--prefix=/usr
|
||||
--with-config=kernel
|
||||
- --with-linux=\${kernel_source_dir}
|
||||
+ --with-linux=\$(
|
||||
+ case \`lsb_release -is\` in
|
||||
+ (Debian|Devuan)
|
||||
+ if [[ -e \${kernel_source_dir/%build/source} ]]
|
||||
+ then
|
||||
+ echo \${kernel_source_dir/%build/source}
|
||||
+ else
|
||||
+ # A kpkg exception for Proxmox 2.0
|
||||
+ echo \${kernel_source_dir}
|
||||
+ fi
|
||||
+ ;;
|
||||
+ (*)
|
||||
+ echo \${kernel_source_dir}
|
||||
+ ;;
|
||||
+ esac
|
||||
+ )
|
||||
--with-linux-obj=\${kernel_source_dir}
|
||||
--with-spl=\${source_tree}/spl-\${PACKAGE_VERSION}
|
||||
--with-spl-obj=\${dkms_tree}/spl/\${PACKAGE_VERSION}/\${kernelver}/\${arch}
|
||||
@@ -0,0 +1,376 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Sara Hartse <sara.hartse@gmail.com>
|
||||
Date: Thu, 31 May 2018 10:36:37 -0700
|
||||
Subject: [PATCH] zpool reopen should detect expanded devices
|
||||
|
||||
Update bdev_capacity to have wholedisk vdevs query the
|
||||
size of the underlying block device (correcting for the size
|
||||
of the efi parition and partition alignment) and therefore detect
|
||||
expanded space.
|
||||
|
||||
Correct vdev_get_stats_ex so that the expandsize is aligned
|
||||
to metaslab size and new space is only reported if it is large
|
||||
enough for a new metaslab.
|
||||
|
||||
Reviewed by: Don Brady <don.brady@delphix.com>
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Reviewed by: George Wilson <george.wilson@delphix.com>
|
||||
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
|
||||
Reviewed by: John Wren Kennedy <jwk404@gmail.com>
|
||||
Signed-off-by: sara hartse <sara.hartse@delphix.com>
|
||||
External-issue: LX-165
|
||||
Closes #7546
|
||||
Issue #7582
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
include/sys/vdev_disk.h | 12 +++++
|
||||
lib/libefi/rdwr_efi.c | 20 +++++++-
|
||||
lib/libzfs/libzfs_pool.c | 14 +-----
|
||||
module/zfs/vdev.c | 3 +-
|
||||
module/zfs/vdev_disk.c | 46 +++++++++++++-----
|
||||
.../cli_root/zpool_expand/zpool_expand_002_pos.ksh | 54 +++++++++++++++-------
|
||||
6 files changed, 107 insertions(+), 42 deletions(-)
|
||||
|
||||
diff --git a/include/sys/vdev_disk.h b/include/sys/vdev_disk.h
|
||||
index 15570b10..b8a32b31 100644
|
||||
--- a/include/sys/vdev_disk.h
|
||||
+++ b/include/sys/vdev_disk.h
|
||||
@@ -23,11 +23,23 @@
|
||||
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
|
||||
* Written by Brian Behlendorf <behlendorf1@llnl.gov>.
|
||||
* LLNL-CODE-403049.
|
||||
+ * Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_VDEV_DISK_H
|
||||
#define _SYS_VDEV_DISK_H
|
||||
|
||||
+/*
|
||||
+ * Don't start the slice at the default block of 34; many storage
|
||||
+ * devices will use a stripe width of 128k, other vendors prefer a 1m
|
||||
+ * alignment. It is best to play it safe and ensure a 1m alignment
|
||||
+ * given 512B blocks. When the block size is larger by a power of 2
|
||||
+ * we will still be 1m aligned. Some devices are sensitive to the
|
||||
+ * partition ending alignment as well.
|
||||
+ */
|
||||
+#define NEW_START_BLOCK 2048
|
||||
+#define PARTITION_END_ALIGNMENT 2048
|
||||
+
|
||||
#ifdef _KERNEL
|
||||
#include <sys/vdev.h>
|
||||
|
||||
diff --git a/lib/libefi/rdwr_efi.c b/lib/libefi/rdwr_efi.c
|
||||
index 7935047e..19cb17e5 100644
|
||||
--- a/lib/libefi/rdwr_efi.c
|
||||
+++ b/lib/libefi/rdwr_efi.c
|
||||
@@ -22,6 +22,7 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
|
||||
+ * Copyright (c) 2018 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -1153,7 +1154,7 @@ efi_use_whole_disk(int fd)
|
||||
|
||||
/*
|
||||
* Find the last physically non-zero partition.
|
||||
- * This is the reserved partition.
|
||||
+ * This should be the reserved partition.
|
||||
*/
|
||||
for (i = 0; i < efi_label->efi_nparts; i ++) {
|
||||
if (resv_start < efi_label->efi_parts[i].p_start) {
|
||||
@@ -1163,6 +1164,23 @@ efi_use_whole_disk(int fd)
|
||||
}
|
||||
|
||||
/*
|
||||
+ * Verify that we've found the reserved partition by checking
|
||||
+ * that it looks the way it did when we created it in zpool_label_disk.
|
||||
+ * If we've found the incorrect partition, then we know that this
|
||||
+ * device was reformatted and no longer is soley used by ZFS.
|
||||
+ */
|
||||
+ if ((efi_label->efi_parts[resv_index].p_size != EFI_MIN_RESV_SIZE) ||
|
||||
+ (efi_label->efi_parts[resv_index].p_tag != V_RESERVED) ||
|
||||
+ (resv_index != 8)) {
|
||||
+ if (efi_debug) {
|
||||
+ (void) fprintf(stderr,
|
||||
+ "efi_use_whole_disk: wholedisk not available\n");
|
||||
+ }
|
||||
+ efi_free(efi_label);
|
||||
+ return (VT_ENOSPC);
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
* Find the last physically non-zero partition before that.
|
||||
* This is the data partition.
|
||||
*/
|
||||
diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c
|
||||
index e00d5f51..53bc5034 100644
|
||||
--- a/lib/libzfs/libzfs_pool.c
|
||||
+++ b/lib/libzfs/libzfs_pool.c
|
||||
@@ -22,7 +22,7 @@
|
||||
/*
|
||||
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
- * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
|
||||
+ * Copyright (c) 2011, 2018 by Delphix. All rights reserved.
|
||||
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
|
||||
* Copyright (c) 2017 Datto Inc.
|
||||
*/
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <sys/efi_partition.h>
|
||||
#include <sys/vtoc.h>
|
||||
#include <sys/zfs_ioctl.h>
|
||||
+#include <sys/vdev_disk.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "zfs_namecheck.h"
|
||||
@@ -913,17 +914,6 @@ zpool_prop_get_feature(zpool_handle_t *zhp, const char *propname, char *buf,
|
||||
}
|
||||
|
||||
/*
|
||||
- * Don't start the slice at the default block of 34; many storage
|
||||
- * devices will use a stripe width of 128k, other vendors prefer a 1m
|
||||
- * alignment. It is best to play it safe and ensure a 1m alignment
|
||||
- * given 512B blocks. When the block size is larger by a power of 2
|
||||
- * we will still be 1m aligned. Some devices are sensitive to the
|
||||
- * partition ending alignment as well.
|
||||
- */
|
||||
-#define NEW_START_BLOCK 2048
|
||||
-#define PARTITION_END_ALIGNMENT 2048
|
||||
-
|
||||
-/*
|
||||
* Validate the given pool name, optionally putting an extended error message in
|
||||
* 'buf'.
|
||||
*/
|
||||
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
|
||||
index acac2a97..b643bd35 100644
|
||||
--- a/module/zfs/vdev.c
|
||||
+++ b/module/zfs/vdev.c
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
- * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
|
||||
+ * Copyright (c) 2011, 2018 by Delphix. All rights reserved.
|
||||
* Copyright 2017 Nexenta Systems, Inc.
|
||||
* Copyright (c) 2014 Integros [integros.com]
|
||||
* Copyright 2016 Toomas Soome <tsoome@me.com>
|
||||
@@ -3039,7 +3039,6 @@ vdev_get_stats_ex(vdev_t *vd, vdev_stat_t *vs, vdev_stat_ex_t *vsx)
|
||||
vd->vdev_max_asize - vd->vdev_asize,
|
||||
1ULL << tvd->vdev_ms_shift);
|
||||
}
|
||||
- vs->vs_esize = vd->vdev_max_asize - vd->vdev_asize;
|
||||
if (vd->vdev_aux == NULL && vd == vd->vdev_top &&
|
||||
!vd->vdev_ishole) {
|
||||
vs->vs_fragmentation = vd->vdev_mg->mg_fragmentation;
|
||||
diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c
|
||||
index 6761e755..6dc0544f 100644
|
||||
--- a/module/zfs/vdev_disk.c
|
||||
+++ b/module/zfs/vdev_disk.c
|
||||
@@ -23,7 +23,7 @@
|
||||
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
|
||||
* Rewritten for Linux by Brian Behlendorf <behlendorf1@llnl.gov>.
|
||||
* LLNL-CODE-403049.
|
||||
- * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
|
||||
+ * Copyright (c) 2012, 2018 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <sys/zfs_context.h>
|
||||
@@ -35,10 +35,14 @@
|
||||
#include <sys/zio.h>
|
||||
#include <sys/sunldi.h>
|
||||
#include <linux/mod_compat.h>
|
||||
+#include <linux/msdos_fs.h>
|
||||
|
||||
char *zfs_vdev_scheduler = VDEV_SCHEDULER;
|
||||
static void *zfs_vdev_holder = VDEV_HOLDER;
|
||||
|
||||
+/* size of the "reserved" partition, in blocks */
|
||||
+#define EFI_MIN_RESV_SIZE (16 * 1024)
|
||||
+
|
||||
/*
|
||||
* Virtual device vector for disks.
|
||||
*/
|
||||
@@ -82,17 +86,39 @@ vdev_bdev_mode(int smode)
|
||||
}
|
||||
#endif /* HAVE_OPEN_BDEV_EXCLUSIVE */
|
||||
|
||||
+/* The capacity (in bytes) of a bdev that is available to be used by a vdev */
|
||||
static uint64_t
|
||||
-bdev_capacity(struct block_device *bdev)
|
||||
+bdev_capacity(struct block_device *bdev, boolean_t wholedisk)
|
||||
{
|
||||
struct hd_struct *part = bdev->bd_part;
|
||||
+ uint64_t sectors = get_capacity(bdev->bd_disk);
|
||||
+ /* If there are no paritions, return the entire device capacity */
|
||||
+ if (part == NULL)
|
||||
+ return (sectors << SECTOR_BITS);
|
||||
|
||||
- /* The partition capacity referenced by the block device */
|
||||
- if (part)
|
||||
- return (part->nr_sects << 9);
|
||||
-
|
||||
- /* Otherwise assume the full device capacity */
|
||||
- return (get_capacity(bdev->bd_disk) << 9);
|
||||
+ /*
|
||||
+ * If there are partitions, decide if we are using a `wholedisk`
|
||||
+ * layout (composed of part1 and part9) or just a single partition.
|
||||
+ */
|
||||
+ if (wholedisk) {
|
||||
+ /* Verify the expected device layout */
|
||||
+ ASSERT3P(bdev, !=, bdev->bd_contains);
|
||||
+ /*
|
||||
+ * Sectors used by the EFI partition (part9) as well as
|
||||
+ * partion alignment.
|
||||
+ */
|
||||
+ uint64_t used = EFI_MIN_RESV_SIZE + NEW_START_BLOCK +
|
||||
+ PARTITION_END_ALIGNMENT;
|
||||
+
|
||||
+ /* Space available to the vdev, i.e. the size of part1 */
|
||||
+ if (sectors <= used)
|
||||
+ return (0);
|
||||
+ uint64_t available = sectors - used;
|
||||
+ return (available << SECTOR_BITS);
|
||||
+ } else {
|
||||
+ /* The partition capacity referenced by the block device */
|
||||
+ return (part->nr_sects << SECTOR_BITS);
|
||||
+ }
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -328,9 +354,7 @@ skip_open:
|
||||
v->vdev_nonrot = blk_queue_nonrot(bdev_get_queue(vd->vd_bdev));
|
||||
|
||||
/* Physical volume size in bytes */
|
||||
- *psize = bdev_capacity(vd->vd_bdev);
|
||||
-
|
||||
- /* TODO: report possible expansion size */
|
||||
+ *psize = bdev_capacity(vd->vd_bdev, v->vdev_wholedisk);
|
||||
*max_psize = *psize;
|
||||
|
||||
/* Based on the minimum sector size set the block size */
|
||||
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_002_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_002_pos.ksh
|
||||
index d578ae60..66b6969d 100755
|
||||
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_002_pos.ksh
|
||||
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_002_pos.ksh
|
||||
@@ -26,7 +26,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
-# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
|
||||
+# Copyright (c) 2012, 2018 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2017 Lawrence Livermore National Security, LLC.
|
||||
#
|
||||
|
||||
@@ -43,8 +43,9 @@
|
||||
# 1) Create 3 files
|
||||
# 2) Create a pool backed by the files
|
||||
# 3) Expand the files' size with truncate
|
||||
-# 4) Use zpool online -e to online the vdevs
|
||||
-# 5) Check that the pool size was expanded
|
||||
+# 4) Use zpool reopen to check the expandsize
|
||||
+# 5) Use zpool online -e to online the vdevs
|
||||
+# 6) Check that the pool size was expanded
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
@@ -64,8 +65,8 @@ log_onexit cleanup
|
||||
|
||||
log_assert "zpool can expand after zpool online -e zvol vdevs on LUN expansion"
|
||||
|
||||
-
|
||||
for type in " " mirror raidz raidz2; do
|
||||
+ # Initialize the file devices and the pool
|
||||
for i in 1 2 3; do
|
||||
log_must truncate -s $org_size ${TEMPFILE}.$i
|
||||
done
|
||||
@@ -80,13 +81,35 @@ for type in " " mirror raidz raidz2; do
|
||||
"$autoexp"
|
||||
fi
|
||||
typeset prev_size=$(get_pool_prop size $TESTPOOL1)
|
||||
- typeset zfs_prev_size=$(zfs get -p avail $TESTPOOL1 | tail -1 | \
|
||||
- awk '{print $3}')
|
||||
+ typeset zfs_prev_size=$(get_prop avail $TESTPOOL1)
|
||||
|
||||
+ # Increase the size of the file devices
|
||||
for i in 1 2 3; do
|
||||
log_must truncate -s $exp_size ${TEMPFILE}.$i
|
||||
done
|
||||
|
||||
+ # Reopen the pool and check that the `expandsize` property is set
|
||||
+ log_must zpool reopen $TESTPOOL1
|
||||
+ typeset zpool_expandsize=$(get_pool_prop expandsize $TESTPOOL1)
|
||||
+
|
||||
+ if [[ $type == "mirror" ]]; then
|
||||
+ typeset expected_zpool_expandsize=$(($exp_size-$org_size))
|
||||
+ else
|
||||
+ typeset expected_zpool_expandsize=$((3*($exp_size-$org_size)))
|
||||
+ fi
|
||||
+
|
||||
+ if [[ "$zpool_expandsize" = "-" ]]; then
|
||||
+ log_fail "pool $TESTPOOL1 did not detect any " \
|
||||
+ "expandsize after reopen"
|
||||
+ fi
|
||||
+
|
||||
+ if [[ $zpool_expandsize -ne $expected_zpool_expandsize ]]; then
|
||||
+ log_fail "pool $TESTPOOL1 did not detect correct " \
|
||||
+ "expandsize after reopen: found $zpool_expandsize," \
|
||||
+ "expected $expected_zpool_expandsize"
|
||||
+ fi
|
||||
+
|
||||
+ # Online the devices to add the new space to the pool
|
||||
for i in 1 2 3; do
|
||||
log_must zpool online -e $TESTPOOL1 ${TEMPFILE}.$i
|
||||
done
|
||||
@@ -96,8 +119,7 @@ for type in " " mirror raidz raidz2; do
|
||||
sync
|
||||
|
||||
typeset expand_size=$(get_pool_prop size $TESTPOOL1)
|
||||
- typeset zfs_expand_size=$(zfs get -p avail $TESTPOOL1 | tail -1 | \
|
||||
- awk '{print $3}')
|
||||
+ typeset zfs_expand_size=$(get_prop avail $TESTPOOL1)
|
||||
log_note "$TESTPOOL1 $type has previous size: $prev_size and " \
|
||||
"expanded size: $expand_size"
|
||||
|
||||
@@ -112,8 +134,8 @@ for type in " " mirror raidz raidz2; do
|
||||
grep "(+${expansion_size}" | wc -l)
|
||||
|
||||
if [[ $size_addition -ne $i ]]; then
|
||||
- log_fail "pool $TESTPOOL1 is not autoexpand " \
|
||||
- "after LUN expansion"
|
||||
+ log_fail "pool $TESTPOOL1 did not expand " \
|
||||
+ "after LUN expansion and zpool online -e"
|
||||
fi
|
||||
elif [[ $type == "mirror" ]]; then
|
||||
typeset expansion_size=$(($exp_size-$org_size))
|
||||
@@ -123,8 +145,8 @@ for type in " " mirror raidz raidz2; do
|
||||
grep "(+${expansion_size})" >/dev/null 2>&1
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
- log_fail "pool $TESTPOOL1 is not autoexpand " \
|
||||
- "after LUN expansion"
|
||||
+ log_fail "pool $TESTPOOL1 did not expand " \
|
||||
+ "after LUN expansion and zpool online -e"
|
||||
fi
|
||||
else
|
||||
typeset expansion_size=$((3*($exp_size-$org_size)))
|
||||
@@ -134,13 +156,13 @@ for type in " " mirror raidz raidz2; do
|
||||
grep "(+${expansion_size})" >/dev/null 2>&1
|
||||
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
- log_fail "pool $TESTPOOL1 is not autoexpand " \
|
||||
- "after LUN expansion"
|
||||
+ log_fail "pool $TESTPOOL1 did not expand " \
|
||||
+ "after LUN expansion and zpool online -e"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
- log_fail "pool $TESTPOOL1 is not autoexpanded after LUN " \
|
||||
- "expansion"
|
||||
+ log_fail "pool $TESTPOOL1 did not expand after LUN expansion " \
|
||||
+ "and zpool online -e"
|
||||
fi
|
||||
log_must zpool destroy $TESTPOOL1
|
||||
done
|
||||
@@ -0,0 +1,686 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tony Hutter <hutter2@llnl.gov>
|
||||
Date: Wed, 6 Jun 2018 09:33:54 -0700
|
||||
Subject: [PATCH] Add pool state /proc entry, "SUSPENDED" pools
|
||||
|
||||
1. Add a proc entry to display the pool's state:
|
||||
|
||||
$ cat /proc/spl/kstat/zfs/tank/state
|
||||
ONLINE
|
||||
|
||||
This is done without using the spa config locks, so it will
|
||||
never hang.
|
||||
|
||||
2. Fix 'zpool status' and 'zpool list -o health' output to print
|
||||
"SUSPENDED" instead of "ONLINE" for suspended pools.
|
||||
|
||||
Reviewed-by: Olaf Faaland <faaland1@llnl.gov>
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
|
||||
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
|
||||
Closes #7331
|
||||
Closes #7563
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
cmd/zpool/zpool_main.c | 3 +-
|
||||
configure.ac | 1 +
|
||||
include/libzfs.h | 2 +
|
||||
include/sys/spa.h | 3 +
|
||||
lib/libspl/include/sys/kstat.h | 2 +
|
||||
lib/libzfs/libzfs_pool.c | 46 +++++--
|
||||
lib/libzfs/libzfs_status.c | 12 +-
|
||||
module/zfs/spa_misc.c | 40 ++++++
|
||||
module/zfs/spa_stats.c | 62 +++++++++
|
||||
tests/runfiles/linux.run | 4 +
|
||||
tests/zfs-tests/include/libtest.shlib | 38 ++++++
|
||||
tests/zfs-tests/tests/functional/Makefile.am | 1 +
|
||||
tests/zfs-tests/tests/functional/kstat/Makefile.am | 5 +
|
||||
tests/zfs-tests/tests/functional/kstat/cleanup.ksh | 28 ++++
|
||||
tests/zfs-tests/tests/functional/kstat/setup.ksh | 34 +++++
|
||||
tests/zfs-tests/tests/functional/kstat/state.ksh | 144 +++++++++++++++++++++
|
||||
16 files changed, 406 insertions(+), 19 deletions(-)
|
||||
create mode 100644 tests/zfs-tests/tests/functional/kstat/Makefile.am
|
||||
create mode 100755 tests/zfs-tests/tests/functional/kstat/cleanup.ksh
|
||||
create mode 100755 tests/zfs-tests/tests/functional/kstat/setup.ksh
|
||||
create mode 100755 tests/zfs-tests/tests/functional/kstat/state.ksh
|
||||
|
||||
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
|
||||
index b0756938..97697011 100644
|
||||
--- a/cmd/zpool/zpool_main.c
|
||||
+++ b/cmd/zpool/zpool_main.c
|
||||
@@ -6226,7 +6226,8 @@ status_callback(zpool_handle_t *zhp, void *data)
|
||||
&nvroot) == 0);
|
||||
verify(nvlist_lookup_uint64_array(nvroot, ZPOOL_CONFIG_VDEV_STATS,
|
||||
(uint64_t **)&vs, &c) == 0);
|
||||
- health = zpool_state_to_name(vs->vs_state, vs->vs_aux);
|
||||
+
|
||||
+ health = zpool_get_state_str(zhp);
|
||||
|
||||
(void) printf(gettext(" pool: %s\n"), zpool_get_name(zhp));
|
||||
(void) printf(gettext(" state: %s\n"), health);
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 3f4925c3..42cfc1a3 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -253,6 +253,7 @@ AC_CONFIG_FILES([
|
||||
tests/zfs-tests/tests/functional/history/Makefile
|
||||
tests/zfs-tests/tests/functional/inheritance/Makefile
|
||||
tests/zfs-tests/tests/functional/inuse/Makefile
|
||||
+ tests/zfs-tests/tests/functional/kstat/Makefile
|
||||
tests/zfs-tests/tests/functional/large_files/Makefile
|
||||
tests/zfs-tests/tests/functional/largest_pool/Makefile
|
||||
tests/zfs-tests/tests/functional/link_count/Makefile
|
||||
diff --git a/include/libzfs.h b/include/libzfs.h
|
||||
index 945bd5b8..fea2fee4 100644
|
||||
--- a/include/libzfs.h
|
||||
+++ b/include/libzfs.h
|
||||
@@ -296,6 +296,8 @@ int zfs_dev_is_whole_disk(char *dev_name);
|
||||
char *zfs_get_underlying_path(char *dev_name);
|
||||
char *zfs_get_enclosure_sysfs_path(char *dev_name);
|
||||
|
||||
+const char *zpool_get_state_str(zpool_handle_t *);
|
||||
+
|
||||
/*
|
||||
* Functions to manage pool properties
|
||||
*/
|
||||
diff --git a/include/sys/spa.h b/include/sys/spa.h
|
||||
index 3b268419..810999c9 100644
|
||||
--- a/include/sys/spa.h
|
||||
+++ b/include/sys/spa.h
|
||||
@@ -730,6 +730,7 @@ typedef struct spa_stats {
|
||||
spa_stats_history_t tx_assign_histogram;
|
||||
spa_stats_history_t io_history;
|
||||
spa_stats_history_t mmp_history;
|
||||
+ spa_stats_history_t state; /* pool state */
|
||||
} spa_stats_t;
|
||||
|
||||
typedef enum txg_state {
|
||||
@@ -889,6 +890,8 @@ extern void spa_history_log_internal_ds(struct dsl_dataset *ds, const char *op,
|
||||
extern void spa_history_log_internal_dd(dsl_dir_t *dd, const char *operation,
|
||||
dmu_tx_t *tx, const char *fmt, ...);
|
||||
|
||||
+extern const char *spa_state_to_name(spa_t *spa);
|
||||
+
|
||||
/* error handling */
|
||||
struct zbookmark_phys;
|
||||
extern void spa_log_error(spa_t *spa, zio_t *zio);
|
||||
diff --git a/lib/libspl/include/sys/kstat.h b/lib/libspl/include/sys/kstat.h
|
||||
index fcd3ed98..84c3d7ca 100644
|
||||
--- a/lib/libspl/include/sys/kstat.h
|
||||
+++ b/lib/libspl/include/sys/kstat.h
|
||||
@@ -304,6 +304,8 @@ typedef struct kstat32 {
|
||||
#define KSTAT_FLAG_PERSISTENT 0x08
|
||||
#define KSTAT_FLAG_DORMANT 0x10
|
||||
#define KSTAT_FLAG_INVALID 0x20
|
||||
+#define KSTAT_FLAG_LONGSTRINGS 0x40
|
||||
+#define KSTAT_FLAG_NO_HEADERS 0x80
|
||||
|
||||
/*
|
||||
* Dynamic update support
|
||||
diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c
|
||||
index 53bc5034..315ba954 100644
|
||||
--- a/lib/libzfs/libzfs_pool.c
|
||||
+++ b/lib/libzfs/libzfs_pool.c
|
||||
@@ -240,6 +240,38 @@ zpool_pool_state_to_name(pool_state_t state)
|
||||
}
|
||||
|
||||
/*
|
||||
+ * Given a pool handle, return the pool health string ("ONLINE", "DEGRADED",
|
||||
+ * "SUSPENDED", etc).
|
||||
+ */
|
||||
+const char *
|
||||
+zpool_get_state_str(zpool_handle_t *zhp)
|
||||
+{
|
||||
+ zpool_errata_t errata;
|
||||
+ zpool_status_t status;
|
||||
+ nvlist_t *nvroot;
|
||||
+ vdev_stat_t *vs;
|
||||
+ uint_t vsc;
|
||||
+ const char *str;
|
||||
+
|
||||
+ status = zpool_get_status(zhp, NULL, &errata);
|
||||
+
|
||||
+ if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) {
|
||||
+ str = gettext("FAULTED");
|
||||
+ } else if (status == ZPOOL_STATUS_IO_FAILURE_WAIT ||
|
||||
+ status == ZPOOL_STATUS_IO_FAILURE_MMP) {
|
||||
+ str = gettext("SUSPENDED");
|
||||
+ } else {
|
||||
+ verify(nvlist_lookup_nvlist(zpool_get_config(zhp, NULL),
|
||||
+ ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0);
|
||||
+ verify(nvlist_lookup_uint64_array(nvroot,
|
||||
+ ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&vs, &vsc)
|
||||
+ == 0);
|
||||
+ str = zpool_state_to_name(vs->vs_state, vs->vs_aux);
|
||||
+ }
|
||||
+ return (str);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* Get a zpool property value for 'prop' and return the value in
|
||||
* a pre-allocated buffer.
|
||||
*/
|
||||
@@ -250,9 +282,6 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf,
|
||||
uint64_t intval;
|
||||
const char *strval;
|
||||
zprop_source_t src = ZPROP_SRC_NONE;
|
||||
- nvlist_t *nvroot;
|
||||
- vdev_stat_t *vs;
|
||||
- uint_t vsc;
|
||||
|
||||
if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) {
|
||||
switch (prop) {
|
||||
@@ -261,7 +290,7 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf,
|
||||
break;
|
||||
|
||||
case ZPOOL_PROP_HEALTH:
|
||||
- (void) strlcpy(buf, "FAULTED", len);
|
||||
+ (void) strlcpy(buf, zpool_get_state_str(zhp), len);
|
||||
break;
|
||||
|
||||
case ZPOOL_PROP_GUID:
|
||||
@@ -362,14 +391,7 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf,
|
||||
break;
|
||||
|
||||
case ZPOOL_PROP_HEALTH:
|
||||
- verify(nvlist_lookup_nvlist(zpool_get_config(zhp, NULL),
|
||||
- ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0);
|
||||
- verify(nvlist_lookup_uint64_array(nvroot,
|
||||
- ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&vs, &vsc)
|
||||
- == 0);
|
||||
-
|
||||
- (void) strlcpy(buf, zpool_state_to_name(intval,
|
||||
- vs->vs_aux), len);
|
||||
+ (void) strlcpy(buf, zpool_get_state_str(zhp), len);
|
||||
break;
|
||||
case ZPOOL_PROP_VERSION:
|
||||
if (intval >= SPA_VERSION_FEATURES) {
|
||||
diff --git a/lib/libzfs/libzfs_status.c b/lib/libzfs/libzfs_status.c
|
||||
index 6cdcd382..5e423f3a 100644
|
||||
--- a/lib/libzfs/libzfs_status.c
|
||||
+++ b/lib/libzfs/libzfs_status.c
|
||||
@@ -403,12 +403,12 @@ zpool_status_t
|
||||
zpool_get_status(zpool_handle_t *zhp, char **msgid, zpool_errata_t *errata)
|
||||
{
|
||||
zpool_status_t ret = check_status(zhp->zpool_config, B_FALSE, errata);
|
||||
-
|
||||
- if (ret >= NMSGID)
|
||||
- *msgid = NULL;
|
||||
- else
|
||||
- *msgid = zfs_msgid_table[ret];
|
||||
-
|
||||
+ if (msgid != NULL) {
|
||||
+ if (ret >= NMSGID)
|
||||
+ *msgid = NULL;
|
||||
+ else
|
||||
+ *msgid = zfs_msgid_table[ret];
|
||||
+ }
|
||||
return (ret);
|
||||
}
|
||||
|
||||
diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c
|
||||
index e92c3948..cc1c641d 100644
|
||||
--- a/module/zfs/spa_misc.c
|
||||
+++ b/module/zfs/spa_misc.c
|
||||
@@ -2100,6 +2100,45 @@ spa_get_hostid(void)
|
||||
return (myhostid);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Return the pool state string ("ONLINE", "DEGRADED", "SUSPENDED", etc).
|
||||
+ */
|
||||
+const char *
|
||||
+spa_state_to_name(spa_t *spa)
|
||||
+{
|
||||
+ vdev_state_t state = spa->spa_root_vdev->vdev_state;
|
||||
+ vdev_aux_t aux = spa->spa_root_vdev->vdev_stat.vs_aux;
|
||||
+
|
||||
+ if (spa_suspended(spa) &&
|
||||
+ (spa_get_failmode(spa) != ZIO_FAILURE_MODE_CONTINUE))
|
||||
+ return ("SUSPENDED");
|
||||
+
|
||||
+ switch (state) {
|
||||
+ case VDEV_STATE_CLOSED:
|
||||
+ case VDEV_STATE_OFFLINE:
|
||||
+ return ("OFFLINE");
|
||||
+ case VDEV_STATE_REMOVED:
|
||||
+ return ("REMOVED");
|
||||
+ case VDEV_STATE_CANT_OPEN:
|
||||
+ if (aux == VDEV_AUX_CORRUPT_DATA || aux == VDEV_AUX_BAD_LOG)
|
||||
+ return ("FAULTED");
|
||||
+ else if (aux == VDEV_AUX_SPLIT_POOL)
|
||||
+ return ("SPLIT");
|
||||
+ else
|
||||
+ return ("UNAVAIL");
|
||||
+ case VDEV_STATE_FAULTED:
|
||||
+ return ("FAULTED");
|
||||
+ case VDEV_STATE_DEGRADED:
|
||||
+ return ("DEGRADED");
|
||||
+ case VDEV_STATE_HEALTHY:
|
||||
+ return ("ONLINE");
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return ("UNKNOWN");
|
||||
+}
|
||||
+
|
||||
#if defined(_KERNEL) && defined(HAVE_SPL)
|
||||
/* Namespace manipulation */
|
||||
EXPORT_SYMBOL(spa_lookup);
|
||||
@@ -2178,6 +2217,7 @@ EXPORT_SYMBOL(spa_is_root);
|
||||
EXPORT_SYMBOL(spa_writeable);
|
||||
EXPORT_SYMBOL(spa_mode);
|
||||
EXPORT_SYMBOL(spa_namespace_lock);
|
||||
+EXPORT_SYMBOL(spa_state_to_name);
|
||||
|
||||
/* BEGIN CSTYLED */
|
||||
module_param(zfs_flags, uint, 0644);
|
||||
diff --git a/module/zfs/spa_stats.c b/module/zfs/spa_stats.c
|
||||
index 8950d9c5..ca3d0be7 100644
|
||||
--- a/module/zfs/spa_stats.c
|
||||
+++ b/module/zfs/spa_stats.c
|
||||
@@ -22,6 +22,8 @@
|
||||
#include <sys/zfs_context.h>
|
||||
#include <sys/spa_impl.h>
|
||||
#include <sys/vdev_impl.h>
|
||||
+#include <sys/spa.h>
|
||||
+#include <zfs_comutil.h>
|
||||
|
||||
/*
|
||||
* Keeps stats on last N reads per spa_t, disabled by default.
|
||||
@@ -992,6 +994,64 @@ spa_mmp_history_add(spa_t *spa, uint64_t txg, uint64_t timestamp,
|
||||
return ((void *)smh);
|
||||
}
|
||||
|
||||
+static void *
|
||||
+spa_state_addr(kstat_t *ksp, loff_t n)
|
||||
+{
|
||||
+ return (ksp->ks_private); /* return the spa_t */
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+spa_state_data(char *buf, size_t size, void *data)
|
||||
+{
|
||||
+ spa_t *spa = (spa_t *)data;
|
||||
+ (void) snprintf(buf, size, "%s\n", spa_state_to_name(spa));
|
||||
+ return (0);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Return the state of the pool in /proc/spl/kstat/zfs/<pool>/state.
|
||||
+ *
|
||||
+ * This is a lock-less read of the pool's state (unlike using 'zpool', which
|
||||
+ * can potentially block for seconds). Because it doesn't block, it can useful
|
||||
+ * as a pool heartbeat value.
|
||||
+ */
|
||||
+static void
|
||||
+spa_state_init(spa_t *spa)
|
||||
+{
|
||||
+ spa_stats_history_t *ssh = &spa->spa_stats.state;
|
||||
+ char *name;
|
||||
+ kstat_t *ksp;
|
||||
+
|
||||
+ mutex_init(&ssh->lock, NULL, MUTEX_DEFAULT, NULL);
|
||||
+
|
||||
+ name = kmem_asprintf("zfs/%s", spa_name(spa));
|
||||
+ ksp = kstat_create(name, 0, "state", "misc",
|
||||
+ KSTAT_TYPE_RAW, 0, KSTAT_FLAG_VIRTUAL);
|
||||
+
|
||||
+ ssh->kstat = ksp;
|
||||
+ if (ksp) {
|
||||
+ ksp->ks_lock = &ssh->lock;
|
||||
+ ksp->ks_data = NULL;
|
||||
+ ksp->ks_private = spa;
|
||||
+ ksp->ks_flags |= KSTAT_FLAG_NO_HEADERS;
|
||||
+ kstat_set_raw_ops(ksp, NULL, spa_state_data, spa_state_addr);
|
||||
+ kstat_install(ksp);
|
||||
+ }
|
||||
+
|
||||
+ strfree(name);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+spa_health_destroy(spa_t *spa)
|
||||
+{
|
||||
+ spa_stats_history_t *ssh = &spa->spa_stats.state;
|
||||
+ kstat_t *ksp = ssh->kstat;
|
||||
+ if (ksp)
|
||||
+ kstat_delete(ksp);
|
||||
+
|
||||
+ mutex_destroy(&ssh->lock);
|
||||
+}
|
||||
+
|
||||
void
|
||||
spa_stats_init(spa_t *spa)
|
||||
{
|
||||
@@ -1000,11 +1060,13 @@ spa_stats_init(spa_t *spa)
|
||||
spa_tx_assign_init(spa);
|
||||
spa_io_history_init(spa);
|
||||
spa_mmp_history_init(spa);
|
||||
+ spa_state_init(spa);
|
||||
}
|
||||
|
||||
void
|
||||
spa_stats_destroy(spa_t *spa)
|
||||
{
|
||||
+ spa_health_destroy(spa);
|
||||
spa_tx_assign_destroy(spa);
|
||||
spa_txg_history_destroy(spa);
|
||||
spa_read_history_destroy(spa);
|
||||
diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run
|
||||
index 379c9f73..69e9eb26 100644
|
||||
--- a/tests/runfiles/linux.run
|
||||
+++ b/tests/runfiles/linux.run
|
||||
@@ -467,6 +467,10 @@ tests = ['inuse_001_pos', 'inuse_003_pos', 'inuse_004_pos',
|
||||
post =
|
||||
tags = ['functional', 'inuse']
|
||||
|
||||
+[tests/functional/kstat]
|
||||
+tests = ['state']
|
||||
+tags = ['functional', 'kstat']
|
||||
+
|
||||
[tests/functional/large_files]
|
||||
tests = ['large_files_001_pos', 'large_files_002_pos']
|
||||
tags = ['functional', 'large_files']
|
||||
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib
|
||||
index 13c85912..86dae6ea 100644
|
||||
--- a/tests/zfs-tests/include/libtest.shlib
|
||||
+++ b/tests/zfs-tests/include/libtest.shlib
|
||||
@@ -26,6 +26,7 @@
|
||||
# Copyright 2016 Nexenta Systems, Inc.
|
||||
# Copyright (c) 2017 Lawrence Livermore National Security, LLC.
|
||||
# Copyright (c) 2017 Datto Inc.
|
||||
+# Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
|
||||
#
|
||||
|
||||
. ${STF_TOOLS}/include/logapi.shlib
|
||||
@@ -3718,3 +3719,40 @@ function get_pool_devices #testpool #devdir
|
||||
fi
|
||||
echo $out
|
||||
}
|
||||
+
|
||||
+#
|
||||
+# Get scsi_debug device name.
|
||||
+# Returns basename of scsi_debug device (for example "sdb").
|
||||
+#
|
||||
+function get_debug_device
|
||||
+{
|
||||
+ for i in {1..10} ; do
|
||||
+ val=$(lsscsi | nawk '/scsi_debug/ {print $6; exit}' | cut -d / -f3)
|
||||
+
|
||||
+ # lsscsi can take time to settle
|
||||
+ if [ "$val" != "-" ] ; then
|
||||
+ break
|
||||
+ fi
|
||||
+ sleep 1
|
||||
+ done
|
||||
+ echo "$val"
|
||||
+}
|
||||
+
|
||||
+#
|
||||
+# Returns SCSI host number for the given disk
|
||||
+#
|
||||
+function get_scsi_host #disk
|
||||
+{
|
||||
+ typeset disk=$1
|
||||
+ ls /sys/block/${disk}/device/scsi_device | cut -d : -f 1
|
||||
+}
|
||||
+
|
||||
+#
|
||||
+# Simulate disk removal
|
||||
+#
|
||||
+function remove_disk #disk
|
||||
+{
|
||||
+ typeset disk=$1
|
||||
+ on_off_disk $disk "offline"
|
||||
+ block_device_wait
|
||||
+}
|
||||
diff --git a/tests/zfs-tests/tests/functional/Makefile.am b/tests/zfs-tests/tests/functional/Makefile.am
|
||||
index ea52205a..bbbf3ba0 100644
|
||||
--- a/tests/zfs-tests/tests/functional/Makefile.am
|
||||
+++ b/tests/zfs-tests/tests/functional/Makefile.am
|
||||
@@ -24,6 +24,7 @@ SUBDIRS = \
|
||||
history \
|
||||
inheritance \
|
||||
inuse \
|
||||
+ kstat \
|
||||
large_files \
|
||||
largest_pool \
|
||||
libzfs \
|
||||
diff --git a/tests/zfs-tests/tests/functional/kstat/Makefile.am b/tests/zfs-tests/tests/functional/kstat/Makefile.am
|
||||
new file mode 100644
|
||||
index 00000000..8ad83ec3
|
||||
--- /dev/null
|
||||
+++ b/tests/zfs-tests/tests/functional/kstat/Makefile.am
|
||||
@@ -0,0 +1,5 @@
|
||||
+pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/kstat
|
||||
+dist_pkgdata_SCRIPTS = \
|
||||
+ setup.ksh \
|
||||
+ cleanup.ksh \
|
||||
+ state.ksh
|
||||
diff --git a/tests/zfs-tests/tests/functional/kstat/cleanup.ksh b/tests/zfs-tests/tests/functional/kstat/cleanup.ksh
|
||||
new file mode 100755
|
||||
index 00000000..8a212ce3
|
||||
--- /dev/null
|
||||
+++ b/tests/zfs-tests/tests/functional/kstat/cleanup.ksh
|
||||
@@ -0,0 +1,28 @@
|
||||
+#!/bin/ksh -p
|
||||
+#
|
||||
+# CDDL HEADER START
|
||||
+#
|
||||
+# The contents of this file are subject to the terms of the
|
||||
+# Common Development and Distribution License (the "License").
|
||||
+# You may not use this file except in compliance with the License.
|
||||
+#
|
||||
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
+# or http://www.opensolaris.org/os/licensing.
|
||||
+# See the License for the specific language governing permissions
|
||||
+# and limitations under the License.
|
||||
+#
|
||||
+# When distributing Covered Code, include this CDDL HEADER in each
|
||||
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
+# If applicable, add the following below this CDDL HEADER, with the
|
||||
+# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
+# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
+#
|
||||
+# CDDL HEADER END
|
||||
+#
|
||||
+#
|
||||
+# Copyright (c) 2018 by Lawrence Livermore National Security, LLC.
|
||||
+#
|
||||
+
|
||||
+. $STF_SUITE/include/libtest.shlib
|
||||
+
|
||||
+default_cleanup
|
||||
diff --git a/tests/zfs-tests/tests/functional/kstat/setup.ksh b/tests/zfs-tests/tests/functional/kstat/setup.ksh
|
||||
new file mode 100755
|
||||
index 00000000..57717a09
|
||||
--- /dev/null
|
||||
+++ b/tests/zfs-tests/tests/functional/kstat/setup.ksh
|
||||
@@ -0,0 +1,34 @@
|
||||
+#!/bin/ksh -p
|
||||
+#
|
||||
+# CDDL HEADER START
|
||||
+#
|
||||
+# The contents of this file are subject to the terms of the
|
||||
+# Common Development and Distribution License (the "License").
|
||||
+# You may not use this file except in compliance with the License.
|
||||
+#
|
||||
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
+# or http://www.opensolaris.org/os/licensing.
|
||||
+# See the License for the specific language governing permissions
|
||||
+# and limitations under the License.
|
||||
+#
|
||||
+# When distributing Covered Code, include this CDDL HEADER in each
|
||||
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
+# If applicable, add the following below this CDDL HEADER, with the
|
||||
+# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
+# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
+#
|
||||
+# CDDL HEADER END
|
||||
+#
|
||||
+#
|
||||
+# Copyright (c) 2018 by Lawrence Livermore National Security, LLC.
|
||||
+#
|
||||
+
|
||||
+. $STF_SUITE/include/libtest.shlib
|
||||
+
|
||||
+if ! is_linux ; then
|
||||
+ log_unsupported "/proc/spl/kstat/<pool>/health only supported on Linux"
|
||||
+fi
|
||||
+
|
||||
+default_mirror_setup $DISKS
|
||||
+
|
||||
+log_pass
|
||||
diff --git a/tests/zfs-tests/tests/functional/kstat/state.ksh b/tests/zfs-tests/tests/functional/kstat/state.ksh
|
||||
new file mode 100755
|
||||
index 00000000..bf0b6e31
|
||||
--- /dev/null
|
||||
+++ b/tests/zfs-tests/tests/functional/kstat/state.ksh
|
||||
@@ -0,0 +1,144 @@
|
||||
+#!/bin/ksh -p
|
||||
+#
|
||||
+# CDDL HEADER START
|
||||
+#
|
||||
+# The contents of this file are subject to the terms of the
|
||||
+# Common Development and Distribution License (the "License").
|
||||
+# You may not use this file except in compliance with the License.
|
||||
+#
|
||||
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
+# or http://www.opensolaris.org/os/licensing.
|
||||
+# See the License for the specific language governing permissions
|
||||
+# and limitations under the License.
|
||||
+#
|
||||
+# When distributing Covered Code, include this CDDL HEADER in each
|
||||
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
+# If applicable, add the following below this CDDL HEADER, with the
|
||||
+# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
+# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
+#
|
||||
+# CDDL HEADER END
|
||||
+
|
||||
+#
|
||||
+# Copyright (c) 2018 by Lawrence Livermore National Security, LLC.
|
||||
+#
|
||||
+
|
||||
+#
|
||||
+# DESCRIPTION:
|
||||
+# Test /proc/spl/kstat/zfs/<pool>/state kstat
|
||||
+#
|
||||
+# STRATEGY:
|
||||
+# 1. Create a mirrored pool
|
||||
+# 2. Check that pool is ONLINE
|
||||
+# 3. Fault one disk
|
||||
+# 4. Check that pool is DEGRADED
|
||||
+# 5. Create a new pool with a single scsi_debug disk
|
||||
+# 6. Remove the disk
|
||||
+# 7. Check that pool is SUSPENDED
|
||||
+# 8. Add the disk back in
|
||||
+# 9. Clear errors and destroy the pools
|
||||
+
|
||||
+. $STF_SUITE/include/libtest.shlib
|
||||
+
|
||||
+verify_runnable "both"
|
||||
+
|
||||
+function cleanup
|
||||
+{
|
||||
+ # Destroy the scsi_debug pool
|
||||
+ if [ -n "$TESTPOOL2" ] ; then
|
||||
+ if [ -n "$host" ] ; then
|
||||
+ # Re-enable the disk
|
||||
+ scan_scsi_hosts $host
|
||||
+
|
||||
+ # Device may have changed names after being inserted
|
||||
+ SDISK=$(get_debug_device)
|
||||
+ log_must ln $DEV_RDSKDIR/$SDISK $REALDISK
|
||||
+ fi
|
||||
+
|
||||
+ # Restore our working pool image
|
||||
+ if [ -n "$BACKUP" ] ; then
|
||||
+ gunzip -c $BACKUP > $REALDISK
|
||||
+ log_must rm -f $BACKUP
|
||||
+ fi
|
||||
+
|
||||
+ # Our disk is back. Now we can clear errors and destroy the
|
||||
+ # pool cleanly.
|
||||
+ log_must zpool clear $TESTPOOL2
|
||||
+
|
||||
+ # Now that the disk is back and errors cleared, wait for our
|
||||
+ # hung 'zpool scrub' to finish.
|
||||
+ wait
|
||||
+
|
||||
+ destroy_pool $TESTPOOL2
|
||||
+ log_must rm $REALDISK
|
||||
+ unload_scsi_debug
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+# Check that our pool state values match what's expected
|
||||
+#
|
||||
+# $1: pool name
|
||||
+# $2: expected state ("ONLINE", "DEGRADED", "SUSPENDED", etc)
|
||||
+function check_all
|
||||
+{
|
||||
+ pool=$1
|
||||
+ expected=$2
|
||||
+
|
||||
+ state1=$(zpool status $pool | awk '/state: /{print $2}');
|
||||
+ state2=$(zpool list -H -o health $pool)
|
||||
+ state3=$(cat /proc/spl/kstat/zfs/$pool/state)
|
||||
+ log_note "Checking $expected = $state1 = $state2 = $state3"
|
||||
+ if [[ "$expected" == "$state1" && "$expected" == "$state2" && \
|
||||
+ "$expected" == "$state3" ]] ; then
|
||||
+ true
|
||||
+ else
|
||||
+ false
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+log_onexit cleanup
|
||||
+
|
||||
+log_assert "Testing /proc/spl/kstat/zfs/<pool>/state kstat"
|
||||
+
|
||||
+# Test that the initial pool is healthy
|
||||
+check_all $TESTPOOL "ONLINE"
|
||||
+
|
||||
+# Fault one of the disks, and check that pool is degraded
|
||||
+DISK1=$(echo "$DISKS" | awk '{print $2}')
|
||||
+zpool offline -tf $TESTPOOL $DISK1
|
||||
+check_all $TESTPOOL "DEGRADED"
|
||||
+
|
||||
+# Create a new pool out of a scsi_debug disk
|
||||
+TESTPOOL2=testpool2
|
||||
+MINVDEVSIZE_MB=$((MINVDEVSIZE / 1048576))
|
||||
+load_scsi_debug $MINVDEVSIZE_MB 1 1 1 '512b'
|
||||
+
|
||||
+SDISK=$(get_debug_device)
|
||||
+host=$(get_scsi_host $SDISK)
|
||||
+
|
||||
+# Use $REALDISK instead of $SDISK in our pool because $SDISK can change names
|
||||
+# as we remove/add the disk (i.e. /dev/sdf -> /dev/sdg).
|
||||
+REALDISK=/dev/kstat-state-realdisk
|
||||
+log_must [ ! -e $REALDISK ]
|
||||
+ln $DEV_RDSKDIR/$SDISK $REALDISK
|
||||
+
|
||||
+log_must zpool create $TESTPOOL2 $REALDISK
|
||||
+
|
||||
+# Backup the contents of the disk image
|
||||
+BACKUP=/tmp/kstat-state-realdisk.gz
|
||||
+log_must [ ! -e $BACKUP ]
|
||||
+gzip -c $REALDISK > $BACKUP
|
||||
+
|
||||
+# Yank out the disk from under the pool
|
||||
+log_must rm $REALDISK
|
||||
+remove_disk $SDISK
|
||||
+
|
||||
+# Run a 'zpool scrub' in the background to suspend the pool. We run it in the
|
||||
+# background since the command will hang when the pool gets suspended. The
|
||||
+# command will resume and exit after we restore the missing disk later on.
|
||||
+zpool scrub $TESTPOOL2 &
|
||||
+sleep 1 # Give the scrub some time to run before we check if it fails
|
||||
+
|
||||
+log_must check_all $TESTPOOL2 "SUSPENDED"
|
||||
+
|
||||
+log_pass "/proc/spl/kstat/zfs/<pool>/state test successful"
|
||||
@@ -0,0 +1,115 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Date: Tue, 19 Jun 2018 21:52:45 -0700
|
||||
Subject: [PATCH] Linux 4.14 compat: blk_queue_stackable()
|
||||
|
||||
The blk_queue_stackable() function was replaced in the 4.14 kernel
|
||||
by queue_is_rq_based(), commit torvalds/linux@5fdee212. This change
|
||||
resulted in the default elevator being used which can negatively
|
||||
impact performance.
|
||||
|
||||
Rather than adding additional compatibility code to detect the
|
||||
new interface unconditionally attempt to set the elevator. Since
|
||||
we expect this to fail for block devices without an elevator the
|
||||
error message has been moved in to zfs_dbgmsg().
|
||||
|
||||
Finally, it was observed that the elevator_change() was removed
|
||||
from the 4.12 kernel, commit torvalds/linux@c033269. Update the
|
||||
comment to clearly specify which are expected to export the
|
||||
elevator_change() symbol.
|
||||
|
||||
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
|
||||
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Closes #7645
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
config/kernel-elevator-change.m4 | 4 ++--
|
||||
include/linux/blkdev_compat.h | 11 -----------
|
||||
module/zfs/vdev_disk.c | 22 ++++++++++------------
|
||||
3 files changed, 12 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/config/kernel-elevator-change.m4 b/config/kernel-elevator-change.m4
|
||||
index ace5aa82..eba25257 100644
|
||||
--- a/config/kernel-elevator-change.m4
|
||||
+++ b/config/kernel-elevator-change.m4
|
||||
@@ -1,6 +1,6 @@
|
||||
dnl #
|
||||
-dnl # 2.6.36 API change
|
||||
-dnl # Verify the elevator_change() symbol is available.
|
||||
+dnl # 2.6.36 API, exported elevator_change() symbol
|
||||
+dnl # 4.12 API, removed elevator_change() symbol
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_ELEVATOR_CHANGE], [
|
||||
AC_MSG_CHECKING([whether elevator_change() is available])
|
||||
diff --git a/include/linux/blkdev_compat.h b/include/linux/blkdev_compat.h
|
||||
index 27f05662..c8cdf38e 100644
|
||||
--- a/include/linux/blkdev_compat.h
|
||||
+++ b/include/linux/blkdev_compat.h
|
||||
@@ -106,17 +106,6 @@ blk_queue_set_write_cache(struct request_queue *q, bool wc, bool fua)
|
||||
#endif
|
||||
|
||||
/*
|
||||
- * 2.6.27 API change,
|
||||
- * The blk_queue_stackable() queue flag was added in 2.6.27 to handle dm
|
||||
- * stacking drivers. Prior to this request stacking drivers were detected
|
||||
- * by checking (q->request_fn == NULL), for earlier kernels we revert to
|
||||
- * this legacy behavior.
|
||||
- */
|
||||
-#ifndef blk_queue_stackable
|
||||
-#define blk_queue_stackable(q) ((q)->request_fn == NULL)
|
||||
-#endif
|
||||
-
|
||||
-/*
|
||||
* 2.6.34 API change,
|
||||
* The blk_queue_max_hw_sectors() function replaces blk_queue_max_sectors().
|
||||
*/
|
||||
diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c
|
||||
index 6dc0544f..c5708cb2 100644
|
||||
--- a/module/zfs/vdev_disk.c
|
||||
+++ b/module/zfs/vdev_disk.c
|
||||
@@ -168,23 +168,20 @@ vdev_elevator_switch(vdev_t *v, char *elevator)
|
||||
if (!v->vdev_wholedisk && strncmp(device, "dm-", 3) != 0)
|
||||
return;
|
||||
|
||||
- /* Skip devices without schedulers (loop, ram, dm, etc) */
|
||||
- if (!q->elevator || !blk_queue_stackable(q))
|
||||
- return;
|
||||
-
|
||||
/* Leave existing scheduler when set to "none" */
|
||||
if ((strncmp(elevator, "none", 4) == 0) && (strlen(elevator) == 4))
|
||||
return;
|
||||
|
||||
+ /*
|
||||
+ * The elevator_change() function was available in kernels from
|
||||
+ * 2.6.36 to 4.11. When not available fall back to using the user
|
||||
+ * mode helper functionality to set the elevator via sysfs. This
|
||||
+ * requires /bin/echo and sysfs to be mounted which may not be true
|
||||
+ * early in the boot process.
|
||||
+ */
|
||||
#ifdef HAVE_ELEVATOR_CHANGE
|
||||
error = elevator_change(q, elevator);
|
||||
#else
|
||||
- /*
|
||||
- * For pre-2.6.36 kernels elevator_change() is not available.
|
||||
- * Therefore we fall back to using a usermodehelper to echo the
|
||||
- * elevator into sysfs; This requires /bin/echo and sysfs to be
|
||||
- * mounted which may not be true early in the boot process.
|
||||
- */
|
||||
#define SET_SCHEDULER_CMD \
|
||||
"exec 0</dev/null " \
|
||||
" 1>/sys/block/%s/queue/scheduler " \
|
||||
@@ -198,9 +195,10 @@ vdev_elevator_switch(vdev_t *v, char *elevator)
|
||||
error = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
|
||||
strfree(argv[2]);
|
||||
#endif /* HAVE_ELEVATOR_CHANGE */
|
||||
- if (error)
|
||||
- printk("ZFS: Unable to set \"%s\" scheduler for %s (%s): %d\n",
|
||||
+ if (error) {
|
||||
+ zfs_dbgmsg("Unable to set \"%s\" scheduler for %s (%s): %d\n",
|
||||
elevator, v->vdev_path, device, error);
|
||||
+ }
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -0,0 +1,54 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Troels=20N=C3=B8rgaard?= <tnn@tradeshift.com>
|
||||
Date: Sat, 7 Jul 2018 01:15:19 +0200
|
||||
Subject: [PATCH] Default ashift for Amazon EC2 NVMe devices
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Add a default 4 KiB ashift for Amazon EC2 NVMe devices on instances with
|
||||
NVMe ephemeral devices, such as the types c5d, f1, i3 and m5d.
|
||||
As per the official documentation [1] a 4096 byte blocksize should be
|
||||
used to match the underlying hardware.
|
||||
|
||||
The string was identified via:
|
||||
|
||||
$ sudo sginfo -M /dev/nvme0n1
|
||||
INQUIRY response (cmd: 0x12)
|
||||
----------------------------
|
||||
Device Type 0
|
||||
Vendor: NVMe
|
||||
Product: Amazon EC2 NVMe
|
||||
Revision level:
|
||||
|
||||
$ lsblk -io KNAME,TYPE,SIZE,MODEL
|
||||
KNAME TYPE SIZE MODEL
|
||||
nvme0n1 disk 442.4G Amazon EC2 NVMe Instance Storage
|
||||
|
||||
[1] https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/
|
||||
storage-optimized-instances.html
|
||||
Retrived 2018-07-03
|
||||
|
||||
Reviewed-by: George Melikov <mail@gmelikov.ru>
|
||||
Reviewed-by: Giuseppe Di Natale <guss80@gmail.com>
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Signed-off-by: Troels Nørgaard <tnn@tradeshift.com>
|
||||
Closes #7676
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
cmd/zpool/zpool_vdev.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/cmd/zpool/zpool_vdev.c b/cmd/zpool/zpool_vdev.c
|
||||
index fd6bd9e7..69ff7ff6 100644
|
||||
--- a/cmd/zpool/zpool_vdev.c
|
||||
+++ b/cmd/zpool/zpool_vdev.c
|
||||
@@ -191,6 +191,7 @@ static vdev_disk_db_entry_t vdev_disk_database[] = {
|
||||
{"ATA INTEL SSDSC2BP24", 4096},
|
||||
{"ATA INTEL SSDSC2BP48", 4096},
|
||||
{"NA SmrtStorSDLKAE9W", 4096},
|
||||
+ {"NVMe Amazon EC2 NVMe ", 4096},
|
||||
/* Imported from Open Solaris */
|
||||
{"ATA MARVELL SD88SA02", 4096},
|
||||
/* Advanced format Hard drives */
|
||||
@@ -0,0 +1,123 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Date: Wed, 11 Jul 2018 13:10:40 -0700
|
||||
Subject: [PATCH] Fix kernel unaligned access on sparc64
|
||||
|
||||
Update the SA_COPY_DATA macro to check if architecture supports
|
||||
efficient unaligned memory accesses at compile time. Otherwise
|
||||
fallback to using the sa_copy_data() function.
|
||||
|
||||
The kernel provided CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is
|
||||
used to determine availability in kernel space. In user space
|
||||
the x86_64, x86, powerpc, and sometimes arm architectures will
|
||||
define the HAVE_EFFICIENT_UNALIGNED_ACCESS macro.
|
||||
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Closes #7642
|
||||
Closes #7684
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
lib/libspl/include/sys/isa_defs.h | 7 +++++++
|
||||
module/icp/algs/modes/ccm.c | 2 +-
|
||||
module/zfs/sa.c | 35 ++++++++++++++++++++---------------
|
||||
3 files changed, 28 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/lib/libspl/include/sys/isa_defs.h b/lib/libspl/include/sys/isa_defs.h
|
||||
index a5bea039..7a90e077 100644
|
||||
--- a/lib/libspl/include/sys/isa_defs.h
|
||||
+++ b/lib/libspl/include/sys/isa_defs.h
|
||||
@@ -55,6 +55,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define _SUNOS_VTOC_16
|
||||
+#define HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
|
||||
/* i386 arch specific defines */
|
||||
#elif defined(__i386) || defined(__i386__)
|
||||
@@ -76,6 +77,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define _SUNOS_VTOC_16
|
||||
+#define HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
|
||||
/* powerpc arch specific defines */
|
||||
#elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__)
|
||||
@@ -99,6 +101,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define _SUNOS_VTOC_16
|
||||
+#define HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
|
||||
/* arm arch specific defines */
|
||||
#elif defined(__arm) || defined(__arm__) || defined(__aarch64__)
|
||||
@@ -129,6 +132,10 @@ extern "C" {
|
||||
|
||||
#define _SUNOS_VTOC_16
|
||||
|
||||
+#if defined(__ARM_FEATURE_UNALIGNED)
|
||||
+#define HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
+#endif
|
||||
+
|
||||
/* sparc arch specific defines */
|
||||
#elif defined(__sparc) || defined(__sparc__)
|
||||
|
||||
diff --git a/module/icp/algs/modes/ccm.c b/module/icp/algs/modes/ccm.c
|
||||
index 22aeb0a6..fb41194f 100644
|
||||
--- a/module/icp/algs/modes/ccm.c
|
||||
+++ b/module/icp/algs/modes/ccm.c
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <sys/crypto/common.h>
|
||||
#include <sys/crypto/impl.h>
|
||||
|
||||
-#if defined(__i386) || defined(__amd64)
|
||||
+#ifdef HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
#include <sys/byteorder.h>
|
||||
#define UNALIGNED_POINTERS_PERMITTED
|
||||
#endif
|
||||
diff --git a/module/zfs/sa.c b/module/zfs/sa.c
|
||||
index 8046dbde..1fb1a8b5 100644
|
||||
--- a/module/zfs/sa.c
|
||||
+++ b/module/zfs/sa.c
|
||||
@@ -147,21 +147,26 @@ arc_byteswap_func_t sa_bswap_table[] = {
|
||||
zfs_acl_byteswap,
|
||||
};
|
||||
|
||||
-#define SA_COPY_DATA(f, s, t, l) \
|
||||
- { \
|
||||
- if (f == NULL) { \
|
||||
- if (l == 8) { \
|
||||
- *(uint64_t *)t = *(uint64_t *)s; \
|
||||
- } else if (l == 16) { \
|
||||
- *(uint64_t *)t = *(uint64_t *)s; \
|
||||
- *(uint64_t *)((uintptr_t)t + 8) = \
|
||||
- *(uint64_t *)((uintptr_t)s + 8); \
|
||||
- } else { \
|
||||
- bcopy(s, t, l); \
|
||||
- } \
|
||||
- } else \
|
||||
- sa_copy_data(f, s, t, l); \
|
||||
- }
|
||||
+#ifdef HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
+#define SA_COPY_DATA(f, s, t, l) \
|
||||
+do { \
|
||||
+ if (f == NULL) { \
|
||||
+ if (l == 8) { \
|
||||
+ *(uint64_t *)t = *(uint64_t *)s; \
|
||||
+ } else if (l == 16) { \
|
||||
+ *(uint64_t *)t = *(uint64_t *)s; \
|
||||
+ *(uint64_t *)((uintptr_t)t + 8) = \
|
||||
+ *(uint64_t *)((uintptr_t)s + 8); \
|
||||
+ } else { \
|
||||
+ bcopy(s, t, l); \
|
||||
+ } \
|
||||
+ } else { \
|
||||
+ sa_copy_data(f, s, t, l); \
|
||||
+ } \
|
||||
+} while (0)
|
||||
+#else
|
||||
+#define SA_COPY_DATA(f, s, t, l) sa_copy_data(f, s, t, l)
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* This table is fixed and cannot be changed. Its purpose is to
|
||||
@@ -0,0 +1,91 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Date: Wed, 11 Jul 2018 15:49:10 -0700
|
||||
Subject: [PATCH] Fix zpl_mount() deadlock
|
||||
|
||||
Commit 93b43af10 inadvertently introduced the following scenario which
|
||||
can result in a deadlock. This issue was most easily reproduced by
|
||||
LXD containers using a ZFS storage backend but should be reproducible
|
||||
under any workload which is frequently mounting and unmounting.
|
||||
|
||||
-- THREAD A --
|
||||
spa_sync()
|
||||
spa_sync_upgrades()
|
||||
rrw_enter(&dp->dp_config_rwlock, RW_WRITER, FTAG); <- Waiting on B
|
||||
|
||||
-- THREAD B --
|
||||
mount_fs()
|
||||
zpl_mount()
|
||||
zpl_mount_impl()
|
||||
dmu_objset_hold()
|
||||
dmu_objset_hold_flags()
|
||||
dsl_pool_hold()
|
||||
dsl_pool_config_enter()
|
||||
rrw_enter(&dp->dp_config_rwlock, RW_READER, tag);
|
||||
sget()
|
||||
sget_userns()
|
||||
grab_super()
|
||||
down_write(&s->s_umount); <- Waiting on C
|
||||
|
||||
-- THREAD C --
|
||||
cleanup_mnt()
|
||||
deactivate_super()
|
||||
down_write(&s->s_umount);
|
||||
deactivate_locked_super()
|
||||
zpl_kill_sb()
|
||||
kill_anon_super()
|
||||
generic_shutdown_super()
|
||||
sync_filesystem()
|
||||
zpl_sync_fs()
|
||||
zfs_sync()
|
||||
zil_commit()
|
||||
txg_wait_synced() <- Waiting on A
|
||||
|
||||
Reviewed by: Alek Pinchuk <apinchuk@datto.com>
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Closes #7598
|
||||
Closes #7659
|
||||
Closes #7691
|
||||
Closes #7693
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
include/sys/zfs_vfsops.h | 1 +
|
||||
module/zfs/zpl_super.c | 11 ++++++++++-
|
||||
2 files changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/sys/zfs_vfsops.h b/include/sys/zfs_vfsops.h
|
||||
index 2326da42..927153b2 100644
|
||||
--- a/include/sys/zfs_vfsops.h
|
||||
+++ b/include/sys/zfs_vfsops.h
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <sys/zil.h>
|
||||
#include <sys/sa.h>
|
||||
#include <sys/rrwlock.h>
|
||||
+#include <sys/dsl_dataset.h>
|
||||
#include <sys/zfs_ioctl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
diff --git a/module/zfs/zpl_super.c b/module/zfs/zpl_super.c
|
||||
index fc10271b..5c426b0a 100644
|
||||
--- a/module/zfs/zpl_super.c
|
||||
+++ b/module/zfs/zpl_super.c
|
||||
@@ -271,8 +271,17 @@ zpl_mount_impl(struct file_system_type *fs_type, int flags, zfs_mnt_t *zm)
|
||||
if (err)
|
||||
return (ERR_PTR(-err));
|
||||
|
||||
+ /*
|
||||
+ * The dsl pool lock must be released prior to calling sget().
|
||||
+ * It is possible sget() may block on the lock in grab_super()
|
||||
+ * while deactivate_super() holds that same lock and waits for
|
||||
+ * a txg sync. If the dsl_pool lock is held over over sget()
|
||||
+ * this can prevent the pool sync and cause a deadlock.
|
||||
+ */
|
||||
+ dsl_pool_rele(dmu_objset_pool(os), FTAG);
|
||||
s = zpl_sget(fs_type, zpl_test_super, set_anon_super, flags, os);
|
||||
- dmu_objset_rele(os, FTAG);
|
||||
+ dsl_dataset_rele(dmu_objset_ds(os), FTAG);
|
||||
+
|
||||
if (IS_ERR(s))
|
||||
return (ERR_CAST(s));
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Toomas Soome <tsoome@me.com>
|
||||
Date: Wed, 1 Jun 2016 19:18:10 +0300
|
||||
Subject: [PATCH] OpenZFS 8906 - uts: illumos rootfs should support salted
|
||||
cksum
|
||||
|
||||
Porting notes:
|
||||
* As of grub-2.02 these checksums are not supported. However, as
|
||||
pointed out in #6501 there are alternatives such as EFISTUB which
|
||||
work and have no such restriction. A warning was added to the
|
||||
checksum property section of the zfs.8 man page.
|
||||
|
||||
Authored by: Toomas Soome <tsoome@me.com>
|
||||
Reviewed by: C Fraire <cfraire@me.com>
|
||||
Reviewed by: Robert Mustacchi <rm@joyent.com>
|
||||
Reviewed by: Yuri Pankov <yuripv@yuripv.net>
|
||||
Approved by: Dan McDonald <danmcd@joyent.com>
|
||||
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
|
||||
OpenZFS-issue: https://illumos.org/issues/8906
|
||||
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/7dec52f
|
||||
Closes #6501
|
||||
Closes #7714
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
man/man5/zpool-features.5 | 18 +++++++-----------
|
||||
man/man8/zfs.8 | 5 ++++-
|
||||
module/zfs/zfs_ioctl.c | 11 +----------
|
||||
3 files changed, 12 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/man/man5/zpool-features.5 b/man/man5/zpool-features.5
|
||||
index 78ea559f..140ce269 100644
|
||||
--- a/man/man5/zpool-features.5
|
||||
+++ b/man/man5/zpool-features.5
|
||||
@@ -14,7 +14,7 @@
|
||||
.\" CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your
|
||||
.\" own identifying information:
|
||||
.\" Portions Copyright [yyyy] [name of copyright owner]
|
||||
-.TH ZPOOL-FEATURES 5 "Aug 27, 2013"
|
||||
+.TH ZPOOL-FEATURES 5 "Jun 8, 2018"
|
||||
.SH NAME
|
||||
zpool\-features \- ZFS pool feature descriptions
|
||||
.SH DESCRIPTION
|
||||
@@ -248,8 +248,9 @@ immediately activate the \fBlz4_compress\fR feature on the underlying
|
||||
pool using the \fBzfs\fR(1M) command. Also, all newly written metadata
|
||||
will be compressed with \fBlz4\fR algorithm. Since this feature is not
|
||||
read-only compatible, this operation will render the pool unimportable
|
||||
-on systems without support for the \fBlz4_compress\fR feature. Booting
|
||||
-off of \fBlz4\fR-compressed root pools is supported.
|
||||
+on systems without support for the \fBlz4_compress\fR feature.
|
||||
+
|
||||
+Booting off of \fBlz4\fR-compressed root pools is supported.
|
||||
|
||||
This feature becomes \fBactive\fR as soon as it is enabled and will
|
||||
never return to being \fBenabled\fB.
|
||||
@@ -510,8 +511,7 @@ can turn on the \fBsha512\fR checksum on any dataset using the
|
||||
and will return to being \fBenabled\fR once all filesystems that have
|
||||
ever had their checksum set to \fBsha512\fR are destroyed.
|
||||
|
||||
-Booting off of pools utilizing SHA-512/256 is supported (provided that
|
||||
-the updated GRUB stage2 module is installed).
|
||||
+Booting off of pools utilizing SHA-512/256 is supported.
|
||||
|
||||
.RE
|
||||
|
||||
@@ -545,9 +545,7 @@ can turn on the \fBskein\fR checksum on any dataset using the
|
||||
and will return to being \fBenabled\fR once all filesystems that have
|
||||
ever had their checksum set to \fBskein\fR are destroyed.
|
||||
|
||||
-Booting off of pools using \fBskein\fR is \fBNOT\fR supported
|
||||
--- any attempt to enable \fBskein\fR on a root pool will fail with an
|
||||
-error.
|
||||
+Booting off of pools using \fBskein\fR is supported.
|
||||
|
||||
.RE
|
||||
|
||||
@@ -587,9 +585,7 @@ can turn on the \fBedonr\fR checksum on any dataset using the
|
||||
and will return to being \fBenabled\fR once all filesystems that have
|
||||
ever had their checksum set to \fBedonr\fR are destroyed.
|
||||
|
||||
-Booting off of pools using \fBedonr\fR is \fBNOT\fR supported
|
||||
--- any attempt to enable \fBedonr\fR on a root pool will fail with an
|
||||
-error.
|
||||
+Booting off of pools using \fBedonr\fR is supported.
|
||||
|
||||
.RE
|
||||
|
||||
diff --git a/man/man8/zfs.8 b/man/man8/zfs.8
|
||||
index 48a5e6ea..bb3b46e3 100644
|
||||
--- a/man/man8/zfs.8
|
||||
+++ b/man/man8/zfs.8
|
||||
@@ -29,7 +29,7 @@
|
||||
.\" Copyright 2016 Nexenta Systems, Inc.
|
||||
.\" Copyright 2016 Richard Laager. All rights reserved.
|
||||
.\"
|
||||
-.Dd June 28, 2017
|
||||
+.Dd July 13, 2018
|
||||
.Dt ZFS 8 SMM
|
||||
.Os Linux
|
||||
.Sh NAME
|
||||
@@ -1049,6 +1049,9 @@ The
|
||||
and
|
||||
.Sy edonr
|
||||
checksum algorithms require enabling the appropriate features on the pool.
|
||||
+These algorithms are not supported by GRUB and should not be set on the
|
||||
+.Sy bootfs
|
||||
+filesystem when using GRUB to boot the system.
|
||||
Please see
|
||||
.Xr zpool-features 5
|
||||
for more information on these algorithms.
|
||||
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c
|
||||
index f4f509a7..6516f646 100644
|
||||
--- a/module/zfs/zfs_ioctl.c
|
||||
+++ b/module/zfs/zfs_ioctl.c
|
||||
@@ -3985,16 +3985,7 @@ zfs_check_settable(const char *dsname, nvpair_t *pair, cred_t *cr)
|
||||
|
||||
if ((err = spa_open(dsname, &spa, FTAG)) != 0)
|
||||
return (err);
|
||||
- /*
|
||||
- * Salted checksums are not supported on root pools.
|
||||
- */
|
||||
- if (spa_bootfs(spa) != 0 &&
|
||||
- intval < ZIO_CHECKSUM_FUNCTIONS &&
|
||||
- (zio_checksum_table[intval].ci_flags &
|
||||
- ZCHECKSUM_FLAG_SALTED)) {
|
||||
- spa_close(spa, FTAG);
|
||||
- return (SET_ERROR(ERANGE));
|
||||
- }
|
||||
+
|
||||
if (!spa_feature_is_enabled(spa, feature)) {
|
||||
spa_close(spa, FTAG);
|
||||
return (SET_ERROR(ENOTSUP));
|
||||
@@ -0,0 +1,108 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: LOLi <loli10K@users.noreply.github.com>
|
||||
Date: Tue, 1 May 2018 05:58:29 +0200
|
||||
Subject: [PATCH] Fix zfs incremental send remove '-o' properties
|
||||
|
||||
When receiving an incremental send stream with intermediary snapshots
|
||||
zfs_receive_one() does not correctly identify the top-level dataset:
|
||||
consequently we restore said snapshots as if they were children
|
||||
datasets in the hierarchy, forcing inheritance of any property received
|
||||
with 'zfs send -o' and effectively removing any locally set value.
|
||||
|
||||
The test case did not correctly verify this situation because it uses
|
||||
adjacent snapshots, basically testing 'zfs send -i' instead of
|
||||
'zfs send -I': this commit adds an additional intermediary snapshot to
|
||||
the test script.
|
||||
|
||||
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
|
||||
Closes #7478
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
lib/libzfs/libzfs_sendrecv.c | 2 +-
|
||||
.../zfs_receive/receive-o-x_props_override.ksh | 22 +++++++++++++---------
|
||||
2 files changed, 14 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c
|
||||
index 5490581a..c5acd21a 100644
|
||||
--- a/lib/libzfs/libzfs_sendrecv.c
|
||||
+++ b/lib/libzfs/libzfs_sendrecv.c
|
||||
@@ -3592,7 +3592,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
|
||||
goto out;
|
||||
}
|
||||
|
||||
- if (top_zfs && *top_zfs == NULL)
|
||||
+ if (top_zfs && (*top_zfs == NULL || strcmp(*top_zfs, name) == 0))
|
||||
toplevel = B_TRUE;
|
||||
if (drrb->drr_type == DMU_OST_ZVOL) {
|
||||
type = ZFS_TYPE_VOLUME;
|
||||
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/receive-o-x_props_override.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/receive-o-x_props_override.ksh
|
||||
index e4e69851..4e3a5393 100755
|
||||
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/receive-o-x_props_override.ksh
|
||||
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/receive-o-x_props_override.ksh
|
||||
@@ -212,16 +212,17 @@ log_must eval "zfs send -R $orig@snap1 > $streamfile_repl"
|
||||
log_must eval "zfs recv $dest < $streamfile_repl"
|
||||
# Fill the datasets with properties and create an incremental replication stream
|
||||
log_must zfs snapshot -r $orig@snap2
|
||||
+log_must zfs snapshot -r $orig@snap3
|
||||
log_must eval "zfs set copies=2 $orig"
|
||||
log_must eval "zfs set '$userprop:orig'='$userval' $orig"
|
||||
log_must eval "zfs set '$userprop:orig'='$userval' $origsub"
|
||||
log_must eval "zfs set '$userprop:snap'='$userval' $orig@snap1"
|
||||
-log_must eval "zfs set '$userprop:snap'='$userval' $origsub@snap2"
|
||||
-log_must eval "zfs send -R -I $orig@snap1 $orig@snap2 > $streamfile_incr"
|
||||
+log_must eval "zfs set '$userprop:snap'='$userval' $origsub@snap3"
|
||||
+log_must eval "zfs send -R -I $orig@snap1 $orig@snap3 > $streamfile_incr"
|
||||
# Sets various combination of override and exclude options
|
||||
log_must eval "zfs recv -F -o atime=off -o '$userprop:dest2'='$userval' "\
|
||||
"-o quota=123456789 -x compression -x '$userprop:orig' " \
|
||||
- "-x '$userprop:snap2' $dest < $streamfile_incr"
|
||||
+ "-x '$userprop:snap3' $dest < $streamfile_incr"
|
||||
# Verify we can correctly override and exclude properties
|
||||
log_must eval "check_prop_source $dest copies 2 received"
|
||||
log_must eval "check_prop_source $dest atime off local"
|
||||
@@ -237,9 +238,9 @@ log_must eval "check_prop_missing $destsub '$userprop:orig'"
|
||||
log_must eval "check_prop_source " \
|
||||
"$dest@snap1 '$userprop:snap' '$userval' received"
|
||||
log_must eval "check_prop_source " \
|
||||
- "$destsub@snap2 '$userprop:snap' '$userval' received"
|
||||
-log_must eval "check_prop_missing $dest@snap2 '$userprop:snap2'"
|
||||
-log_must eval "check_prop_missing $destsub@snap2 '$userprop:snap2'"
|
||||
+ "$destsub@snap3 '$userprop:snap' '$userval' received"
|
||||
+log_must eval "check_prop_missing $dest@snap3 '$userprop:snap3'"
|
||||
+log_must eval "check_prop_missing $destsub@snap3 '$userprop:snap3'"
|
||||
# Cleanup
|
||||
log_must zfs destroy -r -f $orig
|
||||
log_must zfs destroy -r -f $dest
|
||||
@@ -270,7 +271,8 @@ log_must eval "zfs set compression=gzip $dest"
|
||||
log_must eval "zfs set '$userprop:dest'='localval' $dest"
|
||||
# Receive the new stream, verify we preserve locally set properties
|
||||
log_must zfs snapshot -r $orig@snap2
|
||||
-log_must eval "zfs send -R -I $orig@snap1 $orig@snap2 > $streamfile_incr"
|
||||
+log_must zfs snapshot -r $orig@snap3
|
||||
+log_must eval "zfs send -R -I $orig@snap1 $orig@snap3 > $streamfile_incr"
|
||||
log_must eval "zfs recv -F -x copies -x compression -x '$userprop:orig' " \
|
||||
"-x '$userprop:dest' $dest < $streamfile_incr"
|
||||
log_must eval "check_prop_source $dest '$userprop:dest' 'localval' local"
|
||||
@@ -305,7 +307,8 @@ log_must eval "check_prop_source $destsub quota 0 default"
|
||||
log_must eval "zfs set quota=123456789 $dest"
|
||||
log_must eval "zfs set canmount=off $destsub"
|
||||
log_must zfs snapshot -r $orig@snap2
|
||||
-log_must eval "zfs send -R -I $orig@snap1 $orig@snap2 > $streamfile_incr"
|
||||
+log_must zfs snapshot -r $orig@snap3
|
||||
+log_must eval "zfs send -R -I $orig@snap1 $orig@snap3 > $streamfile_incr"
|
||||
log_must eval "zfs recv -F -x quota -x canmount $dest < $streamfile_incr"
|
||||
log_must eval "check_prop_source $dest quota 123456789 local"
|
||||
log_must eval "check_prop_source $destsub quota 0 default"
|
||||
@@ -332,7 +335,8 @@ log_must eval "zfs set '$userprop:origsub'='$userval' $destsub"
|
||||
mntpnt=$(get_prop mountpoint $orig)
|
||||
log_must eval "dd if=/dev/urandom of=$mntpnt/file bs=1024k count=10"
|
||||
log_must zfs snapshot -r $orig@snap2
|
||||
-log_must eval "zfs send -R -I $orig@snap1 $orig@snap2 > $streamfile_incr"
|
||||
+log_must zfs snapshot -r $orig@snap3
|
||||
+log_must eval "zfs send -R -I $orig@snap1 $orig@snap3 > $streamfile_incr"
|
||||
log_must eval "dd if=$streamfile_incr of=$streamfile_trun bs=1024k count=9"
|
||||
# Receive the truncated stream, verify original properties are kept
|
||||
log_mustnot eval "zfs recv -F -o copies=3 -o quota=987654321 "\
|
||||
@@ -0,0 +1,95 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: LOLi <loli10K@users.noreply.github.com>
|
||||
Date: Fri, 3 Aug 2018 23:56:25 +0200
|
||||
Subject: [PATCH] Allow inherited properties in zfs_check_settable()
|
||||
|
||||
This change modifies how 'checksum' and 'dedup' properties are verified
|
||||
in zfs_check_settable() handling the case where they are explicitly
|
||||
inherited in the dataset hierarchy when receiving a recursive send
|
||||
stream.
|
||||
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Reviewed-by: Tom Caputi <tcaputi@datto.com>
|
||||
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
|
||||
Closes #7755
|
||||
Closes #7576
|
||||
Closes #7757
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
module/zfs/zfs_ioctl.c | 26 +++++++++++-----------
|
||||
.../zfs_receive/receive-o-x_props_override.ksh | 6 +++--
|
||||
2 files changed, 17 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c
|
||||
index 6516f646..b8783e54 100644
|
||||
--- a/module/zfs/zfs_ioctl.c
|
||||
+++ b/module/zfs/zfs_ioctl.c
|
||||
@@ -3967,7 +3967,6 @@ zfs_check_settable(const char *dsname, nvpair_t *pair, cred_t *cr)
|
||||
{
|
||||
spa_feature_t feature;
|
||||
spa_t *spa;
|
||||
- uint64_t intval;
|
||||
int err;
|
||||
|
||||
/* dedup feature version checks */
|
||||
@@ -3975,22 +3974,23 @@ zfs_check_settable(const char *dsname, nvpair_t *pair, cred_t *cr)
|
||||
zfs_earlier_version(dsname, SPA_VERSION_DEDUP))
|
||||
return (SET_ERROR(ENOTSUP));
|
||||
|
||||
- if (nvpair_value_uint64(pair, &intval) != 0)
|
||||
- return (SET_ERROR(EINVAL));
|
||||
-
|
||||
- /* check prop value is enabled in features */
|
||||
- feature = zio_checksum_to_feature(intval & ZIO_CHECKSUM_MASK);
|
||||
- if (feature == SPA_FEATURE_NONE)
|
||||
- break;
|
||||
+ if (nvpair_type(pair) == DATA_TYPE_UINT64 &&
|
||||
+ nvpair_value_uint64(pair, &intval) == 0) {
|
||||
+ /* check prop value is enabled in features */
|
||||
+ feature = zio_checksum_to_feature(
|
||||
+ intval & ZIO_CHECKSUM_MASK);
|
||||
+ if (feature == SPA_FEATURE_NONE)
|
||||
+ break;
|
||||
|
||||
- if ((err = spa_open(dsname, &spa, FTAG)) != 0)
|
||||
- return (err);
|
||||
+ if ((err = spa_open(dsname, &spa, FTAG)) != 0)
|
||||
+ return (err);
|
||||
|
||||
- if (!spa_feature_is_enabled(spa, feature)) {
|
||||
+ if (!spa_feature_is_enabled(spa, feature)) {
|
||||
+ spa_close(spa, FTAG);
|
||||
+ return (SET_ERROR(ENOTSUP));
|
||||
+ }
|
||||
spa_close(spa, FTAG);
|
||||
- return (SET_ERROR(ENOTSUP));
|
||||
}
|
||||
- spa_close(spa, FTAG);
|
||||
break;
|
||||
}
|
||||
|
||||
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/receive-o-x_props_override.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/receive-o-x_props_override.ksh
|
||||
index 4e3a5393..583d8eb1 100755
|
||||
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_receive/receive-o-x_props_override.ksh
|
||||
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_receive/receive-o-x_props_override.ksh
|
||||
@@ -221,15 +221,17 @@ log_must eval "zfs set '$userprop:snap'='$userval' $origsub@snap3"
|
||||
log_must eval "zfs send -R -I $orig@snap1 $orig@snap3 > $streamfile_incr"
|
||||
# Sets various combination of override and exclude options
|
||||
log_must eval "zfs recv -F -o atime=off -o '$userprop:dest2'='$userval' "\
|
||||
- "-o quota=123456789 -x compression -x '$userprop:orig' " \
|
||||
- "-x '$userprop:snap3' $dest < $streamfile_incr"
|
||||
+ "-o quota=123456789 -o checksum=sha512 -x compression "\
|
||||
+ "-x '$userprop:orig' -x '$userprop:snap3' $dest < $streamfile_incr"
|
||||
# Verify we can correctly override and exclude properties
|
||||
log_must eval "check_prop_source $dest copies 2 received"
|
||||
log_must eval "check_prop_source $dest atime off local"
|
||||
log_must eval "check_prop_source $dest '$userprop:dest2' '$userval' local"
|
||||
log_must eval "check_prop_source $dest quota 123456789 local"
|
||||
+log_must eval "check_prop_source $dest checksum sha512 local"
|
||||
log_must eval "check_prop_inherit $destsub copies $dest"
|
||||
log_must eval "check_prop_inherit $destsub atime $dest"
|
||||
+log_must eval "check_prop_inherit $destsub checksum $dest"
|
||||
log_must eval "check_prop_inherit $destsub '$userprop:dest2' $dest"
|
||||
log_must eval "check_prop_source $destsub quota 0 default"
|
||||
log_must eval "check_prop_source $destsub compression off default"
|
||||
@@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: LOLi <loli10K@users.noreply.github.com>
|
||||
Date: Sat, 18 Aug 2018 22:10:36 +0200
|
||||
Subject: [PATCH] Fix arcstat.py handling of unsupported options
|
||||
|
||||
This change allows the arcstat.py script to handle unsupported options
|
||||
gracefully and print both error and usage messages when one such option
|
||||
is provided.
|
||||
|
||||
Reviewed-by: Giuseppe Di Natale <guss80@gmail.com>
|
||||
Reviewed-by: George Melikov <mail@gmelikov.ru>
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
|
||||
Closes #7799
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
cmd/arcstat/arcstat.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmd/arcstat/arcstat.py b/cmd/arcstat/arcstat.py
|
||||
index 85c83ccc..b52a8c29 100755
|
||||
--- a/cmd/arcstat/arcstat.py
|
||||
+++ b/cmd/arcstat/arcstat.py
|
||||
@@ -285,7 +285,7 @@ def init():
|
||||
]
|
||||
)
|
||||
except getopt.error as msg:
|
||||
- sys.stderr.write(msg)
|
||||
+ sys.stderr.write("Error: %s\n" % str(msg))
|
||||
usage()
|
||||
opts = None
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DeHackEd <DeHackEd@users.noreply.github.com>
|
||||
Date: Mon, 20 Aug 2018 12:55:18 -0400
|
||||
Subject: [PATCH] Don't modify argv[] in user tools
|
||||
|
||||
argv[] gets modified during string parsing for input arguments. This
|
||||
is reflected in the live process listing. Don't do that.
|
||||
|
||||
Reviewed-by: Serapheim Dimitropoulos <serapheim@delphix.com>
|
||||
Reviewed-by: loli10K <ezomori.nozomu@gmail.com>
|
||||
Reviewed-by: Giuseppe Di Natale <guss80@gmail.com>
|
||||
Reviewed-by: George Melikov <mail@gmelikov.ru>
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Signed-off-by: DHE <git@dehacked.net>
|
||||
Closes #7760
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
cmd/zfs/zfs_main.c | 18 ++++++++++++++++--
|
||||
cmd/zpool/zpool_main.c | 18 ++++++++++++++++--
|
||||
2 files changed, 32 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
|
||||
index f57df858..275d9c89 100644
|
||||
--- a/cmd/zfs/zfs_main.c
|
||||
+++ b/cmd/zfs/zfs_main.c
|
||||
@@ -7041,6 +7041,7 @@ main(int argc, char **argv)
|
||||
int ret = 0;
|
||||
int i = 0;
|
||||
char *cmdname;
|
||||
+ char **newargv;
|
||||
|
||||
(void) setlocale(LC_ALL, "");
|
||||
(void) textdomain(TEXT_DOMAIN);
|
||||
@@ -7096,16 +7097,25 @@ main(int argc, char **argv)
|
||||
libzfs_print_on_error(g_zfs, B_TRUE);
|
||||
|
||||
/*
|
||||
+ * Many commands modify input strings for string parsing reasons.
|
||||
+ * We create a copy to protect the original argv.
|
||||
+ */
|
||||
+ newargv = malloc((argc + 1) * sizeof (newargv[0]));
|
||||
+ for (i = 0; i < argc; i++)
|
||||
+ newargv[i] = strdup(argv[i]);
|
||||
+ newargv[argc] = NULL;
|
||||
+
|
||||
+ /*
|
||||
* Run the appropriate command.
|
||||
*/
|
||||
libzfs_mnttab_cache(g_zfs, B_TRUE);
|
||||
if (find_command_idx(cmdname, &i) == 0) {
|
||||
current_command = &command_table[i];
|
||||
- ret = command_table[i].func(argc - 1, argv + 1);
|
||||
+ ret = command_table[i].func(argc - 1, newargv + 1);
|
||||
} else if (strchr(cmdname, '=') != NULL) {
|
||||
verify(find_command_idx("set", &i) == 0);
|
||||
current_command = &command_table[i];
|
||||
- ret = command_table[i].func(argc, argv);
|
||||
+ ret = command_table[i].func(argc, newargv);
|
||||
} else {
|
||||
(void) fprintf(stderr, gettext("unrecognized "
|
||||
"command '%s'\n"), cmdname);
|
||||
@@ -7113,6 +7123,10 @@ main(int argc, char **argv)
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
+ for (i = 0; i < argc; i++)
|
||||
+ free(newargv[i]);
|
||||
+ free(newargv);
|
||||
+
|
||||
if (ret == 0 && log_history)
|
||||
(void) zpool_log_history(g_zfs, history_str);
|
||||
|
||||
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
|
||||
index 97697011..a4fd0321 100644
|
||||
--- a/cmd/zpool/zpool_main.c
|
||||
+++ b/cmd/zpool/zpool_main.c
|
||||
@@ -7971,6 +7971,7 @@ main(int argc, char **argv)
|
||||
int ret = 0;
|
||||
int i = 0;
|
||||
char *cmdname;
|
||||
+ char **newargv;
|
||||
|
||||
(void) setlocale(LC_ALL, "");
|
||||
(void) textdomain(TEXT_DOMAIN);
|
||||
@@ -8006,15 +8007,24 @@ main(int argc, char **argv)
|
||||
zfs_save_arguments(argc, argv, history_str, sizeof (history_str));
|
||||
|
||||
/*
|
||||
+ * Many commands modify input strings for string parsing reasons.
|
||||
+ * We create a copy to protect the original argv.
|
||||
+ */
|
||||
+ newargv = malloc((argc + 1) * sizeof (newargv[0]));
|
||||
+ for (i = 0; i < argc; i++)
|
||||
+ newargv[i] = strdup(argv[i]);
|
||||
+ newargv[argc] = NULL;
|
||||
+
|
||||
+ /*
|
||||
* Run the appropriate command.
|
||||
*/
|
||||
if (find_command_idx(cmdname, &i) == 0) {
|
||||
current_command = &command_table[i];
|
||||
- ret = command_table[i].func(argc - 1, argv + 1);
|
||||
+ ret = command_table[i].func(argc - 1, newargv + 1);
|
||||
} else if (strchr(cmdname, '=')) {
|
||||
verify(find_command_idx("set", &i) == 0);
|
||||
current_command = &command_table[i];
|
||||
- ret = command_table[i].func(argc, argv);
|
||||
+ ret = command_table[i].func(argc, newargv);
|
||||
} else if (strcmp(cmdname, "freeze") == 0 && argc == 3) {
|
||||
/*
|
||||
* 'freeze' is a vile debugging abomination, so we treat
|
||||
@@ -8031,6 +8041,10 @@ main(int argc, char **argv)
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
+ for (i = 0; i < argc; i++)
|
||||
+ free(newargv[i]);
|
||||
+ free(newargv);
|
||||
+
|
||||
if (ret == 0 && log_history)
|
||||
(void) zpool_log_history(g_zfs, history_str);
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Date: Tue, 31 Jul 2018 10:17:44 -0700
|
||||
Subject: [PATCH] Add missing zfs-dracut RPM dependencies
|
||||
|
||||
The zfs-dracut package requires the hostid, basename, head, awk,
|
||||
and grep utilities be installed. The first three are provided by
|
||||
coreutils but additional dependencies are required for awk and grep.
|
||||
|
||||
Reviewed-by: Manuel Amador (Rudd-O) <rudd-o@rudd-o.com>
|
||||
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Closes #7729
|
||||
Closes #7747
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
rpm/generic/zfs.spec.in | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in
|
||||
index 5b89db02..398221c6 100644
|
||||
--- a/rpm/generic/zfs.spec.in
|
||||
+++ b/rpm/generic/zfs.spec.in
|
||||
@@ -196,7 +196,7 @@ Requires: acl
|
||||
Requires: sudo
|
||||
Requires: sysstat
|
||||
Requires: rng-tools
|
||||
-Requires: libaio
|
||||
+Requires: libaio
|
||||
AutoReqProv: no
|
||||
|
||||
%description test
|
||||
@@ -208,6 +208,8 @@ Summary: Dracut module
|
||||
Group: System Environment/Kernel
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
Requires: dracut
|
||||
+Requires: /usr/bin/awk
|
||||
+Requires: grep
|
||||
|
||||
%description dracut
|
||||
This package contains a dracut module used to construct an initramfs
|
||||
@@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Date: Thu, 23 Aug 2018 09:34:34 -0700
|
||||
Subject: [PATCH] Add libaio-devel BuildRequires
|
||||
|
||||
The zfs-test package needs a build requirement on the libaio-devel
|
||||
package. Without it ./configure will correctly determine that
|
||||
mmap_libaio cannot be built and it will be skipped.
|
||||
|
||||
Reviewed-by: George Melikov <mail@gmelikov.ru>
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Closes #7821
|
||||
Closes #7824
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
rpm/generic/zfs.spec.in | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in
|
||||
index 398221c6..16c5780b 100644
|
||||
--- a/rpm/generic/zfs.spec.in
|
||||
+++ b/rpm/generic/zfs.spec.in
|
||||
@@ -197,6 +197,7 @@ Requires: sudo
|
||||
Requires: sysstat
|
||||
Requires: rng-tools
|
||||
Requires: libaio
|
||||
+BuildRequires: libaio-devel
|
||||
AutoReqProv: no
|
||||
|
||||
%description test
|
||||
@@ -0,0 +1,36 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: LOLi <loli10K@users.noreply.github.com>
|
||||
Date: Sun, 26 Aug 2018 21:43:27 +0200
|
||||
Subject: [PATCH] Fix libaio-devel requirement for Debian-based distributions
|
||||
|
||||
BuildRequires tags for "-devel" packages in the RPM spec file do not
|
||||
work when building on Debian-based distributions.
|
||||
|
||||
Fix this issue by making this requirement conditional to RPM-based
|
||||
distributions.
|
||||
|
||||
Reviewed-by: George Melikov <mail@gmelikov.ru>
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
|
||||
Closes #7829
|
||||
Closes #7831
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
rpm/generic/zfs.spec.in | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in
|
||||
index 16c5780b..22565725 100644
|
||||
--- a/rpm/generic/zfs.spec.in
|
||||
+++ b/rpm/generic/zfs.spec.in
|
||||
@@ -197,7 +197,9 @@ Requires: sudo
|
||||
Requires: sysstat
|
||||
Requires: rng-tools
|
||||
Requires: libaio
|
||||
+%if 0%{?rhel}%{?fedora}%{?suse_version}
|
||||
BuildRequires: libaio-devel
|
||||
+%endif
|
||||
AutoReqProv: no
|
||||
|
||||
%description test
|
||||
@@ -0,0 +1,61 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Joao Carlos Mendes Luis <dioni21@users.noreply.github.com>
|
||||
Date: Sun, 26 Aug 2018 16:55:44 -0300
|
||||
Subject: [PATCH] Fedora 28: Fix misc bounds check compiler warnings
|
||||
|
||||
Fix a bunch of truncation compiler warnings that show up
|
||||
on Fedora 28 (GCC 8.0.1).
|
||||
|
||||
Reviewed-by: Giuseppe Di Natale <guss80@gmail.com>
|
||||
Reviewed-by: George Melikov <mail@gmelikov.ru>
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Issue #7368
|
||||
Closes #7826
|
||||
Closes #7830
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
lib/libshare/smb.c | 2 +-
|
||||
module/icp/core/kcf_mech_tabs.c | 2 +-
|
||||
tests/zfs-tests/tests/functional/ctime/ctime.c | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/libshare/smb.c b/lib/libshare/smb.c
|
||||
index 76145bd9..91d4decb 100644
|
||||
--- a/lib/libshare/smb.c
|
||||
+++ b/lib/libshare/smb.c
|
||||
@@ -218,7 +218,7 @@ smb_enable_share_one(const char *sharename, const char *sharepath)
|
||||
int rc;
|
||||
|
||||
/* Support ZFS share name regexp '[[:alnum:]_-.: ]' */
|
||||
- strncpy(name, sharename, sizeof (name));
|
||||
+ strlcpy(name, sharename, sizeof (name));
|
||||
name [sizeof (name)-1] = '\0';
|
||||
|
||||
pos = name;
|
||||
diff --git a/module/icp/core/kcf_mech_tabs.c b/module/icp/core/kcf_mech_tabs.c
|
||||
index 723bfdb6..741dae7a 100644
|
||||
--- a/module/icp/core/kcf_mech_tabs.c
|
||||
+++ b/module/icp/core/kcf_mech_tabs.c
|
||||
@@ -321,7 +321,7 @@ kcf_create_mech_entry(kcf_ops_class_t class, char *mechname)
|
||||
mutex_enter(&(me_tab[i].me_mutex));
|
||||
if (me_tab[i].me_name[0] == 0) {
|
||||
/* Found an empty spot */
|
||||
- (void) strncpy(me_tab[i].me_name, mechname,
|
||||
+ (void) strlcpy(me_tab[i].me_name, mechname,
|
||||
CRYPTO_MAX_MECH_NAME);
|
||||
me_tab[i].me_name[CRYPTO_MAX_MECH_NAME-1] = '\0';
|
||||
me_tab[i].me_mechid = KCF_MECHID(class, i);
|
||||
diff --git a/tests/zfs-tests/tests/functional/ctime/ctime.c b/tests/zfs-tests/tests/functional/ctime/ctime.c
|
||||
index ba8af15f..1cd18323 100644
|
||||
--- a/tests/zfs-tests/tests/functional/ctime/ctime.c
|
||||
+++ b/tests/zfs-tests/tests/functional/ctime/ctime.c
|
||||
@@ -155,7 +155,7 @@ do_link(const char *pfile)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
- strncpy(pfile_copy, pfile, sizeof (pfile_copy));
|
||||
+ strncpy(pfile_copy, pfile, sizeof (pfile_copy)-1);
|
||||
pfile_copy[sizeof (pfile_copy) - 1] = '\0';
|
||||
/*
|
||||
* Figure out source file directory name, and create
|
||||
@@ -0,0 +1,556 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tim Chase <tim@chase2k.com>
|
||||
Date: Mon, 27 Aug 2018 10:28:32 -0400
|
||||
Subject: [PATCH] Fix problems receiving reallocated dnodes
|
||||
|
||||
This is a port of 047116ac - Raw sends must be able to decrease nlevels,
|
||||
to the zfs-0.7-stable branch. It includes the various fixes to the
|
||||
problem of receiving incremental streams which include reallocated dnodes
|
||||
in which the number of dnode slots has changed but excludes the parts
|
||||
which are related to raw streams.
|
||||
|
||||
From 047116ac:
|
||||
|
||||
Currently, when a raw zfs send file includes a
|
||||
DRR_OBJECT record that would decrease the number of
|
||||
levels of an existing object, the object is reallocated
|
||||
with dmu_object_reclaim() which creates the new dnode
|
||||
using the old object's nlevels. For non-raw sends this
|
||||
doesn't really matter, but raw sends require that
|
||||
nlevels on the receive side match that of the send
|
||||
side so that the checksum-of-MAC tree can be properly
|
||||
maintained. This patch corrects the issue by freeing
|
||||
the object completely before allocating it again in
|
||||
this case.
|
||||
|
||||
This patch also corrects several issues with
|
||||
dnode_hold_impl() and related functions that prevented
|
||||
dnodes (particularly multi-slot dnodes) from being
|
||||
reallocated properly due to the fact that existing
|
||||
dnodes were not being fully cleaned up when they
|
||||
were freed.
|
||||
|
||||
This patch adds a test to make sure that zfs recv
|
||||
functions properly with incremental streams containing
|
||||
dnodes of different sizes.
|
||||
|
||||
This also includes a one-liner fix from loli10K to fix a test failure:
|
||||
https://github.com/zfsonlinux/zfs/pull/7792#discussion_r212769264
|
||||
|
||||
Authored-by: Tom Caputi <tcaputi@datto.com>
|
||||
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
|
||||
Reviewed-by: Jorgen Lundman <lundman@lundman.net>
|
||||
Signed-off-by: Tom Caputi <tcaputi@datto.com>
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Signed-off-by: Tim Chase <tim@chase2k.com>
|
||||
Ported-by: Tim Chase <tim@chase2k.com>
|
||||
|
||||
Closes #6821
|
||||
Closes #6864
|
||||
|
||||
NOTE: This is the first of the port of 3 related patches patches to the
|
||||
zfs-0.7-release branch of ZoL. The other two patches should immediately
|
||||
follow this one.
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
cmd/ztest/ztest.c | 25 +++++-
|
||||
include/sys/dnode.h | 6 ++
|
||||
lib/libzfs/libzfs_sendrecv.c | 1 +
|
||||
module/zfs/dmu_object.c | 1 -
|
||||
module/zfs/dmu_send.c | 51 +++++++++--
|
||||
module/zfs/dnode.c | 84 +++++++++++++++++--
|
||||
module/zfs/dnode_sync.c | 2 +
|
||||
tests/runfiles/linux.run | 2 +-
|
||||
tests/zfs-tests/tests/functional/rsend/Makefile.am | 3 +-
|
||||
.../functional/rsend/send_realloc_dnode_size.ksh | 98 ++++++++++++++++++++++
|
||||
10 files changed, 258 insertions(+), 15 deletions(-)
|
||||
create mode 100644 tests/zfs-tests/tests/functional/rsend/send_realloc_dnode_size.ksh
|
||||
|
||||
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
|
||||
index 1a320b03..a410eeef 100644
|
||||
--- a/cmd/ztest/ztest.c
|
||||
+++ b/cmd/ztest/ztest.c
|
||||
@@ -197,7 +197,8 @@ extern uint64_t metaslab_gang_bang;
|
||||
extern uint64_t metaslab_df_alloc_threshold;
|
||||
extern int metaslab_preload_limit;
|
||||
extern boolean_t zfs_compressed_arc_enabled;
|
||||
-extern int zfs_abd_scatter_enabled;
|
||||
+extern int zfs_abd_scatter_enabled;
|
||||
+extern int dmu_object_alloc_chunk_shift;
|
||||
|
||||
static ztest_shared_opts_t *ztest_shared_opts;
|
||||
static ztest_shared_opts_t ztest_opts;
|
||||
@@ -310,6 +311,7 @@ static ztest_shared_callstate_t *ztest_shared_callstate;
|
||||
ztest_func_t ztest_dmu_read_write;
|
||||
ztest_func_t ztest_dmu_write_parallel;
|
||||
ztest_func_t ztest_dmu_object_alloc_free;
|
||||
+ztest_func_t ztest_dmu_object_next_chunk;
|
||||
ztest_func_t ztest_dmu_commit_callbacks;
|
||||
ztest_func_t ztest_zap;
|
||||
ztest_func_t ztest_zap_parallel;
|
||||
@@ -357,6 +359,7 @@ ztest_info_t ztest_info[] = {
|
||||
ZTI_INIT(ztest_dmu_read_write, 1, &zopt_always),
|
||||
ZTI_INIT(ztest_dmu_write_parallel, 10, &zopt_always),
|
||||
ZTI_INIT(ztest_dmu_object_alloc_free, 1, &zopt_always),
|
||||
+ ZTI_INIT(ztest_dmu_object_next_chunk, 1, &zopt_sometimes),
|
||||
ZTI_INIT(ztest_dmu_commit_callbacks, 1, &zopt_always),
|
||||
ZTI_INIT(ztest_zap, 30, &zopt_always),
|
||||
ZTI_INIT(ztest_zap_parallel, 100, &zopt_always),
|
||||
@@ -3927,6 +3930,26 @@ ztest_dmu_object_alloc_free(ztest_ds_t *zd, uint64_t id)
|
||||
umem_free(od, size);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Rewind the global allocator to verify object allocation backfilling.
|
||||
+ */
|
||||
+void
|
||||
+ztest_dmu_object_next_chunk(ztest_ds_t *zd, uint64_t id)
|
||||
+{
|
||||
+ objset_t *os = zd->zd_os;
|
||||
+ int dnodes_per_chunk = 1 << dmu_object_alloc_chunk_shift;
|
||||
+ uint64_t object;
|
||||
+
|
||||
+ /*
|
||||
+ * Rewind the global allocator randomly back to a lower object number
|
||||
+ * to force backfilling and reclamation of recently freed dnodes.
|
||||
+ */
|
||||
+ mutex_enter(&os->os_obj_lock);
|
||||
+ object = ztest_random(os->os_obj_next_chunk);
|
||||
+ os->os_obj_next_chunk = P2ALIGN(object, dnodes_per_chunk);
|
||||
+ mutex_exit(&os->os_obj_lock);
|
||||
+}
|
||||
+
|
||||
#undef OD_ARRAY_SIZE
|
||||
#define OD_ARRAY_SIZE 2
|
||||
|
||||
diff --git a/include/sys/dnode.h b/include/sys/dnode.h
|
||||
index c7efe559..ea7defe1 100644
|
||||
--- a/include/sys/dnode.h
|
||||
+++ b/include/sys/dnode.h
|
||||
@@ -360,6 +360,7 @@ int dnode_next_offset(dnode_t *dn, int flags, uint64_t *off,
|
||||
int minlvl, uint64_t blkfill, uint64_t txg);
|
||||
void dnode_evict_dbufs(dnode_t *dn);
|
||||
void dnode_evict_bonus(dnode_t *dn);
|
||||
+void dnode_free_interior_slots(dnode_t *dn);
|
||||
|
||||
#define DNODE_IS_CACHEABLE(_dn) \
|
||||
((_dn)->dn_objset->os_primary_cache == ZFS_CACHE_ALL || \
|
||||
@@ -454,6 +455,11 @@ typedef struct dnode_stats {
|
||||
*/
|
||||
kstat_named_t dnode_hold_free_txg;
|
||||
/*
|
||||
+ * Number of times dnode_free_interior_slots() needed to retry
|
||||
+ * acquiring a slot zrl lock due to contention.
|
||||
+ */
|
||||
+ kstat_named_t dnode_free_interior_lock_retry;
|
||||
+ /*
|
||||
* Number of new dnodes allocated by dnode_allocate().
|
||||
*/
|
||||
kstat_named_t dnode_allocate;
|
||||
diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c
|
||||
index c5acd21a..cadf16cc 100644
|
||||
--- a/lib/libzfs/libzfs_sendrecv.c
|
||||
+++ b/lib/libzfs/libzfs_sendrecv.c
|
||||
@@ -3577,6 +3577,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
|
||||
}
|
||||
|
||||
newfs = B_TRUE;
|
||||
+ *cp = '/';
|
||||
}
|
||||
|
||||
if (flags->verbose) {
|
||||
diff --git a/module/zfs/dmu_object.c b/module/zfs/dmu_object.c
|
||||
index e7412b75..f53da407 100644
|
||||
--- a/module/zfs/dmu_object.c
|
||||
+++ b/module/zfs/dmu_object.c
|
||||
@@ -275,7 +275,6 @@ dmu_object_reclaim_dnsize(objset_t *os, uint64_t object, dmu_object_type_t ot,
|
||||
return (err);
|
||||
}
|
||||
|
||||
-
|
||||
int
|
||||
dmu_object_free(objset_t *os, uint64_t object, dmu_tx_t *tx)
|
||||
{
|
||||
diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c
|
||||
index cdbc1cd1..148b5ff8 100644
|
||||
--- a/module/zfs/dmu_send.c
|
||||
+++ b/module/zfs/dmu_send.c
|
||||
@@ -2156,10 +2156,8 @@ receive_object(struct receive_writer_arg *rwa, struct drr_object *drro,
|
||||
}
|
||||
|
||||
err = dmu_object_info(rwa->os, drro->drr_object, &doi);
|
||||
-
|
||||
- if (err != 0 && err != ENOENT)
|
||||
+ if (err != 0 && err != ENOENT && err != EEXIST)
|
||||
return (SET_ERROR(EINVAL));
|
||||
- object = err == 0 ? drro->drr_object : DMU_NEW_OBJECT;
|
||||
|
||||
if (drro->drr_object > rwa->max_object)
|
||||
rwa->max_object = drro->drr_object;
|
||||
@@ -2175,13 +2173,56 @@ receive_object(struct receive_writer_arg *rwa, struct drr_object *drro,
|
||||
nblkptr = deduce_nblkptr(drro->drr_bonustype,
|
||||
drro->drr_bonuslen);
|
||||
|
||||
+ object = drro->drr_object;
|
||||
+
|
||||
if (drro->drr_blksz != doi.doi_data_block_size ||
|
||||
- nblkptr < doi.doi_nblkptr) {
|
||||
+ nblkptr < doi.doi_nblkptr ||
|
||||
+ drro->drr_dn_slots != doi.doi_dnodesize >> DNODE_SHIFT) {
|
||||
err = dmu_free_long_range(rwa->os, drro->drr_object,
|
||||
0, DMU_OBJECT_END);
|
||||
if (err != 0)
|
||||
return (SET_ERROR(EINVAL));
|
||||
}
|
||||
+ } else if (err == EEXIST) {
|
||||
+ /*
|
||||
+ * The object requested is currently an interior slot of a
|
||||
+ * multi-slot dnode. This will be resolved when the next txg
|
||||
+ * is synced out, since the send stream will have told us
|
||||
+ * to free this slot when we freed the associated dnode
|
||||
+ * earlier in the stream.
|
||||
+ */
|
||||
+ txg_wait_synced(dmu_objset_pool(rwa->os), 0);
|
||||
+ object = drro->drr_object;
|
||||
+ } else {
|
||||
+ /* object is free and we are about to allocate a new one */
|
||||
+ object = DMU_NEW_OBJECT;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * If this is a multi-slot dnode there is a chance that this
|
||||
+ * object will expand into a slot that is already used by
|
||||
+ * another object from the previous snapshot. We must free
|
||||
+ * these objects before we attempt to allocate the new dnode.
|
||||
+ */
|
||||
+ if (drro->drr_dn_slots > 1) {
|
||||
+ for (uint64_t slot = drro->drr_object + 1;
|
||||
+ slot < drro->drr_object + drro->drr_dn_slots;
|
||||
+ slot++) {
|
||||
+ dmu_object_info_t slot_doi;
|
||||
+
|
||||
+ err = dmu_object_info(rwa->os, slot, &slot_doi);
|
||||
+ if (err == ENOENT || err == EEXIST)
|
||||
+ continue;
|
||||
+ else if (err != 0)
|
||||
+ return (err);
|
||||
+
|
||||
+ err = dmu_free_long_object(rwa->os, slot);
|
||||
+
|
||||
+ if (err != 0)
|
||||
+ return (err);
|
||||
+ }
|
||||
+
|
||||
+ txg_wait_synced(dmu_objset_pool(rwa->os), 0);
|
||||
}
|
||||
|
||||
tx = dmu_tx_create(rwa->os);
|
||||
@@ -2732,7 +2773,7 @@ receive_read_record(struct receive_arg *ra)
|
||||
* See receive_read_prefetch for an explanation why we're
|
||||
* storing this object in the ignore_obj_list.
|
||||
*/
|
||||
- if (err == ENOENT ||
|
||||
+ if (err == ENOENT || err == EEXIST ||
|
||||
(err == 0 && doi.doi_data_block_size != drro->drr_blksz)) {
|
||||
objlist_insert(&ra->ignore_objlist, drro->drr_object);
|
||||
err = 0;
|
||||
diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c
|
||||
index e05a4d0a..df6a4872 100644
|
||||
--- a/module/zfs/dnode.c
|
||||
+++ b/module/zfs/dnode.c
|
||||
@@ -55,6 +55,7 @@ dnode_stats_t dnode_stats = {
|
||||
{ "dnode_hold_free_overflow", KSTAT_DATA_UINT64 },
|
||||
{ "dnode_hold_free_refcount", KSTAT_DATA_UINT64 },
|
||||
{ "dnode_hold_free_txg", KSTAT_DATA_UINT64 },
|
||||
+ { "dnode_free_interior_lock_retry", KSTAT_DATA_UINT64 },
|
||||
{ "dnode_allocate", KSTAT_DATA_UINT64 },
|
||||
{ "dnode_reallocate", KSTAT_DATA_UINT64 },
|
||||
{ "dnode_buf_evict", KSTAT_DATA_UINT64 },
|
||||
@@ -516,7 +517,8 @@ dnode_destroy(dnode_t *dn)
|
||||
mutex_exit(&os->os_lock);
|
||||
|
||||
/* the dnode can no longer move, so we can release the handle */
|
||||
- zrl_remove(&dn->dn_handle->dnh_zrlock);
|
||||
+ if (!zrl_is_locked(&dn->dn_handle->dnh_zrlock))
|
||||
+ zrl_remove(&dn->dn_handle->dnh_zrlock);
|
||||
|
||||
dn->dn_allocated_txg = 0;
|
||||
dn->dn_free_txg = 0;
|
||||
@@ -662,6 +664,8 @@ dnode_reallocate(dnode_t *dn, dmu_object_type_t ot, int blocksize,
|
||||
DN_BONUS_SIZE(spa_maxdnodesize(dmu_objset_spa(dn->dn_objset))));
|
||||
|
||||
dn_slots = dn_slots > 0 ? dn_slots : DNODE_MIN_SLOTS;
|
||||
+
|
||||
+ dnode_free_interior_slots(dn);
|
||||
DNODE_STAT_BUMP(dnode_reallocate);
|
||||
|
||||
/* clean up any unreferenced dbufs */
|
||||
@@ -1062,19 +1066,73 @@ dnode_set_slots(dnode_children_t *children, int idx, int slots, void *ptr)
|
||||
}
|
||||
|
||||
static boolean_t
|
||||
-dnode_check_slots(dnode_children_t *children, int idx, int slots, void *ptr)
|
||||
+dnode_check_slots_free(dnode_children_t *children, int idx, int slots)
|
||||
{
|
||||
ASSERT3S(idx + slots, <=, DNODES_PER_BLOCK);
|
||||
|
||||
for (int i = idx; i < idx + slots; i++) {
|
||||
dnode_handle_t *dnh = &children->dnc_children[i];
|
||||
- if (dnh->dnh_dnode != ptr)
|
||||
+ dnode_t *dn = dnh->dnh_dnode;
|
||||
+
|
||||
+ if (dn == DN_SLOT_FREE) {
|
||||
+ continue;
|
||||
+ } else if (DN_SLOT_IS_PTR(dn)) {
|
||||
+ mutex_enter(&dn->dn_mtx);
|
||||
+ dmu_object_type_t type = dn->dn_type;
|
||||
+ mutex_exit(&dn->dn_mtx);
|
||||
+
|
||||
+ if (type != DMU_OT_NONE)
|
||||
+ return (B_FALSE);
|
||||
+
|
||||
+ continue;
|
||||
+ } else {
|
||||
return (B_FALSE);
|
||||
+ }
|
||||
+
|
||||
+ return (B_FALSE);
|
||||
}
|
||||
|
||||
return (B_TRUE);
|
||||
}
|
||||
|
||||
+static void
|
||||
+dnode_reclaim_slots(dnode_children_t *children, int idx, int slots)
|
||||
+{
|
||||
+ ASSERT3S(idx + slots, <=, DNODES_PER_BLOCK);
|
||||
+
|
||||
+ for (int i = idx; i < idx + slots; i++) {
|
||||
+ dnode_handle_t *dnh = &children->dnc_children[i];
|
||||
+
|
||||
+ ASSERT(zrl_is_locked(&dnh->dnh_zrlock));
|
||||
+
|
||||
+ if (DN_SLOT_IS_PTR(dnh->dnh_dnode)) {
|
||||
+ ASSERT3S(dnh->dnh_dnode->dn_type, ==, DMU_OT_NONE);
|
||||
+ dnode_destroy(dnh->dnh_dnode);
|
||||
+ dnh->dnh_dnode = DN_SLOT_FREE;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+dnode_free_interior_slots(dnode_t *dn)
|
||||
+{
|
||||
+ dnode_children_t *children = dmu_buf_get_user(&dn->dn_dbuf->db);
|
||||
+ int epb = dn->dn_dbuf->db.db_size >> DNODE_SHIFT;
|
||||
+ int idx = (dn->dn_object & (epb - 1)) + 1;
|
||||
+ int slots = dn->dn_num_slots - 1;
|
||||
+
|
||||
+ if (slots == 0)
|
||||
+ return;
|
||||
+
|
||||
+ ASSERT3S(idx + slots, <=, DNODES_PER_BLOCK);
|
||||
+
|
||||
+ while (!dnode_slots_tryenter(children, idx, slots))
|
||||
+ DNODE_STAT_BUMP(dnode_free_interior_lock_retry);
|
||||
+
|
||||
+ dnode_set_slots(children, idx, slots, DN_SLOT_FREE);
|
||||
+ dnode_slots_rele(children, idx, slots);
|
||||
+}
|
||||
+
|
||||
void
|
||||
dnode_special_close(dnode_handle_t *dnh)
|
||||
{
|
||||
@@ -1355,7 +1413,7 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag, int slots,
|
||||
while (dn == DN_SLOT_UNINIT) {
|
||||
dnode_slots_hold(dnc, idx, slots);
|
||||
|
||||
- if (!dnode_check_slots(dnc, idx, slots, DN_SLOT_FREE)) {
|
||||
+ if (!dnode_check_slots_free(dnc, idx, slots)) {
|
||||
DNODE_STAT_BUMP(dnode_hold_free_misses);
|
||||
dnode_slots_rele(dnc, idx, slots);
|
||||
dbuf_rele(db, FTAG);
|
||||
@@ -1368,15 +1426,29 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag, int slots,
|
||||
continue;
|
||||
}
|
||||
|
||||
- if (!dnode_check_slots(dnc, idx, slots, DN_SLOT_FREE)) {
|
||||
+ if (!dnode_check_slots_free(dnc, idx, slots)) {
|
||||
DNODE_STAT_BUMP(dnode_hold_free_lock_misses);
|
||||
dnode_slots_rele(dnc, idx, slots);
|
||||
dbuf_rele(db, FTAG);
|
||||
return (SET_ERROR(ENOSPC));
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * Allocated but otherwise free dnodes which would
|
||||
+ * be in the interior of a multi-slot dnodes need
|
||||
+ * to be freed. Single slot dnodes can be safely
|
||||
+ * re-purposed as a performance optimization.
|
||||
+ */
|
||||
+ if (slots > 1)
|
||||
+ dnode_reclaim_slots(dnc, idx + 1, slots - 1);
|
||||
+
|
||||
dnh = &dnc->dnc_children[idx];
|
||||
- dn = dnode_create(os, dn_block + idx, db, object, dnh);
|
||||
+ if (DN_SLOT_IS_PTR(dnh->dnh_dnode)) {
|
||||
+ dn = dnh->dnh_dnode;
|
||||
+ } else {
|
||||
+ dn = dnode_create(os, dn_block + idx, db,
|
||||
+ object, dnh);
|
||||
+ }
|
||||
}
|
||||
|
||||
mutex_enter(&dn->dn_mtx);
|
||||
diff --git a/module/zfs/dnode_sync.c b/module/zfs/dnode_sync.c
|
||||
index 742d962b..8d65e385 100644
|
||||
--- a/module/zfs/dnode_sync.c
|
||||
+++ b/module/zfs/dnode_sync.c
|
||||
@@ -533,6 +533,7 @@ dnode_sync_free(dnode_t *dn, dmu_tx_t *tx)
|
||||
if (dn->dn_allocated_txg != dn->dn_free_txg)
|
||||
dmu_buf_will_dirty(&dn->dn_dbuf->db, tx);
|
||||
bzero(dn->dn_phys, sizeof (dnode_phys_t) * dn->dn_num_slots);
|
||||
+ dnode_free_interior_slots(dn);
|
||||
|
||||
mutex_enter(&dn->dn_mtx);
|
||||
dn->dn_type = DMU_OT_NONE;
|
||||
@@ -540,6 +541,7 @@ dnode_sync_free(dnode_t *dn, dmu_tx_t *tx)
|
||||
dn->dn_allocated_txg = 0;
|
||||
dn->dn_free_txg = 0;
|
||||
dn->dn_have_spill = B_FALSE;
|
||||
+ dn->dn_num_slots = 1;
|
||||
mutex_exit(&dn->dn_mtx);
|
||||
|
||||
ASSERT(dn->dn_object != DMU_META_DNODE_OBJECT);
|
||||
diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run
|
||||
index 69e9eb26..d8fe6f3a 100644
|
||||
--- a/tests/runfiles/linux.run
|
||||
+++ b/tests/runfiles/linux.run
|
||||
@@ -605,7 +605,7 @@ tests = ['rsend_001_pos', 'rsend_002_pos', 'rsend_003_pos', 'rsend_004_pos',
|
||||
'send-c_lz4_disabled', 'send-c_recv_lz4_disabled',
|
||||
'send-c_mixed_compression', 'send-c_stream_size_estimate', 'send-cD',
|
||||
'send-c_embedded_blocks', 'send-c_resume', 'send-cpL_varied_recsize',
|
||||
- 'send-c_recv_dedup', 'send_freeobjects']
|
||||
+ 'send-c_recv_dedup', 'send_freeobjects', 'send_realloc_dnode_size']
|
||||
tags = ['functional', 'rsend']
|
||||
|
||||
[tests/functional/scrub_mirror]
|
||||
diff --git a/tests/zfs-tests/tests/functional/rsend/Makefile.am b/tests/zfs-tests/tests/functional/rsend/Makefile.am
|
||||
index 6b1aa8b3..a2837d1a 100644
|
||||
--- a/tests/zfs-tests/tests/functional/rsend/Makefile.am
|
||||
+++ b/tests/zfs-tests/tests/functional/rsend/Makefile.am
|
||||
@@ -36,7 +36,8 @@ dist_pkgdata_SCRIPTS = \
|
||||
send-c_volume.ksh \
|
||||
send-c_zstreamdump.ksh \
|
||||
send-cpL_varied_recsize.ksh \
|
||||
- send_freeobjects.ksh
|
||||
+ send_freeobjects.ksh \
|
||||
+ send_realloc_dnode_size.ksh
|
||||
|
||||
dist_pkgdata_DATA = \
|
||||
rsend.cfg \
|
||||
diff --git a/tests/zfs-tests/tests/functional/rsend/send_realloc_dnode_size.ksh b/tests/zfs-tests/tests/functional/rsend/send_realloc_dnode_size.ksh
|
||||
new file mode 100644
|
||||
index 00000000..20676394
|
||||
--- /dev/null
|
||||
+++ b/tests/zfs-tests/tests/functional/rsend/send_realloc_dnode_size.ksh
|
||||
@@ -0,0 +1,98 @@
|
||||
+#!/bin/ksh
|
||||
+
|
||||
+#
|
||||
+# This file and its contents are supplied under the terms of the
|
||||
+# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
+# You may only use this file in accordance with the terms of version
|
||||
+# 1.0 of the CDDL.
|
||||
+#
|
||||
+# A full copy of the text of the CDDL should have accompanied this
|
||||
+# source. A copy of the CDDL is also available via the Internet at
|
||||
+# http://www.illumos.org/license/CDDL.
|
||||
+#
|
||||
+
|
||||
+#
|
||||
+# Copyright (c) 2017 by Lawrence Livermore National Security, LLC.
|
||||
+#
|
||||
+
|
||||
+. $STF_SUITE/include/libtest.shlib
|
||||
+. $STF_SUITE/tests/functional/rsend/rsend.kshlib
|
||||
+
|
||||
+#
|
||||
+# Description:
|
||||
+# Verify incremental receive properly handles objects with changed
|
||||
+# dnode slot count.
|
||||
+#
|
||||
+# Strategy:
|
||||
+# 1. Populate a dataset with 1k byte dnodes and snapshot
|
||||
+# 2. Remove objects, set dnodesize=legacy, and remount dataset so new objects
|
||||
+# get recycled numbers and formerly "interior" dnode slots get assigned
|
||||
+# to new objects
|
||||
+# 3. Remove objects, set dnodesize=2k, and remount dataset so new objects
|
||||
+# overlap with recently recycled and formerly "normal" dnode slots get
|
||||
+# assigned to new objects
|
||||
+# 4. Generate initial and incremental streams
|
||||
+# 5. Verify initial and incremental streams can be received
|
||||
+#
|
||||
+
|
||||
+verify_runnable "both"
|
||||
+
|
||||
+log_assert "Verify incremental receive handles objects with changed dnode size"
|
||||
+
|
||||
+function cleanup
|
||||
+{
|
||||
+ rm -f $BACKDIR/fs-dn-legacy
|
||||
+ rm -f $BACKDIR/fs-dn-1k
|
||||
+ rm -f $BACKDIR/fs-dn-2k
|
||||
+
|
||||
+ if datasetexists $POOL/fs ; then
|
||||
+ log_must zfs destroy -rR $POOL/fs
|
||||
+ fi
|
||||
+
|
||||
+ if datasetexists $POOL/newfs ; then
|
||||
+ log_must zfs destroy -rR $POOL/newfs
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+log_onexit cleanup
|
||||
+
|
||||
+# 1. Populate a dataset with 1k byte dnodes and snapshot
|
||||
+log_must zfs create -o dnodesize=1k $POOL/fs
|
||||
+log_must mk_files 200 262144 0 $POOL/fs
|
||||
+log_must zfs snapshot $POOL/fs@a
|
||||
+
|
||||
+# 2. Remove objects, set dnodesize=legacy, and remount dataset so new objects
|
||||
+# get recycled numbers and formerly "interior" dnode slots get assigned
|
||||
+# to new objects
|
||||
+rm /$POOL/fs/*
|
||||
+
|
||||
+log_must zfs unmount $POOL/fs
|
||||
+log_must zfs set dnodesize=legacy $POOL/fs
|
||||
+log_must zfs mount $POOL/fs
|
||||
+
|
||||
+log_must mk_files 200 262144 0 $POOL/fs
|
||||
+log_must zfs snapshot $POOL/fs@b
|
||||
+
|
||||
+# 3. Remove objects, set dnodesize=2k, and remount dataset so new objects
|
||||
+# overlap with recently recycled and formerly "normal" dnode slots get
|
||||
+# assigned to new objects
|
||||
+rm /$POOL/fs/*
|
||||
+
|
||||
+log_must zfs unmount $POOL/fs
|
||||
+log_must zfs set dnodesize=2k $POOL/fs
|
||||
+log_must zfs mount $POOL/fs
|
||||
+
|
||||
+mk_files 200 262144 0 $POOL/fs
|
||||
+log_must zfs snapshot $POOL/fs@c
|
||||
+
|
||||
+# 4. Generate initial and incremental streams
|
||||
+log_must eval "zfs send $POOL/fs@a > $BACKDIR/fs-dn-1k"
|
||||
+log_must eval "zfs send -i $POOL/fs@a $POOL/fs@b > $BACKDIR/fs-dn-legacy"
|
||||
+log_must eval "zfs send -i $POOL/fs@b $POOL/fs@c > $BACKDIR/fs-dn-2k"
|
||||
+
|
||||
+# 5. Verify initial and incremental streams can be received
|
||||
+log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs-dn-1k"
|
||||
+log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs-dn-legacy"
|
||||
+log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs-dn-2k"
|
||||
+
|
||||
+log_pass "Verify incremental receive handles objects with changed dnode size"
|
||||
@@ -0,0 +1,134 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Caputi <tcaputi@datto.com>
|
||||
Date: Tue, 17 Apr 2018 14:13:57 -0400
|
||||
Subject: [PATCH] Fix object reclaim when using large dnodes
|
||||
|
||||
Currently, when the receive_object() code wants to reclaim an
|
||||
object, it always assumes that the dnode is the legacy 512 bytes,
|
||||
even when the incoming bonus buffer exceeds this length. This
|
||||
causes a buffer overflow if --enable-debug is not provided and
|
||||
triggers an ASSERT if it is. This patch resolves this issue and
|
||||
adds an ASSERT to ensure this can't happen again.
|
||||
|
||||
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Signed-off-by: Tom Caputi <tcaputi@datto.com>
|
||||
Closes #7097
|
||||
Closes #7433
|
||||
|
||||
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
||||
---
|
||||
module/zfs/dmu_object.c | 2 +-
|
||||
module/zfs/dmu_send.c | 5 +++--
|
||||
module/zfs/dnode.c | 3 +--
|
||||
.../functional/rsend/send_realloc_dnode_size.ksh | 21 +++++++++++++++++----
|
||||
4 files changed, 22 insertions(+), 9 deletions(-)
|
||||
mode change 100644 => 100755 tests/zfs-tests/tests/functional/rsend/send_realloc_dnode_size.ksh
|
||||
|
||||
diff --git a/module/zfs/dmu_object.c b/module/zfs/dmu_object.c
|
||||
index f53da407..1fc71d10 100644
|
||||
--- a/module/zfs/dmu_object.c
|
||||
+++ b/module/zfs/dmu_object.c
|
||||
@@ -249,7 +249,7 @@ dmu_object_reclaim(objset_t *os, uint64_t object, dmu_object_type_t ot,
|
||||
int blocksize, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx)
|
||||
{
|
||||
return (dmu_object_reclaim_dnsize(os, object, ot, blocksize, bonustype,
|
||||
- bonuslen, 0, tx));
|
||||
+ bonuslen, DNODE_MIN_SIZE, tx));
|
||||
}
|
||||
|
||||
int
|
||||
diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c
|
||||
index 148b5ff8..1de0f316 100644
|
||||
--- a/module/zfs/dmu_send.c
|
||||
+++ b/module/zfs/dmu_send.c
|
||||
@@ -2244,9 +2244,10 @@ receive_object(struct receive_writer_arg *rwa, struct drr_object *drro,
|
||||
drro->drr_bonustype != doi.doi_bonus_type ||
|
||||
drro->drr_bonuslen != doi.doi_bonus_size) {
|
||||
/* currently allocated, but with different properties */
|
||||
- err = dmu_object_reclaim(rwa->os, drro->drr_object,
|
||||
+ err = dmu_object_reclaim_dnsize(rwa->os, drro->drr_object,
|
||||
drro->drr_type, drro->drr_blksz,
|
||||
- drro->drr_bonustype, drro->drr_bonuslen, tx);
|
||||
+ drro->drr_bonustype, drro->drr_bonuslen,
|
||||
+ drro->drr_dn_slots << DNODE_SHIFT, tx);
|
||||
}
|
||||
if (err != 0) {
|
||||
dmu_tx_commit(tx);
|
||||
diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c
|
||||
index df6a4872..d465b545 100644
|
||||
--- a/module/zfs/dnode.c
|
||||
+++ b/module/zfs/dnode.c
|
||||
@@ -662,8 +662,7 @@ dnode_reallocate(dnode_t *dn, dmu_object_type_t ot, int blocksize,
|
||||
ASSERT(DMU_OT_IS_VALID(bonustype));
|
||||
ASSERT3U(bonuslen, <=,
|
||||
DN_BONUS_SIZE(spa_maxdnodesize(dmu_objset_spa(dn->dn_objset))));
|
||||
-
|
||||
- dn_slots = dn_slots > 0 ? dn_slots : DNODE_MIN_SLOTS;
|
||||
+ ASSERT3U(bonuslen, <=, DN_BONUS_SIZE(dn_slots << DNODE_SHIFT));
|
||||
|
||||
dnode_free_interior_slots(dn);
|
||||
DNODE_STAT_BUMP(dnode_reallocate);
|
||||
diff --git a/tests/zfs-tests/tests/functional/rsend/send_realloc_dnode_size.ksh b/tests/zfs-tests/tests/functional/rsend/send_realloc_dnode_size.ksh
|
||||
old mode 100644
|
||||
new mode 100755
|
||||
index 20676394..12a72fa0
|
||||
--- a/tests/zfs-tests/tests/functional/rsend/send_realloc_dnode_size.ksh
|
||||
+++ b/tests/zfs-tests/tests/functional/rsend/send_realloc_dnode_size.ksh
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#
|
||||
# Copyright (c) 2017 by Lawrence Livermore National Security, LLC.
|
||||
+# Copyright (c) 2018 Datto Inc.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
@@ -31,8 +32,10 @@
|
||||
# 3. Remove objects, set dnodesize=2k, and remount dataset so new objects
|
||||
# overlap with recently recycled and formerly "normal" dnode slots get
|
||||
# assigned to new objects
|
||||
-# 4. Generate initial and incremental streams
|
||||
-# 5. Verify initial and incremental streams can be received
|
||||
+# 4. Create an empty file and add xattrs to it to exercise reclaiming a
|
||||
+# dnode that requires more than 1 slot for its bonus buffer (Zol #7433)
|
||||
+# 5. Generate initial and incremental streams
|
||||
+# 6. Verify initial and incremental streams can be received
|
||||
#
|
||||
|
||||
verify_runnable "both"
|
||||
@@ -44,6 +47,7 @@ function cleanup
|
||||
rm -f $BACKDIR/fs-dn-legacy
|
||||
rm -f $BACKDIR/fs-dn-1k
|
||||
rm -f $BACKDIR/fs-dn-2k
|
||||
+ rm -f $BACKDIR/fs-attr
|
||||
|
||||
if datasetexists $POOL/fs ; then
|
||||
log_must zfs destroy -rR $POOL/fs
|
||||
@@ -82,17 +86,26 @@ log_must zfs unmount $POOL/fs
|
||||
log_must zfs set dnodesize=2k $POOL/fs
|
||||
log_must zfs mount $POOL/fs
|
||||
|
||||
+log_must touch /$POOL/fs/attrs
|
||||
mk_files 200 262144 0 $POOL/fs
|
||||
log_must zfs snapshot $POOL/fs@c
|
||||
|
||||
-# 4. Generate initial and incremental streams
|
||||
+# 4. Create an empty file and add xattrs to it to exercise reclaiming a
|
||||
+# dnode that requires more than 1 slot for its bonus buffer (Zol #7433)
|
||||
+log_must zfs set compression=on xattr=sa $POOL/fs
|
||||
+log_must eval "python -c 'print \"a\" * 512' | attr -s bigval /$POOL/fs/attrs"
|
||||
+log_must zfs snapshot $POOL/fs@d
|
||||
+
|
||||
+# 5. Generate initial and incremental streams
|
||||
log_must eval "zfs send $POOL/fs@a > $BACKDIR/fs-dn-1k"
|
||||
log_must eval "zfs send -i $POOL/fs@a $POOL/fs@b > $BACKDIR/fs-dn-legacy"
|
||||
log_must eval "zfs send -i $POOL/fs@b $POOL/fs@c > $BACKDIR/fs-dn-2k"
|
||||
+log_must eval "zfs send -i $POOL/fs@c $POOL/fs@d > $BACKDIR/fs-attr"
|
||||
|
||||
-# 5. Verify initial and incremental streams can be received
|
||||
+# 6. Verify initial and incremental streams can be received
|
||||
log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs-dn-1k"
|
||||
log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs-dn-legacy"
|
||||
log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs-dn-2k"
|
||||
+log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs-attr"
|
||||
|
||||
log_pass "Verify incremental receive handles objects with changed dnode size"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user