diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /sys-fs/zfs/files | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sys-fs/zfs/files')
-rw-r--r-- | sys-fs/zfs/files/bash-completion | 232 | ||||
-rw-r--r-- | sys-fs/zfs/files/bash-completion-r1 | 391 | ||||
-rwxr-xr-x | sys-fs/zfs/files/zed | 26 | ||||
-rw-r--r-- | sys-fs/zfs/files/zfs-0.6.0_rc14-fix-libzpool-function-relocations.patch | 34 | ||||
-rw-r--r-- | sys-fs/zfs/files/zfs-0.6.1-avoid-zdb-abort.patch | 30 | ||||
-rw-r--r-- | sys-fs/zfs/files/zfs-0.6.1-fix-gcc-4.8-warning.patch | 42 | ||||
-rw-r--r-- | sys-fs/zfs/files/zfs-0.6.1-fix-zvol-initialization-r1.patch | 167 | ||||
-rw-r--r-- | sys-fs/zfs/files/zfs-0.6.1-gentoo-openrc-dependencies.patch | 57 | ||||
-rw-r--r-- | sys-fs/zfs/files/zfs-init.sh.in | 29 | ||||
-rw-r--r-- | sys-fs/zfs/files/zfs.service.in | 16 |
10 files changed, 1024 insertions, 0 deletions
diff --git a/sys-fs/zfs/files/bash-completion b/sys-fs/zfs/files/bash-completion new file mode 100644 index 000000000000..1b9428bf8602 --- /dev/null +++ b/sys-fs/zfs/files/bash-completion @@ -0,0 +1,232 @@ +# Copyright (c) 2010, 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. + +__zfs_get_commands() +{ + zfs 2>&1 | awk '/^\t[a-z]/ {print $1}' | uniq +} + +__zfs_get_properties() +{ + zfs get 2>&1 | awk '$2 == "YES" || $2 == "NO" {print $1}'; echo all +} + +__zfs_get_editable_properties() +{ + zfs get 2>&1 | awk '$2 == "YES" {printf("%s=\n", $1)}' +} + +__zfs_get_inheritable_properties() +{ + zfs get 2>&1 | awk '$3 == "YES" {print $1}' +} + +__zfs_list_datasets() +{ + zfs list -H -o name +} + +__zfs_list_filesystems() +{ + zfs list -H -o name -t filesystem +} + +__zfs_list_snapshots() +{ + zfs list -H -o name -t snapshot +} + +__zfs_list_volumes() +{ + zfs list -H -o name -t volume +} + +__zfs_argument_chosen() +{ + for word in $(seq $((COMP_CWORD-1)) -1 2) + do + local prev="${COMP_WORDS[$word]}" + for property in $@ + do + if [ "x$prev" = "x$property" ] + then + return 0 + fi + done + 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() +{ + local cur prev cmd cmds + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + cmd="${COMP_WORDS[1]}" + cmds=$(__zfs_get_commands) + + if [ "${prev##*/}" = "zfs" ] + then + COMPREPLY=($(compgen -W "$cmds -?" -- "$cur")) + return 0 + fi + + case "${cmd}" in + clone) + __zfs_complete_ordered_arguments "$(__zfs_list_snapshots)" "$(__zfs_list_filesystems) $(__zfs_list_volumes)" $cur + return 0 + ;; + get) + __zfs_complete_ordered_arguments "$(__zfs_get_properties)" "$(__zfs_list_datasets)" "$cur" "-H -r -p" + return 0 + ;; + inherit) + __zfs_complete_ordered_arguments "$(__zfs_get_inheritable_properties)" "$(__zfs_list_datasets)" $cur + return 0 + ;; + list) + if [ "x$prev" = "x-o" ] + then + COMPREPLY=($(compgen -W "$(__zfs_get_properties)" -- "${cur##*,}")) + local existing_opts=$(expr "$cur" : '\(.*,\)') + if [ ! "x$existing_opts" = "x" ] + then + COMPREPLY=( "${COMPREPLY[@]/#/${existing_opts}}" ) + fi + else + COMPREPLY=($(compgen -W "$(__zfs_list_datasets) -H -r -o" -- "$cur")) + fi + return 0 + ;; + promote) + COMPREPLY=($(compgen -W "$(__zfs_list_filesystems)" -- "$cur")) + return 0 + ;; + rollback|send) + COMPREPLY=($(compgen -W "$(__zfs_list_snapshots)" -- "$cur")) + return 0 + ;; + snapshot) + COMPREPLY=($(compgen -W "$(__zfs_list_filesystems) $(__zfs_list_volumes)" -- "$cur")) + return 0 + ;; + set) + __zfs_complete_ordered_arguments "$(__zfs_get_editable_properties)" "$(__zfs_list_filesystems) $(__zfs_list_volumes)" $cur + return 0 + ;; + *) + COMPREPLY=($(compgen -W "$(__zfs_list_datasets)" -- "$cur")) + return 0 + ;; + esac + +} + +__zpool_get_commands() +{ + zpool 2>&1 | awk '/^\t[a-z]/ {print $1}' | uniq +} + +__zpool_get_properties() +{ + zpool get 2>&1 | awk '$2 == "YES" || $2 == "NO" {print $1}'; echo all +} + +__zpool_get_editable_properties() +{ + zpool get 2>&1 | awk '$2 == "YES" {printf("%s=\n", $1)}' +} + +__zpool_list_pools() +{ + zpool 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]}" + cmds=$(__zpool_get_commands) + + if [ "${prev##*/}" = "zpool" ] + then + 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 [ "x$prev" = "x-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 -o filenames -F __zpool_complete zpool diff --git a/sys-fs/zfs/files/bash-completion-r1 b/sys-fs/zfs/files/bash-completion-r1 new file mode 100644 index 000000000000..b1aded368e85 --- /dev/null +++ b/sys-fs/zfs/files/bash-completion-r1 @@ -0,0 +1,391 @@ +# 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 -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 -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 -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 diff --git a/sys-fs/zfs/files/zed b/sys-fs/zfs/files/zed new file mode 100755 index 000000000000..f963d47070ed --- /dev/null +++ b/sys-fs/zfs/files/zed @@ -0,0 +1,26 @@ +#!/sbin/runscript +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +depend() { + need zfs +} + +start() { + ebegin "Starting ZFS Event daemon" + + checkpath -q -d -m 0755 /var/run/zed + + start-stop-daemon --start -q \ + --exec /sbin/zed -- -M \ + -p /var/run/zed/pid + eend $? + +} + +stop() { +ebegin "Stopping ZFS Event daemon" + start-stop-daemon --stop -q --pidfile /var/run/zed/pid +eend $? +} diff --git a/sys-fs/zfs/files/zfs-0.6.0_rc14-fix-libzpool-function-relocations.patch b/sys-fs/zfs/files/zfs-0.6.0_rc14-fix-libzpool-function-relocations.patch new file mode 100644 index 000000000000..b493424a1e77 --- /dev/null +++ b/sys-fs/zfs/files/zfs-0.6.0_rc14-fix-libzpool-function-relocations.patch @@ -0,0 +1,34 @@ +From 399f60c8b47f7513d078a7c181ff132e2cafdd15 Mon Sep 17 00:00:00 2001 +From: Richard Yao <ryao@cs.stonybrook.edu> +Date: Tue, 5 Feb 2013 18:14:30 -0500 +Subject: [PATCH] Fix function relocations in libzpool + +binutils 2.23.1 fails in situations that generate function relocations +on PowerPC and possibly other architectures. This causes linking of +libzpool to fail because it depends on libnvpair. We add a dependency on +libnvpair to lib/libzpool/Makefile.am to correct that. + +Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu> +Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> +Closes #1267 +--- + lib/libzpool/Makefile.am | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/lib/libzpool/Makefile.am b/lib/libzpool/Makefile.am +index 3e62de6..cbba388 100644 +--- a/lib/libzpool/Makefile.am ++++ b/lib/libzpool/Makefile.am +@@ -94,7 +94,8 @@ libzpool_la_SOURCES = \ + + libzpool_la_LIBADD = \ + $(top_builddir)/lib/libunicode/libunicode.la \ +- $(top_builddir)/lib/libuutil/libuutil.la ++ $(top_builddir)/lib/libuutil/libuutil.la \ ++ $(top_builddir)/lib/libnvpair/libnvpair.la + + libzpool_la_LDFLAGS = -pthread -version-info 1:1:0 + +-- +1.7.10 + diff --git a/sys-fs/zfs/files/zfs-0.6.1-avoid-zdb-abort.patch b/sys-fs/zfs/files/zfs-0.6.1-avoid-zdb-abort.patch new file mode 100644 index 000000000000..f73840feeed6 --- /dev/null +++ b/sys-fs/zfs/files/zfs-0.6.1-avoid-zdb-abort.patch @@ -0,0 +1,30 @@ +From 5d3dc3fb72518a4c191e3a014622b74365eb3a74 Mon Sep 17 00:00:00 2001 +From: Mike Leddy <mike.leddy@gmail.com> +Date: Thu, 4 Jul 2013 01:02:05 -0300 +Subject: [PATCH] Avoid abort() in vn_rdwr(): libzpool/kernel.c + +Make sure that buffer is aligned to 512 bytes on linux so that +pread call combined with O_DIRECT does not return EINVAL. + +Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> +Closes #1570 +--- + cmd/zdb/zdb.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c +index 936974b..a2b6bfe 100644 +--- a/cmd/zdb/zdb.c ++++ b/cmd/zdb/zdb.c +@@ -2844,7 +2844,7 @@ + psize = size; + lsize = size; + +- pbuf = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL); ++ pbuf = umem_alloc_aligned(SPA_MAXBLOCKSIZE, 512, UMEM_NOFAIL); + lbuf = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL); + + BP_ZERO(bp); +-- +1.8.1.6 + diff --git a/sys-fs/zfs/files/zfs-0.6.1-fix-gcc-4.8-warning.patch b/sys-fs/zfs/files/zfs-0.6.1-fix-gcc-4.8-warning.patch new file mode 100644 index 000000000000..00ec1057efa1 --- /dev/null +++ b/sys-fs/zfs/files/zfs-0.6.1-fix-gcc-4.8-warning.patch @@ -0,0 +1,42 @@ +From 3db3ff4a787acf068b122562fb5be5aecec2611f Mon Sep 17 00:00:00 2001 +From: Richard Yao <ryao@gentoo.org> +Date: Tue, 2 Jul 2013 00:07:15 -0400 +Subject: [PATCH] Use MAXPATHLEN instead of sizeof in snprintf +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This silences a GCC 4.8.0 warning by fixing a programming error +caught by static analysis: + +../../cmd/ztest/ztest.c: In function ‘ztest_vdev_aux_add_remove’: +../../cmd/ztest/ztest.c:2584:33: error: argument to ‘sizeof’ + in ‘snprintf’ call is the same expression as the destination; + did you mean to provide an explicit length? + [-Werror=sizeof-pointer-memaccess] + (void) snprintf(path, sizeof (path), ztest_aux_template, + ^ + +Signed-off-by: Richard Yao <ryao@gentoo.org> +Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> +Closes #1480 +--- + cmd/ztest/ztest.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c +index b38d7b1..93a5f1e 100644 +--- a/cmd/ztest/ztest.c ++++ b/cmd/ztest/ztest.c +@@ -2581,7 +2581,7 @@ enum ztest_object { + zs->zs_vdev_aux = 0; + for (;;) { + int c; +- (void) snprintf(path, sizeof (path), ztest_aux_template, ++ (void) snprintf(path, MAXPATHLEN, ztest_aux_template, + ztest_opts.zo_dir, ztest_opts.zo_pool, aux, + zs->zs_vdev_aux); + for (c = 0; c < sav->sav_count; c++) +-- +1.8.1.6 + diff --git a/sys-fs/zfs/files/zfs-0.6.1-fix-zvol-initialization-r1.patch b/sys-fs/zfs/files/zfs-0.6.1-fix-zvol-initialization-r1.patch new file mode 100644 index 000000000000..b1e7d3736db0 --- /dev/null +++ b/sys-fs/zfs/files/zfs-0.6.1-fix-zvol-initialization-r1.patch @@ -0,0 +1,167 @@ +diff --git a/module/zfs/spa.c b/module/zfs/spa.c +index e986e92..65f78b7 100644 +--- a/module/zfs/spa.c ++++ b/module/zfs/spa.c +@@ -64,6 +64,7 @@ + #include <sys/zfs_ioctl.h> + #include <sys/dsl_scan.h> + #include <sys/zfeature.h> ++#include <sys/zvol.h> + + #ifdef _KERNEL + #include <sys/bootprops.h> +@@ -2856,6 +2857,7 @@ spa_open_common(const char *pool, spa_t **spapp, void *tag, nvlist_t *nvpolicy, + spa_load_state_t state = SPA_LOAD_OPEN; + int error; + int locked = B_FALSE; ++ int firstopen = B_FALSE; + + *spapp = NULL; + +@@ -2879,6 +2881,8 @@ spa_open_common(const char *pool, spa_t **spapp, void *tag, nvlist_t *nvpolicy, + if (spa->spa_state == POOL_STATE_UNINITIALIZED) { + zpool_rewind_policy_t policy; + ++ firstopen = B_TRUE; ++ + zpool_get_rewind_policy(nvpolicy ? nvpolicy : spa->spa_config, + &policy); + if (policy.zrp_request & ZPOOL_DO_REWIND) +@@ -2953,6 +2957,11 @@ spa_open_common(const char *pool, spa_t **spapp, void *tag, nvlist_t *nvpolicy, + mutex_exit(&spa_namespace_lock); + } + ++#ifdef _KERNEL ++ if (firstopen) ++ zvol_create_minors(spa->spa_name); ++#endif ++ + *spapp = spa; + + return (0); +@@ -4010,6 +4019,10 @@ spa_import(const char *pool, nvlist_t *config, nvlist_t *props, uint64_t flags) + mutex_exit(&spa_namespace_lock); + spa_history_log_version(spa, LOG_POOL_IMPORT); + ++#ifdef _KERNEL ++ zvol_create_minors(pool); ++#endif ++ + return (0); + } + +diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c +index 1226b2c..a9184a1 100644 +--- a/module/zfs/zfs_ioctl.c ++++ b/module/zfs/zfs_ioctl.c +@@ -1268,9 +1268,6 @@ zfs_ioc_pool_import(zfs_cmd_t *zc) + error = err; + } + +- if (error == 0) +- zvol_create_minors(zc->zc_name); +- + nvlist_free(config); + + if (props) +diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c +index 43a7bb6..e35c91b 100644 +--- a/module/zfs/zvol.c ++++ b/module/zfs/zvol.c +@@ -1215,6 +1215,9 @@ zvol_alloc(dev_t dev, const char *name) + + zv = kmem_zalloc(sizeof (zvol_state_t), KM_SLEEP); + ++ spin_lock_init(&zv->zv_lock); ++ list_link_init(&zv->zv_next); ++ + zv->zv_queue = blk_init_queue(zvol_request, &zv->zv_lock); + if (zv->zv_queue == NULL) + goto out_kmem; +@@ -1248,9 +1251,6 @@ zvol_alloc(dev_t dev, const char *name) + sizeof (rl_t), offsetof(rl_t, r_node)); + zv->zv_znode.z_is_zvol = TRUE; + +- spin_lock_init(&zv->zv_lock); +- list_link_init(&zv->zv_next); +- + zv->zv_disk->major = zvol_major; + zv->zv_disk->first_minor = (dev & MINORMASK); + zv->zv_disk->fops = &zvol_ops; +@@ -1561,30 +1561,36 @@ zvol_init(void) + { + int error; + ++ list_create(&zvol_state_list, sizeof (zvol_state_t), ++ offsetof(zvol_state_t, zv_next)); ++ mutex_init(&zvol_state_lock, NULL, MUTEX_DEFAULT, NULL); ++ + zvol_taskq = taskq_create(ZVOL_DRIVER, zvol_threads, maxclsyspri, + zvol_threads, INT_MAX, TASKQ_PREPOPULATE); + if (zvol_taskq == NULL) { + printk(KERN_INFO "ZFS: taskq_create() failed\n"); +- return (-ENOMEM); ++ error = -ENOMEM; ++ goto out1; + } + + error = register_blkdev(zvol_major, ZVOL_DRIVER); + if (error) { + printk(KERN_INFO "ZFS: register_blkdev() failed %d\n", error); +- taskq_destroy(zvol_taskq); +- return (error); ++ goto out2; + } + + blk_register_region(MKDEV(zvol_major, 0), 1UL << MINORBITS, + THIS_MODULE, zvol_probe, NULL, NULL); + +- mutex_init(&zvol_state_lock, NULL, MUTEX_DEFAULT, NULL); +- list_create(&zvol_state_list, sizeof (zvol_state_t), +- offsetof(zvol_state_t, zv_next)); ++ return (0); + +- (void) zvol_create_minors(NULL); ++out2: ++ taskq_destroy(zvol_taskq); ++out1: ++ mutex_destroy(&zvol_state_lock); ++ list_destroy(&zvol_state_list); + +- return (0); ++ return (error); + } + + void +diff --git a/scripts/zconfig.sh b/scripts/zconfig.sh +index 141348c..281166c 100755 +--- a/scripts/zconfig.sh ++++ b/scripts/zconfig.sh +@@ -264,8 +264,9 @@ test_4() { + zconfig_zvol_device_stat 0 ${POOL_NAME} ${FULL_ZVOL_NAME} \ + ${FULL_SNAP_NAME} ${FULL_CLONE_NAME} || fail 9 + +- # Load the modules, wait 1 second for udev ++ # Load the modules, list the pools to ensure they are opened + ${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 10 ++ ${ZPOOL} list &>/dev/null + + # Verify the devices were created + zconfig_zvol_device_stat 10 ${POOL_NAME} ${FULL_ZVOL_NAME} \ +diff --git a/udev/rules.d/90-zfs.rules.in b/udev/rules.d/90-zfs.rules.in +index 52e1d63..a2715d2 100644 +--- a/udev/rules.d/90-zfs.rules.in ++++ b/udev/rules.d/90-zfs.rules.in +@@ -1,4 +1,4 @@ +-SUBSYSTEM!="block", GOTO="zfs_end" ++SUBSYSTEM!="block|misc", GOTO="zfs_end" + ACTION!="add|change", GOTO="zfs_end" + + ENV{ID_FS_TYPE}=="zfs", RUN+="/sbin/modprobe zfs" +@@ -7,4 +7,6 @@ ENV{ID_FS_TYPE}=="zfs_member", RUN+="/sbin/modprobe zfs" + KERNEL=="null", SYMLINK+="root" + SYMLINK=="null", SYMLINK+="root" + ++SUBSYSTEM=="misc", KERNEL=="zfs", RUN+="@sbindir@/zpool list" ++ + LABEL="zfs_end" diff --git a/sys-fs/zfs/files/zfs-0.6.1-gentoo-openrc-dependencies.patch b/sys-fs/zfs/files/zfs-0.6.1-gentoo-openrc-dependencies.patch new file mode 100644 index 000000000000..e794b183eb33 --- /dev/null +++ b/sys-fs/zfs/files/zfs-0.6.1-gentoo-openrc-dependencies.patch @@ -0,0 +1,57 @@ +commit 75c2fb953c99bba008f1ef72ee71136002749f51 +Author: Richard Yao <ryao@cs.stonybrook.edu> +Date: Tue May 28 20:08:15 2013 -0400 + + Improve OpenRC init script + + The current zfs OpenRC script's dependencies cause OpenRC to attempt to + unmount ZFS filesystems at shutdown while things were still using them, + which would fail. This is a cosmetic issue, but it should still be + addressed. It probably does not affect systems where the rootfs is a + legacy filesystem, but any system with the rootfs on ZFS needs to run + the ZFS init script after the system is ready to shutdown filesystems. + + OpenRC's shutdown process occurs in the reverse order of the startup + process. Therefore running the ZFS shutdown procedure after filesystems + are ready to be unmounted requires running the startup procedure before + fstab. This patch changes the dependencies of the script to expliclty + run before fstab at boot when the rootfs is ZFS and to run after fstab + at boot whenever the rootfs is not ZFS. This should cover most use + cases. + + The only cases not covered well by this are systems with legacy + root filesystems where people want to configure fstab to mount a non-ZFS + filesystem off a zvol and possibly also systems whose pools are stored + on network block devices. The former requires that the ZFS script run + before fstab, which could cause ZFS datasets to mount too early and + appear under the fstab mount points. The latter requires that the ZFS + script run after networking starts, which precludes the ability to store + any system information on ZFS. An additional OpenRC script could be + written to handle non-root pools on network block devices, but that will + depend on user demand and developer time. + + Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu> + +diff --git a/etc/init.d/zfs.gentoo.in b/etc/init.d/zfs.gentoo.in +index 5b8671e..0034e02 100644 +--- a/etc/init.d/zfs.gentoo.in ++++ b/etc/init.d/zfs.gentoo.in +@@ -10,9 +10,16 @@ fi + + depend() + { ++ # Try to allow people to mix and match fstab with ZFS in a way that makes sense. ++ if [ "$(mountinfo -s /)" = 'zfs' ] ++ then ++ before localmount ++ else ++ after localmount ++ fi ++ + # bootmisc will log to /var which may be a different zfs than root. +- before net bootmisc +- after udev localmount ++ before bootmisc logger + keyword -lxc -openvz -prefix -vserver + } + diff --git a/sys-fs/zfs/files/zfs-init.sh.in b/sys-fs/zfs/files/zfs-init.sh.in new file mode 100644 index 000000000000..ed84585cd5f6 --- /dev/null +++ b/sys-fs/zfs/files/zfs-init.sh.in @@ -0,0 +1,29 @@ +#!/bin/sh + +ZFS="@sbindir@/zfs" +ZPOOL="@sbindir@/zpool" +ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache" + +if [ -f "${ZPOOL_CACHE}" ]; then + "${ZPOOL}" import -c "${ZPOOL_CACHE}" -aN 2>/dev/null + if [ "${?}" != "0" ]; then + echo "Failed to import not-yet imported pools." >&2 + fi +fi + +echo "Mounting ZFS filesystems" +"${ZFS}" mount -a +if [ "${?}" != "0" ]; then + echo "Failed to mount ZFS filesystems." >&2 + exit 1 +fi + +echo "Exporting ZFS filesystems" +"${ZFS}" share -a +if [ "${?}" != "0" ]; then + echo "Failed to export ZFS filesystems." >&2 + exit 1 +fi + +exit 0 + diff --git a/sys-fs/zfs/files/zfs.service.in b/sys-fs/zfs/files/zfs.service.in new file mode 100644 index 000000000000..c390a480708e --- /dev/null +++ b/sys-fs/zfs/files/zfs.service.in @@ -0,0 +1,16 @@ +[Unit] +Description=ZFS filesystems setup +Before=network.target +After=systemd-udev-settle.target local-fs.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStartPre=/sbin/modprobe zfs +ExecStartPre=/usr/bin/test -c /dev/zfs +ExecStart=/usr/libexec/zfs-init.sh +ExecStop=@sbindir@/zfs umount -a + +[Install] +WantedBy=multi-user.target + |