sunvdc: fix module unload/reload
authorDwight Engen <dwight.engen@oracle.com>
Thu, 11 Dec 2014 17:25:42 +0000 (12:25 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 12 Dec 2014 02:51:57 +0000 (18:51 -0800)
Free resources allocated during port/disk probing so that the module may be
successfully reloaded after unloading.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/block/sunvdc.c

index 0ebadf9..089ff90 100644 (file)
@@ -896,8 +896,19 @@ static int vdc_port_remove(struct vio_dev *vdev)
        struct vdc_port *port = dev_get_drvdata(&vdev->dev);
 
        if (port) {
+               unsigned long flags;
+
+               spin_lock_irqsave(&port->vio.lock, flags);
+               blk_stop_queue(port->disk->queue);
+               spin_unlock_irqrestore(&port->vio.lock, flags);
+
                del_timer_sync(&port->vio.timer);
 
+               del_gendisk(port->disk);
+               blk_cleanup_queue(port->disk->queue);
+               put_disk(port->disk);
+               port->disk = NULL;
+
                vdc_free_tx_ring(port);
                vio_ldc_free(&port->vio);