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

[Xen-changelog] [linux-2.6.18-xen] blktap: fix cleanup after unclean application exit #2



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1271925346 -3600
# Node ID 2a4b455b1fbab6405d06f446484d9fe9b20be619
# Parent  347237fd42d855bb301159c85e9f962d8521a21f
blktap: fix cleanup after unclean application exit #2

When an application using blktap devices doesn't close the mmap-s of
/dev/xen/blktapN and the frontend driver never connects, we cannot
defer the mmput() on the stored mm until blktap_release() or the exit
path of the worker thread, as the former will never be called without
the mm's reference count dropping to zero, and the worker thread
would never get started.

Also remove a left-over from c/s 1013.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 drivers/xen/blktap/blktap.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff -r 347237fd42d8 -r 2a4b455b1fba drivers/xen/blktap/blktap.c
--- a/drivers/xen/blktap/blktap.c       Mon Apr 19 17:19:56 2010 +0100
+++ b/drivers/xen/blktap/blktap.c       Thu Apr 22 09:35:46 2010 +0100
@@ -553,6 +553,7 @@ void signal_tapdisk(int idx)
 {
        tap_blkif_t *info;
        struct task_struct *ptask;
+       struct mm_struct *mm;
 
        /*
         * if the userland tools set things up wrong, this could be negative;
@@ -572,7 +573,9 @@ void signal_tapdisk(int idx)
        }
        info->blkif = NULL;
 
-       return;
+       mm = xchg(&info->mm, NULL);
+       if (mm)
+               mmput(mm);
 }
 
 static int blktap_open(struct inode *inode, struct file *filp)
@@ -652,7 +655,6 @@ static int blktap_release(struct inode *
        mm = xchg(&info->mm, NULL);
        if (mm)
                mmput(mm);
-       info->mm = NULL;
        kfree(info->foreign_map.map);
        info->foreign_map.map = NULL;
 

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