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

[Xen-changelog] [linux-2.6.18-xen] blktap: Fix Reconnect demand by Frontend



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1220969609 -3600
# Node ID 035670ec617ca7cffce3d00c8d4b5c109a2eef06
# Parent  e86f9e05144afb5d122f264494881408fb225cdb
blktap: Fix Reconnect demand by Frontend

Signed-off-by: Tomonari Horikoshi <t.horikoshi@xxxxxxxxxxxxxx>
---
 drivers/xen/blktap/common.h    |    1 +
 drivers/xen/blktap/interface.c |    7 +++++++
 drivers/xen/blktap/xenbus.c    |    2 ++
 3 files changed, 10 insertions(+)

diff -r e86f9e05144a -r 035670ec617c drivers/xen/blktap/common.h
--- a/drivers/xen/blktap/common.h       Mon Sep 08 14:02:13 2008 +0100
+++ b/drivers/xen/blktap/common.h       Tue Sep 09 15:13:29 2008 +0100
@@ -89,6 +89,7 @@ typedef struct blkif_st {
 
 blkif_t *tap_alloc_blkif(domid_t domid);
 void tap_blkif_free(blkif_t *blkif);
+void tap_blkif_kmem_cache_free(blkif_t *blkif);
 int tap_blkif_map(blkif_t *blkif, unsigned long shared_page, 
                  unsigned int evtchn);
 void tap_blkif_unmap(blkif_t *blkif);
diff -r e86f9e05144a -r 035670ec617c drivers/xen/blktap/interface.c
--- a/drivers/xen/blktap/interface.c    Mon Sep 08 14:02:13 2008 +0100
+++ b/drivers/xen/blktap/interface.c    Tue Sep 09 15:13:29 2008 +0100
@@ -162,8 +162,15 @@ void tap_blkif_free(blkif_t *blkif)
 {
        atomic_dec(&blkif->refcnt);
        wait_event(blkif->waiting_to_free, atomic_read(&blkif->refcnt) == 0);
+       atomic_inc(&blkif->refcnt);
 
        tap_blkif_unmap(blkif);
+}
+
+void tap_blkif_kmem_cache_free(blkif_t *blkif)
+{
+       if (!atomic_dec_and_test(&blkif->refcnt))
+               BUG();
        kmem_cache_free(blkif_cachep, blkif);
 }
 
diff -r e86f9e05144a -r 035670ec617c drivers/xen/blktap/xenbus.c
--- a/drivers/xen/blktap/xenbus.c       Mon Sep 08 14:02:13 2008 +0100
+++ b/drivers/xen/blktap/xenbus.c       Tue Sep 09 15:13:29 2008 +0100
@@ -182,6 +182,7 @@ static int blktap_remove(struct xenbus_d
                        kthread_stop(be->blkif->xenblkd);
                signal_tapdisk(be->blkif->dev_num);
                tap_blkif_free(be->blkif);
+               tap_blkif_kmem_cache_free(be->blkif);
                be->blkif = NULL;
        }
        kfree(be);
@@ -364,6 +365,7 @@ static void tap_frontend_changed(struct 
                        kthread_stop(be->blkif->xenblkd);
                        be->blkif->xenblkd = NULL;
                }
+               tap_blkif_free(be->blkif);
                xenbus_switch_state(dev, XenbusStateClosing);
                break;
 

_______________________________________________
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®.