ip allocation mutex for high-traffic implementations, RT#79825
authorIvan Kohler <ivan@freeside.biz>
Thu, 19 Apr 2018 01:03:07 +0000 (18:03 -0700)
committerIvan Kohler <ivan@freeside.biz>
Thu, 19 Apr 2018 01:03:07 +0000 (18:03 -0700)
FS/FS/IP_Mixin.pm

index beb41d2..3ec7693 100644 (file)
@@ -130,6 +130,10 @@ sub assign_ip_addr {
   my $self = shift;
   my %opt = @_;
 
   my $self = shift;
   my %opt = @_;
 
+  #otherwise we'll get the same assignment for concurrent identical calls
+  # this will serialize them
+  $_->lock_table foreach @subclasses;
+
   my @blocks;
   my $na = $self->NetAddr;
 
   my @blocks;
   my $na = $self->NetAddr;