summaryrefslogtreecommitdiff
path: root/ctdb/doc/examples
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2016-04-28 12:02:47 +1000
committerMartin Schwenke <martins@samba.org>2016-05-03 04:43:19 +0200
commitddfbd7460733f6b1243a3796237932629dedc6c6 (patch)
tree7c71da37a751b5c14f64ac52f618220fb1efb750 /ctdb/doc/examples
parent685e813c45436046a18eb3b8895da5846bd2a0dc (diff)
downloadsamba-ddfbd7460733f6b1243a3796237932629dedc6c6.tar.gz
ctdb-doc: Fix example NFS Ganesha recovery directory maintenance logic
This currently fails exactly when it is needed: when there is a dangling link pointing into an unmounted filesystem. This happens because [ -e <dangling-link> ] returns false. The solution is simply to remove that check. Now the first condition in the "if" statement catches the backward compatibility case where $GANRECDIR used to be a directory. It will also catch other problems, such as if a file has been created in this location. If nothing exists then it will silently succeed (due to -f). The second case catches a symlink pointing to the wrong place (e.g. in an unmounted filesystem). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/doc/examples')
-rwxr-xr-xctdb/doc/examples/nfs-ganesha-callout16
1 files changed, 7 insertions, 9 deletions
diff --git a/ctdb/doc/examples/nfs-ganesha-callout b/ctdb/doc/examples/nfs-ganesha-callout
index 3f0a016c387..a3d04714786 100755
--- a/ctdb/doc/examples/nfs-ganesha-callout
+++ b/ctdb/doc/examples/nfs-ganesha-callout
@@ -145,15 +145,13 @@ create_ganesha_recdirs ()
_mntpt=$(echo "$_mounts" | sort | awk 'NR == 1 {print $3}')
_link_dst="${_mntpt}/${CTDB_GANESHA_REC_SUBDIR}"
mkdir -vp "$_link_dst"
- if [ -e "$GANRECDIR" ]; then
- if [ ! -L "$GANRECDIR" ] ; then
- rm -vrf "$GANRECDIR"
- else
- _t=$(readlink "$GANRECDIR")
- if [ "$_t" != "$_link_dst" ] ; then
- rm -v "$GANRECDIR"
- fi
- fi
+ if [ ! -L "$GANRECDIR" ] ; then
+ rm -vrf "$GANRECDIR"
+ else
+ _t=$(readlink "$GANRECDIR")
+ if [ "$_t" != "$_link_dst" ] ; then
+ rm -v "$GANRECDIR"
+ fi
fi
# This is not an "else". It also re-creates the link if it was
# removed above!