Commit a670b802 authored by Mike Hibler's avatar Mike Hibler

Bug fix: attempt to avoid hangs when creating blockstores on large SSDs.

At least I think the problem is that we are doing inadvertent TRIM
operations on large (480GB) SSDs. For one, when creating an ext4
filesystem on such a blockstore, we specify "nodiscard". I toyed
with the idea of turning off "issue_discards" for the lvremove
operations when a blockstore is destroyed, but that led to old
metadata being seen when the blockstore was re-created. That led
to the last change, which was to force metadata zeroing when we
do an lvcreate of a blockstore.
parent 50460387
#!/usr/bin/perl -wT #!/usr/bin/perl -wT
# #
# Copyright (c) 2013-2017 University of Utah and the Flux Group. # Copyright (c) 2013-2018 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -1417,18 +1417,20 @@ sub os_create_storage($$) ...@@ -1417,18 +1417,20 @@ sub os_create_storage($$)
# #
else { else {
my $failed = 1; my $failed = 1;
my $fsopts = "-F -q"; my $fsopts;
if ($failed) { if ($failed) {
$fstype = "ext4"; $fstype = "ext4";
$fsopts .= " -E lazy_itable_init=1"; $fsopts = "-F -q -E lazy_itable_init=1,nodiscard";
$failed = mysystem("$MKFS -t $fstype $fsopts $mdev $redir"); $failed = mysystem("$MKFS -t $fstype $fsopts $mdev $redir");
} }
if ($failed) { if ($failed) {
$fstype = "ext3"; $fstype = "ext3";
$fsopts = "-F -q";
$failed = mysystem("$MKFS -t $fstype $fsopts $mdev $redir"); $failed = mysystem("$MKFS -t $fstype $fsopts $mdev $redir");
} }
if ($failed) { if ($failed) {
$fstype = "ext2"; $fstype = "ext2";
$fsopts = "-F -q";
$failed = mysystem("$MKFS -t $fstype $fsopts $mdev $redir"); $failed = mysystem("$MKFS -t $fstype $fsopts $mdev $redir");
} }
if ($failed) { if ($failed) {
...@@ -1757,15 +1759,14 @@ sub os_create_storage_slice($$$) ...@@ -1757,15 +1759,14 @@ sub os_create_storage_slice($$$)
# try a striped LV first # try a striped LV first
my $pvs = $so->{'LVM_VGDEVS'}; my $pvs = $so->{'LVM_VGDEVS'};
if (defined($pvs) && $pvs > 1 && if (defined($pvs) && $pvs > 1 &&
!mysystem("lvcreate -i $pvs -n $lv -L ${lvsize}m $VGNAME $redir")) { !mysystem("lvcreate -Zy --yes -i $pvs -n $lv -L ${lvsize}m $VGNAME $redir")) {
$href->{'LVDEV'} = "/dev/$VGNAME/$lv"; $href->{'LVDEV'} = "/dev/$VGNAME/$lv";
return 1; return 1;
} }
if (mysystem("lvcreate -n $lv -L ${lvsize}m $VGNAME $redir")) { if (mysystem("lvcreate -Zy --yes -n $lv -L ${lvsize}m $VGNAME $redir")) {
warn("*** $lv: could not create LV$logmsg\n"); warn("*** $lv: could not create LV$logmsg\n");
return 0; return 0;
} }
$mdev = "$VGNAME/$lv"; $mdev = "$VGNAME/$lv";
} }
...@@ -2006,7 +2007,18 @@ sub os_remove_storage_slice($$$) ...@@ -2006,7 +2007,18 @@ sub os_remove_storage_slice($$$)
# #
# lvremove -f emulab/h2d2 # lvremove -f emulab/h2d2
# #
if (mysystem("lvremove -f $VGNAME/$lv $redir")) { my $rmopts = "";
#
# XXX this significantly speeds the lvremove, which otherwise will
# be causing erase operations on the device, but it also causes a
# lot of stale metadata to get left behind which can affect
# recreation of the device. For now we opt to slow the less common
# remove operation.
#
$rmopts .= "--config devices/issue_discards=0";
if (mysystem("lvremove $rmopts -f $VGNAME/$lv $redir")) {
warn("*** $lv: could not destroy$logmsg\n"); warn("*** $lv: could not destroy$logmsg\n");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment