diff --git a/scripts/mount.snapshot b/scripts/mount.snapshot index ba7c4db..e50a97d 100755 --- a/scripts/mount.snapshot +++ b/scripts/mount.snapshot @@ -152,17 +152,18 @@ mount_old_snapshots() # Before merging prev snapshot upper with a new lower # (curr snapshot), we need to remove the "origin" xattr # of old $lower, otherwise mount will fail (-ESTALE) - setfattr -x "trusted.overlay.origin" $oldsnap/u + setfattr -x "trusted.overlay.origin" $oldsnap/u || \ + error "failed removing 'origin' xattr" # ...and mount with nfs_export=nested, otherwise merge # dir origin fh verification will fail snapmntopts="$snapmntopts,nfs_export=nested" mount -i -t overlay "$dev@$old" "$oldmnt" \ - -o"ro,upperdir=$oldsnap/u,workdir=$oldsnap/w,lowerdir=$old_snapshots,$snapmntopts" + -o"ro,upperdir=$oldsnap/u,workdir=$oldsnap/w,lowerdir=$old_snapshots,$snapmntopts" || exit 1 fi old_snapshots="$oldsnap/u:$old_snapshots" [ -z "$prev" ] || \ mount -i -t overlay "$dev@$old" "$oldmnt" \ - -o"ro,lowerdir=$old_snapshots,$oldsnapmntopts" + -o"ro,lowerdir=$old_snapshots,$oldsnapmntopts" || exit 1 prev=$old done } diff --git a/scripts/ovlsnapshot b/scripts/ovlsnapshot index 3d094ce..8d8010a 100755 --- a/scripts/ovlsnapshot +++ b/scripts/ovlsnapshot @@ -112,11 +112,10 @@ debug() # parse [[/]@[/]] argument parse_path_snapshot_arg() { - MNT=$( echo $1 | ( IFS=$IFS@ ; read a b ; echo $a ) ) - snap=$( echo $1 | ( IFS=$IFS@ ; read a b ; echo $b ) ) + set -- $( IFS=@; echo $1 ) # strip / from / and / - MNT=${MNT%/} - snap=${snap#/} + MNT=${1%/} + snap=${2#/} # directory inside to store snapshot related files SNAPDIR=$MNT/@ # directory prefix for snapshot mount points @@ -133,6 +132,7 @@ parse_path_snapshot_arg() fi [ -n "$MNT" ] || usage 1 [ -d "$MNT" ] || error "'$MNT' is not a directory!" + mkdir -p $SNAPMNT || error "creating snapshot mount point" export MNT S=$MNT@$snap SNAPTEST="ovlsnaptest" @@ -660,7 +660,7 @@ case "$CMD" in # uncomment the following line to run in-place write tests INPLACE=$NOTRUNC # uncomment the following line to run direct I/O write tests - DIRECT="oflag=direct" + #DIRECT="oflag=direct" TRUNCSIZE=4 echo Appending $F zeros to $F.1 $DIRECT # append writes to new allocated blocks