View | Details | Raw Unified | Return to bug 589788
Collapse All | Expand All

(-)11.2-2010-04-22.orig/drivers/xen/blktap/blktap.c (-4 / +18 lines)
Lines 548-553 void signal_tapdisk(int idx) Link Here
548
{
548
{
549
	tap_blkif_t *info;
549
	tap_blkif_t *info;
550
	struct task_struct *ptask;
550
	struct task_struct *ptask;
551
	struct mm_struct *mm;
551
552
552
	/*
553
	/*
553
	 * if the userland tools set things up wrong, this could be negative;
554
	 * if the userland tools set things up wrong, this could be negative;
Lines 567-573 void signal_tapdisk(int idx) Link Here
567
	}
568
	}
568
	info->blkif = NULL;
569
	info->blkif = NULL;
569
570
570
	return;
571
	mm = xchg(&info->mm, NULL);
572
	if (mm)
573
		mmput(mm);
571
}
574
}
572
575
573
static int blktap_open(struct inode *inode, struct file *filp)
576
static int blktap_open(struct inode *inode, struct file *filp)
Lines 632-637 static int blktap_open(struct inode *ino Link Here
632
static int blktap_release(struct inode *inode, struct file *filp)
635
static int blktap_release(struct inode *inode, struct file *filp)
633
{
636
{
634
	tap_blkif_t *info = filp->private_data;
637
	tap_blkif_t *info = filp->private_data;
638
	struct mm_struct *mm;
635
	
639
	
636
	/* check for control device */
640
	/* check for control device */
637
	if (!info)
641
	if (!info)
Lines 640-647 static int blktap_release(struct inode * Link Here
640
	info->ring_ok = 0;
644
	info->ring_ok = 0;
641
	smp_wmb();
645
	smp_wmb();
642
646
643
	mmput(info->mm);
647
	mm = xchg(&info->mm, NULL);
644
	info->mm = NULL;
648
	if (mm)
649
		mmput(mm);
645
	kfree(info->foreign_map.map);
650
	kfree(info->foreign_map.map);
646
	info->foreign_map.map = NULL;
651
	info->foreign_map.map = NULL;
647
652
Lines 1083-1089 static void fast_flush_area(pending_req_ Link Here
1083
				>> PAGE_SHIFT, INVALID_P2M_ENTRY);
1088
				>> PAGE_SHIFT, INVALID_P2M_ENTRY);
1084
		}
1089
		}
1085
1090
1086
		if (khandle->user != INVALID_GRANT_HANDLE) {
1091
		if (mm != NULL && khandle->user != INVALID_GRANT_HANDLE) {
1087
			BUG_ON(xen_feature(XENFEAT_auto_translated_physmap));
1092
			BUG_ON(xen_feature(XENFEAT_auto_translated_physmap));
1088
			if (!locked++)
1093
			if (!locked++)
1089
				down_write(&mm->mmap_sem);
1094
				down_write(&mm->mmap_sem);
Lines 1140-1145 static void print_stats(blkif_t *blkif) Link Here
1140
int tap_blkif_schedule(void *arg)
1145
int tap_blkif_schedule(void *arg)
1141
{
1146
{
1142
	blkif_t *blkif = arg;
1147
	blkif_t *blkif = arg;
1148
	tap_blkif_t *info;
1143
1149
1144
	blkif_get(blkif);
1150
	blkif_get(blkif);
1145
1151
Lines 1173-1180 int tap_blkif_schedule(void *arg) Link Here
1173
		printk(KERN_DEBUG "%s: exiting\n", current->comm);
1179
		printk(KERN_DEBUG "%s: exiting\n", current->comm);
1174
1180
1175
	blkif->xenblkd = NULL;
1181
	blkif->xenblkd = NULL;
1182
	info = tapfds[blkif->dev_num];
1176
	blkif_put(blkif);
1183
	blkif_put(blkif);
1177
1184
1185
	if (info) {
1186
		struct mm_struct *mm = xchg(&info->mm, NULL);
1187
1188
		if (mm)
1189
			mmput(mm);
1190
	}
1191
1178
	return 0;
1192
	return 0;
1179
}
1193
}
1180
1194

Return to bug 589788