1 #!/bin/bash 2 3 SETS_DEFAULTS="${TCID=test07-2} ${TST_COUNT=1} ${TST_TOTAL=1}" 4 declare -r TCID 5 declare -r TST_COUNT 6 declare -r TST_TOTAL 7 export TCID TST_COUNT TST_TOTAL 8 9 tst_resm TINFO "***************TEST07***************" 10 tst_resm TINFO "rbind: create slave then mount master - slave still propagates." 11 tst_resm TINFO "************************************" 12 13 . "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test07-2 failed" && tst_exit) 14 export result=0 15 16 17 18 trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR 19 20 while /bin/true ; do 21 # This loop is for error recovery purposes only 22 23 24 "${FS_BIND_ROOT}/bin/makedir" share parent2 25 "${FS_BIND_ROOT}/bin/makedir" share share2 26 27 mount --rbind share2 parent2 28 "${FS_BIND_ROOT}/bin/makedir" slave parent2 29 mount --rbind "$disk1" share2 30 31 check parent2 share2 32 33 mount --rbind "$disk2" parent2/a 34 35 check -n parent2/a share2/a 36 37 break 38 done 39 trap 'ERR=$? ; tst_resm TWARN "rbind/test07-2: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR 40 if [ -n "${ERR_MSG}" ]; then 41 tst_resm TWARN "rbind/test07-2: ${ERR_MSG}" 42 ERR_MSG="" 43 result=$ERR 44 fi 45 trap '' ERR 46 { 47 umount parent2/a 48 umount parent2 49 umount parent2 50 umount parent2 51 52 umount share2 53 umount share2 54 55 56 rm -rf parent* share* 57 cleanup 58 } >& /dev/null 59 if [ $result -ne 0 ] 60 then 61 tst_resm TFAIL "rbind/test07-2: FAILED: rbind: create slave then mount master - slave still propagates." 62 exit 1 63 else 64 tst_resm TPASS "rbind/test07-2: PASSED" 65 exit 0 66 fi 67 68 69 tst_exit 70