[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Free grant reference when block device shuts down.



# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 85aca042b8028604c1626816999bb8b5919e8faf
# Parent  4594827336ad98a35cb68bdb20b793c0efcb6c77
Free grant reference when block device shuts down.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 4594827336ad -r 85aca042b802 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Mon Sep  5 
08:22:21 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Mon Sep  5 
08:23:05 2005
@@ -58,6 +58,7 @@
 #define MAXIMUM_OUTSTANDING_BLOCK_REQS \
     (BLKIF_MAX_SEGMENTS_PER_REQUEST * BLKIF_RING_SIZE)
 #define GRANTREF_INVALID (1<<15)
+#define GRANT_INVALID_REF      (0xFFFF)
 
 static int recovery = 0; /* Recovery in progress: protected by blkif_io_lock */
 
@@ -368,6 +369,9 @@
                free_page((unsigned long)info->ring.sring);
                info->ring.sring = NULL;
        }
+       if (info->ring_ref != GRANT_INVALID_REF)
+               gnttab_end_foreign_access(info->ring_ref, 0);
+       info->ring_ref = GRANT_INVALID_REF;
        unbind_evtchn_from_irqhandler(info->evtchn, info); 
        info->evtchn = 0;
 }
@@ -502,6 +506,8 @@
        evtchn_op_t op = { .cmd = EVTCHNOP_alloc_unbound };
        int err;
 
+       info->ring_ref = GRANT_INVALID_REF;
+
        sring = (void *)__get_free_page(GFP_KERNEL);
        if (!sring) {
                xenbus_dev_error(dev, -ENOMEM, "allocating shared ring");
@@ -524,6 +530,7 @@
        err = HYPERVISOR_event_channel_op(&op);
        if (err) {
                gnttab_end_foreign_access(info->ring_ref, 0);
+               info->ring_ref = GRANT_INVALID_REF;
                free_page((unsigned long)info->ring.sring);
                info->ring.sring = 0;
                xenbus_dev_error(dev, err, "allocating event channel");

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.