=== modified file 'sbin/snap.lvm2' --- sbin/snap.lvm2 2015-12-15 11:44:03 +0000 +++ sbin/snap.lvm2 2015-12-15 10:18:21 +0000 @@ -13,10 +13,8 @@ LOCKDIR=/var/lock/snaprep test -d "$LOCKDIR" || mkdir -p "$LOCKDIR" || exit $? LOCKFILE="$LOCKDIR/lvm2.${SRC//\//-}" -# exec 3> "$LOCKFILE" || exit $? -( +exec 3> "$LOCKFILE" || exit $? flock -n 3 || exit $? -echo $$ >&3 if test -b "$S_DEV"; then echo >&2 "removing stale snapshot" if grep -qF "$S_DEV" /proc/mounts; then # TODO match only on start of line @@ -47,5 +45,5 @@ RETCODE=$? umount "$SNAPSHOT" lvremove -f "$S_VOL" -) 3> "$LOCKFILE" +rm "$LOCKFILE" exit $RETCODE