1 #!/bin/bash 2 3 # 4 # Copyright (c) International Business Machines Corp., 2005 5 # Author: Avantika Mathur (mathurav (at] 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 22 SETS_DEFAULTS="${TCID=test33} ${TST_COUNT=1} ${TST_TOTAL=1}" 23 declare -r TCID 24 declare -r TST_COUNT 25 declare -r TST_TOTAL 26 export TCID TST_COUNT TST_TOTAL 27 28 tst_resm TINFO "***************TEST33***************" 29 tst_resm TINFO "rbind: multi-level slave p-nodes." 30 tst_resm TINFO "************************************" 31 32 . "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test33 failed" && tst_exit) 33 export result=0 34 35 36 37 38 trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR 39 40 while /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 79 done 80 trap 'ERR=$? ; tst_resm TWARN "rbind/test33: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR 81 if [ -n "${ERR_MSG}" ]; then 82 tst_resm TWARN "rbind/test33: ${ERR_MSG}" 83 ERR_MSG="" 84 result=$ERR 85 fi 86 trap '' 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 103 if [ $result -ne 0 ] 104 then 105 tst_resm TFAIL "rbind/test33: FAILED: rbind: multi-level slave p-nodes." 106 exit 1 107 else 108 tst_resm TPASS "rbind/test33: PASSED" 109 exit 0 110 fi 111 112 113 114 tst_exit 115