• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3#
4# Copyright (c) International Business Machines  Corp., 2005
5# Author: Avantika Mathur (mathurav@us.ibm.com)
6#
7# This library is free software; you can redistribute it and/or
8# modify it under the terms of the GNU Lesser General Public
9# License as published by the Free Software Foundation; either
10# version 2.1 of the License, or (at your option) any later version.
11#
12# This library is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15# Lesser General Public License for more details.
16#
17# You should have received a copy of the GNU Lesser General Public
18# License along with this library; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20#
21
22SETS_DEFAULTS="${TCID=test33} ${TST_COUNT=1} ${TST_TOTAL=1}"
23declare -r TCID
24declare -r TST_COUNT
25declare -r TST_TOTAL
26export TCID TST_COUNT TST_TOTAL
27
28tst_resm TINFO "***************TEST33***************"
29tst_resm TINFO "rbind: multi-level slave p-nodes."
30tst_resm TINFO "************************************"
31
32. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test33 failed" && tst_exit)
33export result=0
34
35
36
37
38trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
39
40while /bin/true ; do
41	# This loop is for error recovery purposes only
42
43
44
45	"${FS_BIND_ROOT}/bin/makedir" share dir1
46
47	mkdir dir1/x dir2 dir3 dir4
48
49	mount --rbind dir1 dir2
50	"${FS_BIND_ROOT}/bin/makedir" slave dir2
51	"${FS_BIND_ROOT}/bin/makedir" -n share dir2
52
53	mount --rbind dir2 dir3
54	"${FS_BIND_ROOT}/bin/makedir" slave dir3
55	"${FS_BIND_ROOT}/bin/makedir" -n share dir3
56
57	mount --rbind dir3 dir4
58	"${FS_BIND_ROOT}/bin/makedir" slave dir4
59
60	mount --rbind "$disk1" dir1/x
61
62	check dir1/x dir2/x dir3/x dir4/x
63
64	mount --rbind "$disk2" dir2/x/a
65	check -n dir1/x/a dir2/x/a
66	check dir2/x/a dir3/x/a dir4/x/a
67
68	mount --rbind "$disk3" dir3/x/b
69	check -n dir1/x/b dir3/x/b
70	check -n dir2/x/b dir3/x/b
71	check dir3/x/b dir4/x/b
72
73	mount --rbind "$disk4" dir4/x/c
74	check -n dir1/x/c dir4/x/c
75	check -n dir2/x/c dir4/x/c
76	check -n dir3/x/c dir4/x/c
77
78	break
79done
80trap 'ERR=$? ; tst_resm TWARN "rbind/test33: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
81if [ -n "${ERR_MSG}" ]; then
82	tst_resm TWARN "rbind/test33: ${ERR_MSG}"
83	ERR_MSG=""
84	result=$ERR
85fi
86trap '' ERR
87{
88	umount dir2/x/a
89	umount dir3/x/b
90	umount dir4/x/c
91	umount dir1/x
92	umount dir1
93	umount dir1
94	umount dir2
95	umount dir3
96	umount dir4
97
98	rm -rf dir*
99
100	cleanup
101} >& /dev/null
102
103if [ $result -ne 0 ]
104then
105        tst_resm TFAIL "rbind/test33: FAILED: rbind: multi-level slave p-nodes."
106        exit 1
107else
108        tst_resm TPASS "rbind/test33: PASSED"
109        exit 0
110fi
111
112
113
114tst_exit
115