From 512b709d319d756fe8a62238809136015f4c9844 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Mon, 9 Nov 2020 09:41:26 +1100 Subject: [PATCH] Fix mount issue when multiple repos share the same data path. --- bare.sh | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/bare.sh b/bare.sh index 3db5831..0bb82be 100755 --- a/bare.sh +++ b/bare.sh @@ -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`