Skip to contentSkip to conversation

sunvdc: fix module unload/reload

PATCH Applied Dwight Engen 2 participants 2 messages Dec 11, 2014 – Dec 12, 2014 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunvdc: fix module unload/reload

Free resources allocated during port/disk probing so that the module may be successfully reloaded after unloading.

---
 drivers/block/sunvdc.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
drivers/block/sunvdc.c +11 -0
index 0ebadf9..089ff90 100644
@@ -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);
 
Signature · 1 line
1.7.1