1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

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>
This commit is contained in:
Martin Schwenke 2016-04-28 12:02:47 +10:00 committed by Martin Schwenke
parent 685e813c45
commit ddfbd74607

View File

@ -145,7 +145,6 @@ 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
@ -154,7 +153,6 @@ create_ganesha_recdirs ()
rm -v "$GANRECDIR"
fi
fi
fi
# This is not an "else". It also re-creates the link if it was
# removed above!
if [ ! -e "$GANRECDIR" ]; then