1 |
commit: 11451485c6e8e4f52d0f2096c9bf0b7100ecc865 |
2 |
Author: Richard Yao <ryao <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Oct 1 23:02:09 2015 +0000 |
4 |
Commit: Richard Yao <ryao <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Oct 1 23:02:09 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=11451485 |
7 |
|
8 |
sys-fs/zfs-0.6.5-r1: Add missing patch file |
9 |
|
10 |
This should have been in the previous commit. |
11 |
|
12 |
Signed-off-by: Richard Yao <ryao <AT> gentoo.org> |
13 |
|
14 |
.../zfs/files/zfs-0.6.5-fix-openrc-scripts.patch | 256 +++++++++++++++++++++ |
15 |
1 file changed, 256 insertions(+) |
16 |
|
17 |
diff --git a/sys-fs/zfs/files/zfs-0.6.5-fix-openrc-scripts.patch b/sys-fs/zfs/files/zfs-0.6.5-fix-openrc-scripts.patch |
18 |
new file mode 100644 |
19 |
index 0000000..fec87d0 |
20 |
--- /dev/null |
21 |
+++ b/sys-fs/zfs/files/zfs-0.6.5-fix-openrc-scripts.patch |
22 |
@@ -0,0 +1,256 @@ |
23 |
+commit 3cb750b249717b43cbfcde78b44b0e38a2a61dc2 |
24 |
+Author: James Lee <jlee@×××××××××××××.com> |
25 |
+Date: Sat Sep 19 22:00:36 2015 -0400 |
26 |
+ |
27 |
+ zfs-import: Perform verbatim import using cache file |
28 |
+ |
29 |
+ This change modifies the import service to use the default cache file |
30 |
+ to perform a verbatim import of pools at boot. This fixes code that |
31 |
+ searches all devices and imported all visible pools. |
32 |
+ |
33 |
+ Using the cache file is in keeping with the way ZFS has always worked, |
34 |
+ how Solaris, Illumos, FreeBSD, and systemd performs imports, and is how |
35 |
+ it is written in the man page (zpool(1M,8)): |
36 |
+ |
37 |
+ All pools in this cache are automatically imported when the |
38 |
+ system boots. |
39 |
+ |
40 |
+ Importantly, the cache contains important information for importing |
41 |
+ multipath devices, and helps control which pools get imported in more |
42 |
+ dynamic environments like SANs, which may have thousands of visible |
43 |
+ and constantly changing pools, which the ZFS_POOL_EXCEPTIONS variable |
44 |
+ is not equipped to handle. Verbatim imports prevent rogue pools from |
45 |
+ being automatically imported and mounted where they shouldn't be. |
46 |
+ |
47 |
+ The change also stops the service from exporting pools at shutdown. |
48 |
+ Exporting pools is only meant to be performed explicitly by the |
49 |
+ administrator of the system. |
50 |
+ |
51 |
+ The old behavior of searching and importing all visible pools is |
52 |
+ preserved and can be switched on by heeding the warning and toggling |
53 |
+ the ZPOOL_IMPORT_ALL_VISIBLE variable in /etc/default/zfs. |
54 |
+ |
55 |
+ Closes #3777 |
56 |
+ Closes #3526 |
57 |
+ |
58 |
+diff --git a/etc/init.d/zfs-import.in b/etc/init.d/zfs-import.in |
59 |
+index 5e21929..2258638 100755 |
60 |
+--- a/etc/init.d/zfs-import.in |
61 |
++++ b/etc/init.d/zfs-import.in |
62 |
+@@ -1,11 +1,10 @@ |
63 |
+ #!@SHELL@ |
64 |
+ # |
65 |
+-# zfs-import This script will import/export zfs pools. |
66 |
++# zfs-import This script will import ZFS pools |
67 |
+ # |
68 |
+ # chkconfig: 2345 01 99 |
69 |
+-# description: This script will import/export zfs pools during system |
70 |
+-# boot/shutdown. |
71 |
+-# It is also responsible for all userspace zfs services. |
72 |
++# description: This script will perform a verbatim import of ZFS pools |
73 |
++# during system boot. |
74 |
+ # probe: true |
75 |
+ # |
76 |
+ ### BEGIN INIT INFO |
77 |
+@@ -17,7 +16,7 @@ |
78 |
+ # X-Start-Before: checkfs |
79 |
+ # X-Stop-After: zfs-mount |
80 |
+ # Short-Description: Import ZFS pools |
81 |
+-# Description: Run the `zpool import` or `zpool export` commands. |
82 |
++# Description: Run the `zpool import` command. |
83 |
+ ### END INIT INFO |
84 |
+ # |
85 |
+ # NOTE: Not having '$local_fs' on Required-Start but only on Required-Stop |
86 |
+@@ -43,6 +42,16 @@ do_depend() |
87 |
+ keyword -lxc -openvz -prefix -vserver |
88 |
+ } |
89 |
+ |
90 |
++# Use the zpool cache file to import pools |
91 |
++do_verbatim_import() |
92 |
++{ |
93 |
++ if [ -f "$ZPOOL_CACHE" ] |
94 |
++ then |
95 |
++ zfs_action "Importing ZFS pool(s)" \ |
96 |
++ "$ZPOOL" import -c "$ZPOOL_CACHE" -N -a |
97 |
++ fi |
98 |
++} |
99 |
++ |
100 |
+ # Support function to get a list of all pools, separated with ';' |
101 |
+ find_pools() |
102 |
+ { |
103 |
+@@ -60,8 +69,8 @@ find_pools() |
104 |
+ echo "${pools%%;}" # Return without the last ';'. |
105 |
+ } |
106 |
+ |
107 |
+-# Import all pools |
108 |
+-do_import() |
109 |
++# Find and import all visible pools, even exported ones |
110 |
++do_import_all_visible() |
111 |
+ { |
112 |
+ local already_imported available_pools pool npools |
113 |
+ local exception dir ZPOOL_IMPORT_PATH RET=0 r=1 |
114 |
+@@ -109,7 +118,7 @@ do_import() |
115 |
+ fi |
116 |
+ fi |
117 |
+ |
118 |
+- # Filter out any exceptions... |
119 |
++ # Filter out any exceptions... |
120 |
+ if [ -n "$ZFS_POOL_EXCEPTIONS" ] |
121 |
+ then |
122 |
+ local found="" |
123 |
+@@ -249,41 +258,15 @@ do_import() |
124 |
+ return "$RET" |
125 |
+ } |
126 |
+ |
127 |
+-# Export all pools |
128 |
+-do_export() |
129 |
++do_import() |
130 |
+ { |
131 |
+- local already_imported pool root_pool RET r |
132 |
+- RET=0 |
133 |
+- |
134 |
+- root_pool=$(get_root_pool) |
135 |
+- |
136 |
+- [ -n "$init" ] && zfs_log_begin_msg "Exporting ZFS pool(s)" |
137 |
+- |
138 |
+- # Find list of already imported pools. |
139 |
+- already_imported=$(find_pools "$ZPOOL" list -H -oname) |
140 |
+- |
141 |
+- OLD_IFS="$IFS" ; IFS=";" |
142 |
+- for pool in $already_imported; do |
143 |
+- [ "$pool" = "$root_pool" ] && continue |
144 |
+- |
145 |
+- if [ -z "$init" ] |
146 |
+- then |
147 |
+- # Interactive - one 'Importing ...' line per pool |
148 |
+- zfs_log_begin_msg "Exporting ZFS pool $pool" |
149 |
+- else |
150 |
+- # Not interactive - a dot for each pool. |
151 |
+- zfs_log_progress_msg "." |
152 |
+- fi |
153 |
+- |
154 |
+- "$ZPOOL" export "$pool" |
155 |
+- r="$?" ; RET=$((RET + r)) |
156 |
+- [ -z "$init" ] && zfs_log_end_msg "$r" |
157 |
+- done |
158 |
+- IFS="$OLD_IFS" |
159 |
+- |
160 |
+- [ -n "$init" ] && zfs_log_end_msg "$RET" |
161 |
+- |
162 |
+- return "$RET" |
163 |
++ if check_boolean "$ZPOOL_IMPORT_ALL_VISIBLE" |
164 |
++ then |
165 |
++ do_import_all_visible |
166 |
++ else |
167 |
++ # This is the default option |
168 |
++ do_verbatim_import |
169 |
++ fi |
170 |
+ } |
171 |
+ |
172 |
+ # Output the status and list of pools |
173 |
+@@ -323,14 +306,6 @@ do_start() |
174 |
+ fi |
175 |
+ } |
176 |
+ |
177 |
+-do_stop() |
178 |
+-{ |
179 |
+- # Check to see if the module is even loaded. |
180 |
+- check_module_loaded "zfs" || exit 0 |
181 |
+- |
182 |
+- do_export |
183 |
+-} |
184 |
+- |
185 |
+ # ---------------------------------------------------- |
186 |
+ |
187 |
+ if [ ! -e /etc/gentoo-release ] |
188 |
+@@ -340,7 +315,7 @@ then |
189 |
+ do_start |
190 |
+ ;; |
191 |
+ stop) |
192 |
+- do_stop |
193 |
++ # no-op |
194 |
+ ;; |
195 |
+ status) |
196 |
+ do_status |
197 |
+@@ -350,7 +325,7 @@ then |
198 |
+ ;; |
199 |
+ *) |
200 |
+ [ -n "$1" ] && echo "Error: Unknown command $1." |
201 |
+- echo "Usage: $0 {start|stop|status}" |
202 |
++ echo "Usage: $0 {start|status}" |
203 |
+ exit 3 |
204 |
+ ;; |
205 |
+ esac |
206 |
+@@ -360,6 +335,5 @@ else |
207 |
+ # Create wrapper functions since Gentoo don't use the case part. |
208 |
+ depend() { do_depend; } |
209 |
+ start() { do_start; } |
210 |
+- stop() { do_stop; } |
211 |
+ status() { do_status; } |
212 |
+ fi |
213 |
+diff --git a/etc/init.d/zfs.in b/etc/init.d/zfs.in |
214 |
+index eabb7e4..d81ef22 100644 |
215 |
+--- a/etc/init.d/zfs.in |
216 |
++++ b/etc/init.d/zfs.in |
217 |
+@@ -16,6 +16,24 @@ ZFS_SHARE='yes' |
218 |
+ # Run `zfs unshare -a` during system stop? |
219 |
+ ZFS_UNSHARE='yes' |
220 |
+ |
221 |
++# By default, a verbatim import of all pools is performed at boot based on the |
222 |
++# contents of the default zpool cache file. The contents of the cache are |
223 |
++# managed automatically by the 'zpool import' and 'zpool export' commands. |
224 |
++# |
225 |
++# By setting this to 'yes', the system will instead search all devices for |
226 |
++# pools and attempt to import them all at boot, even those that have been |
227 |
++# exported. Under this mode, the search path can be controlled by the |
228 |
++# ZPOOL_IMPORT_PATH variable and a list of pools that should not be imported |
229 |
++# can be listed in the ZFS_POOL_EXCEPTIONS variable. |
230 |
++# |
231 |
++# Note that importing all visible pools may include pools that you don't |
232 |
++# expect, such as those on removable devices and SANs, and those pools may |
233 |
++# proceed to mount themselves in places you do not want them to. The results |
234 |
++# can be unpredictable and possibly dangerous. Only enable this option if you |
235 |
++# understand this risk and have complete physical control over your system and |
236 |
++# SAN to prevent the insertion of malicious pools. |
237 |
++ZPOOL_IMPORT_ALL_VISIBLE='no' |
238 |
++ |
239 |
+ # Specify specific path(s) to look for device nodes and/or links for the |
240 |
+ # pool import(s). See zpool(8) for more information about this variable. |
241 |
+ # It supersedes the old USE_DISK_BY_ID which indicated that it would only |
242 |
+@@ -23,6 +41,18 @@ ZFS_UNSHARE='yes' |
243 |
+ # The old variable will still work in the code, but is deprecated. |
244 |
+ #ZPOOL_IMPORT_PATH="/dev/disk/by-vdev:/dev/disk/by-id" |
245 |
+ |
246 |
++# List of pools that should NOT be imported at boot |
247 |
++# when ZPOOL_IMPORT_ALL_VISIBLE is 'yes'. |
248 |
++# This is a space separated list. |
249 |
++#ZFS_POOL_EXCEPTIONS="test2" |
250 |
++ |
251 |
++# List of pools that SHOULD be imported at boot by the initramfs |
252 |
++# instead of trying to import all available pools. If this is set |
253 |
++# then ZFS_POOL_EXCEPTIONS is ignored. |
254 |
++# Only applicable for Debian GNU/Linux {dkms,initramfs}. |
255 |
++# This is a semi-colon separated list. |
256 |
++#ZFS_POOL_IMPORT="pool1;pool2" |
257 |
++ |
258 |
+ # Should the datasets be mounted verbosely? |
259 |
+ # A mount counter will be used when mounting if set to 'yes'. |
260 |
+ VERBOSE_MOUNT='no' |
261 |
+@@ -97,17 +127,6 @@ ZFS_INITRD_POST_MODPROBE_SLEEP='0' |
262 |
+ # Example: If root FS is 'rpool/ROOT/rootfs', this would make sense. |
263 |
+ #ZFS_INITRD_ADDITIONAL_DATASETS="rpool/ROOT/usr rpool/ROOT/var" |
264 |
+ |
265 |
+-# List of pools that should NOT be imported at boot? |
266 |
+-# This is a space separated list. |
267 |
+-#ZFS_POOL_EXCEPTIONS="test2" |
268 |
+- |
269 |
+-# List of pools to import? |
270 |
+-# If this variable is set, there will be NO auto-import of ANY other |
271 |
+-# pool. In essence, there will be no auto detection of availible pools. |
272 |
+-# This is a semi-colon separated list. |
273 |
+-# Makes the variable ZFS_POOL_EXCEPTIONS above redundant (won't be checked). |
274 |
+-#ZFS_POOL_IMPORT="pool1;pool2" |
275 |
+- |
276 |
+ # Optional arguments for the ZFS Event Daemon (ZED). |
277 |
+ # See zed(8) for more information on available options. |
278 |
+ #ZED_ARGS="-M" |