1.4.7 reverted shebangs to Linux style, added -F to zfs receive, dyked out set readonly behavior to mitigate upstream bugs in mount/unmount

This commit is contained in:
Jim Salter 2016-06-13 11:42:17 -04:00
parent c0f065b0f0
commit 95f1ecb159
5 changed files with 36 additions and 15 deletions

View File

@ -1,3 +1,13 @@
1.4.7 reverted Perl shebangs to #!/usr/bin/perl - sorry FreeBSD folks, shebanged to /usr/bin/env perl bare calls to syncoid
or sanoid (without explicit calls to Perl) don't work on EITHER of our systems. I'm not OK with that, this is going to be
an OS localization issue that can either be addressed with BSD-specific packaging, or you can individually address it
by editing the shebangs on your own systems OR by doing a one-time ln -s /usr/local/bin/perl to /usr/bin/perl, which will
fix the issue for this particular script AND all other Perl scripts developed on non-BSD systems.
also temporarily dyked out the set readonly functionality in syncoid - it was causing more problems than it prevented, and
using the -F argument with receive prevents incautious writes (including just cd'ing into mounted datasets, if atimes are on)
from interrupting syncoid runs anyway.
1.4.6c merged @gusson's pull request to add -sshport argument
1.4.6b updated default cipherlist for syncoid to

View File

@ -1 +1 @@
1.4.6
1.4.7

View File

@ -1,4 +1,4 @@
#!/usr/bin/env perl
#!/usr/bin/perl
# this software is licensed for use under the Free Software Foundation's GPL v3.0 license, as retrieved
# from http://www.gnu.org/licenses/gpl-3.0.html on 2014-11-17. A copy should also be available in this
@ -11,7 +11,7 @@ use warnings;
my $zfs = '/sbin/zfs';
my %args = getargs(@ARGV);
my $progversion = '1.4.6c';
my $progversion = '1.4.7';
if ($args{'version'}) { print "$progversion\n"; exit 0; }

4
sanoid
View File

@ -1,10 +1,10 @@
#!/usr/bin/env perl
#!/usr/bin/perl
# this software is licensed for use under the Free Software Foundation's GPL v3.0 license, as retrieved
# from http://www.gnu.org/licenses/gpl-3.0.html on 2014-11-17. A copy should also be available in this
# project's Git repository at https://github.com/jimsalterjrs/sanoid/blob/master/LICENSE.
my $version = '1.4.6c';
my $version = '1.4.7';
use strict;
use Config::IniFiles; # read samba-style conf file

31
syncoid
View File

@ -1,10 +1,10 @@
#!/usr/bin/env perl
#!/usr/bin/perl
# this software is licensed for use under the Free Software Foundation's GPL v3.0 license, as retrieved
# from http://www.gnu.org/licenses/gpl-3.0.html on 2014-11-17. A copy should also be available in this
# project's Git repository at https://github.com/jimsalterjrs/sanoid/blob/master/LICENSE.
my $version = '1.4.6c';
my $version = '1.4.7';
use strict;
use Data::Dumper;
@ -146,7 +146,9 @@ sub syncdataset {
# been turned on... even when it's off... unless and
# until the filesystem is zfs umounted and zfs remounted.
# we're going to do the right thing anyway.
my $originaltargetreadonly;
# dyking this functionality out for the time being due to buggy mount/unmount behavior
# with ZFS on Linux (possibly OpenZFS in general) when setting/unsetting readonly.
#my $originaltargetreadonly;
# sync 'em up.
if (! $targetexists) {
@ -181,8 +183,10 @@ sub syncdataset {
if ($oldestsnap ne $newsyncsnap) {
# get current readonly status of target, then set it to on during sync
$originaltargetreadonly = getzfsvalue($targethost,$targetfs,$targetisroot,'readonly');
setzfsvalue($targethost,$targetfs,$targetisroot,'readonly','on');
# dyking this functionality out for the time being due to buggy mount/unmount behavior
# with ZFS on Linux (possibly OpenZFS in general) when setting/unsetting readonly.
# $originaltargetreadonly = getzfsvalue($targethost,$targetfs,$targetisroot,'readonly');
# setzfsvalue($targethost,$targetfs,$targetisroot,'readonly','on');
$sendcmd = "$sourcesudocmd $zfscmd send -I $sourcefs\@$oldestsnap $sourcefs\@$newsyncsnap";
$pvsize = getsendsize($sourcehost,"$sourcefs\@$oldestsnap","$sourcefs\@$newsyncsnap",$sourceisroot);
@ -201,15 +205,20 @@ sub syncdataset {
or die "CRITICAL ERROR: $synccmd failed: $?";
# restore original readonly value to target after sync complete
setzfsvalue($targethost,$targetfs,$targetisroot,'readonly',$originaltargetreadonly);
# dyking this functionality out for the time being due to buggy mount/unmount behavior
# with ZFS on Linux (possibly OpenZFS in general) when setting/unsetting readonly.
# setzfsvalue($targethost,$targetfs,$targetisroot,'readonly',$originaltargetreadonly);
}
} else {
# find most recent matching snapshot and do an -I
# to the new snapshot
# get current readonly status of target, then set it to on during sync
$originaltargetreadonly = getzfsvalue($targethost,$targetfs,$targetisroot,'readonly');
setzfsvalue($targethost,$targetfs,$targetisroot,'readonly','on');
# dyking this functionality out for the time being due to buggy mount/unmount behavior
# with ZFS on Linux (possibly OpenZFS in general) when setting/unsetting readonly.
# $originaltargetreadonly = getzfsvalue($targethost,$targetfs,$targetisroot,'readonly');
# setzfsvalue($targethost,$targetfs,$targetisroot,'readonly','on');
my $targetsize = getzfsvalue($targethost,$targetfs,$targetisroot,'-p used');
my $matchingsnap = getmatchingsnapshot($targetsize, \%snaps);
@ -230,7 +239,7 @@ sub syncdataset {
}
my $sendcmd = "$sourcesudocmd $zfscmd send -I $sourcefs\@$matchingsnap $sourcefs\@$newsyncsnap";
my $recvcmd = "$targetsudocmd $zfscmd receive $targetfs";
my $recvcmd = "$targetsudocmd $zfscmd receive -F $targetfs";
my $pvsize = getsendsize($sourcehost,"$sourcefs\@$matchingsnap","$sourcefs\@$newsyncsnap",$sourceisroot);
my $disp_pvsize = readablebytes($pvsize);
if ($pvsize == 0) { $disp_pvsize = "UNKNOWN"; }
@ -242,7 +251,9 @@ sub syncdataset {
or die "CRITICAL ERROR: $synccmd failed: $?";
# restore original readonly value to target after sync complete
setzfsvalue($targethost,$targetfs,$targetisroot,'readonly',$originaltargetreadonly);
# dyking this functionality out for the time being due to buggy mount/unmount behavior
# with ZFS on Linux (possibly OpenZFS in general) when setting/unsetting readonly.
#setzfsvalue($targethost,$targetfs,$targetisroot,'readonly',$originaltargetreadonly);
}
# prune obsolete sync snaps on source and target.