Skip to content

Commit

Permalink
ovlsnapshot: remount -o nosnapshot before clean all snapshots
Browse files Browse the repository at this point in the history
We must release the upper/work directories aquired by snapshot mount
before we can safely remove all snapshot directories.

Signed-off-by: Amir Goldstein <[email protected]>
  • Loading branch information
amir73il committed Jul 3, 2017
1 parent b66b578 commit 041d312
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions scripts/ovlsnapshot
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,18 @@ remove_snapshot()
remove_all_snapshots()
{
umount -i $SNAPDIR/*/_ 2>/dev/null
for s in `cat $SNAPSHOTS`; do

[ ! -s $SNAPSHOTS ] || mv $SNAPSHOTS $SNAPSHOTS.clean

# Remount snapshot mount '-o nosnapshot' so we can cleanup
remount_snapshot

[ -e $SNAPSHOTS.clean ] || return
for s in `cat $SNAPSHOTS.clean`; do
rm -rf $SNAPDIR/$s || exit 1
echo "snapshot $MNT@$s was removed"
done
rm $SNAPSHOTS
rm $SNAPSHOTS.clean
sync
}

Expand Down Expand Up @@ -426,7 +433,6 @@ case "$CMD" in
fi

remove_all_snapshots
remount_snapshot
echo "all snapshots at '$MNT' removed"
echo .
;;
Expand Down

0 comments on commit 041d312

Please sign in to comment.