Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


More cleanup to avoid possible race
Peter Dinda [Thu, 10 Nov 2011 23:38:58 +0000 (17:38 -0600)]
linux_module/iface-packet.c

index 3acb4bf..9df66bd 100644 (file)
@@ -249,10 +249,11 @@ palacios_packet_connect(struct v3_packet * packet,
     unsigned long flags;
     
     spin_lock_irqsave(&(packet_state.lock), flags);
-    
     iface = find_interface(host_nic);
+    spin_unlock_irqrestore(&(packet_state.lock),flags);
+
     if(iface == NULL){
-       iface = (struct raw_interface *)kmalloc(sizeof(struct raw_interface), GFP_ATOMIC);
+       iface = (struct raw_interface *)kmalloc(sizeof(struct raw_interface), GFP_KERNEL);
        if (!iface) { 
            printk("Palacios Packet Interface: Fails to allocate interface\n");
            return -1;
@@ -260,16 +261,13 @@ palacios_packet_connect(struct v3_packet * packet,
        if(init_raw_interface(iface, host_nic) != 0) {
            printk("Palacios Packet Interface: Fails to initiate an raw interface on device %s\n", host_nic);
            kfree(iface);
-           spin_unlock_irqrestore(&(packet_state.lock), flags);
-           
            return -1;
        }
-       
+       spin_lock_irqsave(&(packet_state.lock), flags); 
        list_add(&(iface->node), &(packet_state.open_interfaces));
+       spin_unlock_irqrestore(&(packet_state.lock),flags);
     }
     
-    spin_unlock_irqrestore(&(packet_state.lock), flags);
-    
     packet->host_packet_data = iface;
     
     list_add(&(packet->node), &(iface->brdcast_recvers));