Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 260310 | Differences between
and this patch

Collapse All | Expand All

(-)a/configs/openafs-client (-2 / +10 lines)
Lines 4-12 Link Here
4
# ENABLE_AFSDB and ENABLE_DYNROOT determine whether AFSDB support and
4
# ENABLE_AFSDB and ENABLE_DYNROOT determine whether AFSDB support and
5
# Dynroot support (dynamically generated /afs), respectively, should be
5
# Dynroot support (dynamically generated /afs), respectively, should be
6
# enabled in the AFS client.
6
# enabled in the AFS client.
7
ENABLE_AFSDB="yes"
7
ENABLE_AFSDB="no"
8
ENABLE_DYNROOT="yes"
8
ENABLE_DYNROOT="yes"
9
9
10
# File where mount commands for futher restore will be stored
11
BINDS_STORAGE="/tmp/openrc.openafs-client.binds.storage"
12
13
# umount all `mount --bind`'s on stop - to remove any locks on fs
14
UNBIND_ON_STOP="yes"
15
16
# and restore them on start
17
RESTORE_ON_START="yes"
18
10
# AFS client configuration options:
19
# AFS client configuration options:
11
# ---------------------------------------------------------------------------
20
# ---------------------------------------------------------------------------
12
# possible AFS client afsd configuration options (from 1.3.74) are
21
# possible AFS client afsd configuration options (from 1.3.74) are
Lines 49-52 LARGE="-fakestat -stat 2800 -dcache 2400 -daemons 5 -volumes 128" Link Here
49
MEDIUM="-fakestat -stat 2000 -dcache 800 -daemons 3 -volumes 70"
58
MEDIUM="-fakestat -stat 2000 -dcache 800 -daemons 3 -volumes 70"
50
SMALL="-fakestat -stat 300 -dcache 100 -daemons 2 -volumes 50"
59
SMALL="-fakestat -stat 300 -dcache 100 -daemons 2 -volumes 50"
51
OPTIONS="AUTOMATIC"
60
OPTIONS="AUTOMATIC"
52
(-)a/scripts/openafs-client (-2 / +77 lines)
Lines 2-7 Link Here
2
# Copyright 1999-2005 Gentoo Foundation
2
# Copyright 1999-2005 Gentoo Foundation
3
# Distributed under the terms of the GNU General Public License v2
3
# Distributed under the terms of the GNU General Public License v2
4
4
5
opts="${opts} unbind restore"
6
5
depend() {
7
depend() {
6
	need net
8
	need net
7
	after openafs-server
9
	after openafs-server
Lines 30-36 choose_afsdoptions() { Link Here
30
32
31
start() {
33
start() {
32
	ebegin "Starting OpenAFS client"
34
	ebegin "Starting OpenAFS client"
33
	failed=1
35
	local failed=1
34
36
35
	eindent
37
	eindent
36
38
Lines 53-58 start() { Link Here
53
	else
55
	else
54
		cleanstart
56
		cleanstart
55
		failed=$?
57
		failed=$?
58
59
		if [[ ${failed} -eq 0 ]] && [[ "${RESTORE_ON_START}" == "yes" ]]; then
60
			restore
61
		fi
62
56
		eend $failed
63
		eend $failed
57
	fi
64
	fi
58
		
65
		
Lines 85-98 cleanstart() Link Here
85
	fi
92
	fi
86
}
93
}
87
94
95
unbind() {
96
	local binds= path= options= errors=0
97
	ebegin "Saving /afs binds to ${BINDS_STORAGE}"
98
99
	binds=$(mount | grep '/afs on .*bind' | \
100
		sed -r 's|/afs on (.+) type none \(((([[:alnum:]]+),?)+)\)$|\1 \2|;')
101
102
	if [[ -z "${binds}" ]]; then
103
		eend 0
104
		return 0
105
	fi
106
107
	if [[ -f "${BINDS_STORAGE}" ]]; then
108
		ewarn "Moving existing '${BINDS_STORAGE}' to '${BINDS_STORAGE}.old'"
109
		mv -f "${BINDS_STORAGE}" "${BINDS_STORAGE}.old"
110
	fi
111
112
	eindent
113
	set ${binds};
114
115
	while [ $# -gt 0 ]; do
116
		path=$1
117
		options=$2
118
		shift; shift;
119
120
		ebegin "Unmounting and saving '${path}' (${options})"
121
122
		if ! umount "${path}"; then
123
			ewarn "Failed to umount /afs bind: ${path}"
124
			errors=$(( $errors + 1 ))
125
			eend 1
126
		else
127
			echo "/bin/mount -o ${options} /afs \"${path}\"" \
128
				>> "${BINDS_STORAGE}"
129
			eend $?
130
		fi
131
	done
132
133
	eoutdent
134
135
	eend ${errors}
136
	return ${errors}
137
}
138
139
restore() {
140
	ebegin "Restoring /afs binds from ${BINDS_STORAGE}"
141
	local mount_command= errors=0
142
	[[ -f "${BINDS_STORAGE}" ]] || return 0
143
144
	while read -r mount_command; do
145
		if ! eval ${mount_command}; then
146
			ewarn "Bind restore '${mount_command}' failed";
147
			errors=$(( $errors + 1 ))
148
		fi
149
	done < ${BINDS_STORAGE}
150
151
	if [[ ${errors} -gt 0 ]]; then
152
		ewarn "${errors} binds failed to restore";
153
	else
154
		rm -f "${BINDS_STORAGE}"
155
	fi
156
	
157
	eend ${errors}
158
	return ${errors}
159
}
160
88
stop() {
161
stop() {
89
	ebegin "Stopping OpenAFS client"
162
	ebegin "Stopping OpenAFS client"
90
	failed=1
163
	local failed=1
91
164
92
	eindent
165
	eindent
93
166
167
	[[ "${UNBIND_ON_STOP}" == "yes" ]] && unbind
94
	# Three stage process: unmount / stop daemon / unload module
168
	# Three stage process: unmount / stop daemon / unload module
95
	ebegin "Unmounting /afs"
169
	ebegin "Unmounting /afs"
170
96
	if ! umount /afs; then
171
	if ! umount /afs; then
97
		eend 1
172
		eend 1
98
	else
173
	else
(-)a/scripts/openafs-server (-7 / +3 lines)
Lines 36-52 stop() { Link Here
36
36
37
	# This kindly kills all server processes
37
	# This kindly kills all server processes
38
	if ! /usr/bin/bos shutdown localhost -localauth -wait; then
38
	if ! /usr/bin/bos shutdown localhost -localauth -wait; then
39
		eend 1
40
	else
41
		start-stop-daemon --quiet --stop --pidfile /var/run/bosserver.pid
39
		start-stop-daemon --quiet --stop --pidfile /var/run/bosserver.pid
42
		failed=$?
43
		eend $failed
44
	fi
40
	fi
41
	failed=$?
42
	eend ${failed}
45
43
46
	eoutdent
44
	eoutdent
47
45
48
	if [ $failed != 0 ]; then
46
	[ ${failed} -ne 0 ] && return 1
49
		return 1
50
	fi
51
}
47
}
52
48

Return to bug 260310