Fix mount issue when multiple repos share the same data path.

This commit is contained in:
Rob Pearce 2020-11-09 09:41:26 +11:00
parent 703c353c1b
commit 512b709d31
1 changed files with 19 additions and 14 deletions

33
bare.sh
View File

@ -477,6 +477,18 @@ function check_repomount_needed() {
return 0
}
function check_datamount_needed() {
if [[ $CMD == "go" ]]; then
NEEDMOUNT=1
elif [[ $CMD == "get" ]]; then
NEEDMOUNT=1
elif [[ $CMD == "diff" ]]; then
NEEDMOUNT=1
else
NEEDMOUNT=0
fi
}
# Handle args
ARGS="acd:hs:tTvx:"
@ -748,6 +760,7 @@ for f in $REPO_LIST; do
fi
fi
check_datamount_needed "$f" # sets $NEEDMOUNT
if [[ $CMD == "go" ]]; then
NEEDMOUNT=1
elif [[ $CMD == "get" ]]; then
@ -835,15 +848,7 @@ for f in $REPO_LIST; do
else
USINGDEFAULT=1
fi
if [[ $CMD == "go" ]]; then
NEEDMOUNT=1
elif [[ $CMD == "get" ]]; then
NEEDMOUNT=1
elif [[ $CMD == "diff" ]]; then
NEEDMOUNT=1
else
NEEDMOUNT=0
fi
check_datamount_needed "$f" # sets $NEEDMOUNT
check_repomount_needed "$f" # sets $MOUNTREPO
if [[ $MOUNTREPO -eq 1 ]]; then
@ -1383,11 +1388,6 @@ for f in $REPO_LIST; do
fi
fi
if [[ $NEEDMOUNT -eq 1 ]]; then
do_umount
fi
if [[ ! $CMD == "check" ]]; then
# Record result
updatestats $f $CMD $rv
@ -1405,6 +1405,11 @@ done
# Clean up
for f in $REPO_LIST; do
check_datamount_needed "$f" # sets $NEEDMOUNT
if [[ $NEEDMOUNT -eq 1 ]]; then
do_umount
fi
check_repomount_needed "$f" # sets $MOUNTREPO
if [[ $MOUNTREPO -eq 1 ]]; then
path=`gettagval "$f" premount`