diff mbox

sunvdc: fix module unload/reload

Message ID 1418318742-16406-1-git-send-email-dwight.engen@oracle.com
State Accepted
Delegated to: David Miller
Headers show

Commit Message

Dwight Engen Dec. 11, 2014, 5:25 p.m. UTC
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>
---
 drivers/block/sunvdc.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

Comments

David Miller Dec. 12, 2014, 2:53 a.m. UTC | #1
From: Dwight Engen <dwight.engen@oracle.com>
Date: Thu, 11 Dec 2014 12:25:42 -0500

> 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>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index 0ebadf9..089ff90 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -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);