rpms/kernel/devel linux-2.6-xen-blktap-cleanup.patch, NONE, 1.1 linux-2.6-xen-blktap-dynamic-major.patch, NONE, 1.1 linux-2.6-xen-blktap-fixes.patch, NONE, 1.1 linux-2.6-xen-blktap-sysfs.patch, NONE, 1.1 kernel-2.6.spec, 1.2718, 1.2719

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Sep 28 23:17:53 UTC 2006


Author: sct

Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv31624

Modified Files:
	kernel-2.6.spec 
Added Files:
	linux-2.6-xen-blktap-cleanup.patch 
	linux-2.6-xen-blktap-dynamic-major.patch 
	linux-2.6-xen-blktap-fixes.patch 
	linux-2.6-xen-blktap-sysfs.patch 
Log Message:
Xen blktap updates:
- Fix Xen blktap oops on domain exit
- Add support for dynamic blktap device nodes (srostedt)
- Add Xen blktap driver fixes; make it build properly as a module.
- Reenable blktap on ia64


linux-2.6-xen-blktap-cleanup.patch:
 blktapmain.c |  121 +++++++++++++++++++++++------------------------------------
 1 files changed, 49 insertions(+), 72 deletions(-)

--- NEW FILE linux-2.6-xen-blktap-cleanup.patch ---
Index: linux-2.6.18.noarch/drivers/xen/blktap/blktapmain.c
===================================================================
--- linux-2.6.18.noarch/drivers/xen/blktap/blktapmain.c.orig
+++ linux-2.6.18.noarch/drivers/xen/blktap/blktapmain.c
@@ -101,18 +101,12 @@ typedef struct tap_blkif {
 	blkif_t *blkif;               /*Associate blkif with tapdev          */
 } tap_blkif_t;
 
-/*Private data struct associated with the inode*/
-typedef struct private_info {
-	int idx;
-} private_info_t;
-
 /*Data struct handed back to userspace for tapdisk device to VBD mapping*/
 typedef struct domid_translate {
 	unsigned short domid;
 	unsigned short busid;
 } domid_translate_t ;
 
-
 static domid_translate_t  translate_domid[MAX_TAP_DEV];
 static tap_blkif_t *tapfds[MAX_TAP_DEV];
 
@@ -199,7 +193,7 @@ static struct grant_handle_pair 
     + (_i)])
 
 
-static int blktap_read_ufe_ring(int idx); /*local prototypes*/
+static int blktap_read_ufe_ring(tap_blkif_t *info); /*local prototypes*/
 
 #define BLKTAP_MINOR 0  /*/dev/xen/blktap resides at device number
 			  major=254, minor numbers begin at 0            */ 
@@ -263,7 +257,8 @@ static inline int GET_NEXT_REQ(unsigned 
 {
 	int i;
 	for (i = 0; i < MAX_PENDING_REQS; i++)
-		if (idx_map[i] == INVALID_REQ) return i;
+		if (idx_map[i] == INVALID_REQ)
+			return i;
 
 	return INVALID_REQ;
 }
@@ -368,9 +363,8 @@ void signal_tapdisk(int idx) 
 	info = tapfds[idx];
 	if ( (idx > 0) && (idx < MAX_TAP_DEV) && (info->pid > 0) ) {
 		ptask = find_task_by_pid(info->pid);
-		if (ptask) { 
+		if (ptask)
 			info->status = CLEANSHUTDOWN;
- 		}
 	}
 	info->blkif = NULL;
 	return;
@@ -381,7 +375,6 @@ static int blktap_open(struct inode *ino
 	blkif_sring_t *sring;
 	int idx = iminor(inode) - BLKTAP_MINOR;
 	tap_blkif_t *info;
-	private_info_t *prv;
 	int i;
 	
 	if (tapfds[idx] == NULL) {
@@ -409,9 +402,7 @@ static int blktap_open(struct inode *ino
 	SHARED_RING_INIT(sring);
 	FRONT_RING_INIT(&info->ufe_ring, sring, PAGE_SIZE);
 	
-	prv = kzalloc(sizeof(private_info_t),GFP_KERNEL);
-	prv->idx = idx;
-	filp->private_data = prv;
+	filp->private_data = info;
 	info->vma = NULL;
 
 	info->idx_map = kmalloc(sizeof(unsigned long) * MAX_PENDING_REQS, 
@@ -432,17 +423,16 @@ static int blktap_open(struct inode *ino
 
 static int blktap_release(struct inode *inode, struct file *filp)
 {
-	int idx = iminor(inode) - BLKTAP_MINOR;
-	tap_blkif_t *info;
+	tap_blkif_t *info = filp->private_data;
 	
-	if (tapfds[idx] == NULL) {
+	/* can this ever happen? - sdr */
+	if (!info) {
 		WPRINTK("Trying to free device that doesn't exist "
-		       "[/dev/xen/blktap%d]\n",idx);
+		       "[/dev/xen/blktap%d]\n",iminor(inode) - BLKTAP_MINOR);
 		return -1;
 	}
-	info = tapfds[idx];
 	info->dev_inuse = 0;
-	DPRINTK("Freeing device [/dev/xen/blktap%d]\n",idx);
+	DPRINTK("Freeing device [/dev/xen/blktap%d]\n",info->minor);
 
 	/* Free the ring page. */
 	ClearPageReserved(virt_to_page(info->ufe_ring.sring));
@@ -456,8 +446,6 @@ static int blktap_release(struct inode *
 		info->vma = NULL;
 	}
 	
-	if (filp->private_data) kfree(filp->private_data);
-
 	if ( (info->status != CLEANSHUTDOWN) && (info->blkif != NULL) ) {
 		kthread_stop(info->blkif->xenblkd);
 		info->blkif->xenblkd = NULL;
@@ -490,16 +478,12 @@ static int blktap_mmap(struct file *filp
 	int size;
 	struct page **map;
 	int i;
-	private_info_t *prv;
-	tap_blkif_t *info;
+	tap_blkif_t *info = filp->private_data;
 
-	/*Retrieve the dev info*/
-	prv = (private_info_t *)filp->private_data;
-	if (prv == NULL) {
+	if (info == NULL) {
 		WPRINTK("blktap: mmap, retrieving idx failed\n");
 		return -ENOMEM;
 	}
-	info = tapfds[prv->idx];
 	
 	vma->vm_flags |= VM_RESERVED;
 	vma->vm_ops = &blktap_vm_ops;
@@ -555,20 +539,17 @@ static int blktap_mmap(struct file *filp
 static int blktap_ioctl(struct inode *inode, struct file *filp,
                         unsigned int cmd, unsigned long arg)
 {
-	int idx = iminor(inode) - BLKTAP_MINOR;
+	tap_blkif_t *info = filp->private_data;
+
 	switch(cmd) {
 	case BLKTAP_IOCTL_KICK_FE: 
 	{
 		/* There are fe messages to process. */
-		return blktap_read_ufe_ring(idx);
+		return blktap_read_ufe_ring(info);
 	}
 	case BLKTAP_IOCTL_SETMODE:
 	{
-		tap_blkif_t *info = tapfds[idx];
-		
-		if ( (idx > 0) && (idx < MAX_TAP_DEV) 
-		     && (tapfds[idx] != NULL) ) 
-		{
+		if (info) {
 			if (BLKTAP_MODE_VALID(arg)) {
 				info->mode = arg;
 				/* XXX: may need to flush rings here. */
@@ -581,11 +562,7 @@ static int blktap_ioctl(struct inode *in
 	}
 	case BLKTAP_IOCTL_PRINT_IDXS:
         {
-		tap_blkif_t *info = tapfds[idx];
-		
-		if ( (idx > 0) && (idx < MAX_TAP_DEV) 
-		     && (tapfds[idx] != NULL) ) 
-		{
+		if (info) {
 			printk("User Rings: \n-----------\n");
 			printk("UF: rsp_cons: %2d, req_prod_prv: %2d "
 				"| req_prod: %2d, rsp_prod: %2d\n",
@@ -598,11 +575,7 @@ static int blktap_ioctl(struct inode *in
         }
 	case BLKTAP_IOCTL_SENDPID:
 	{
-		tap_blkif_t *info = tapfds[idx];
-		
-		if ( (idx > 0) && (idx < MAX_TAP_DEV) 
-		     && (tapfds[idx] != NULL) ) 
-		{
+		if (info) {
 			info->pid = (pid_t)arg;
 			DPRINTK("blktap: pid received %d\n", 
 			       info->pid);
@@ -630,9 +603,12 @@ static int blktap_ioctl(struct inode *in
 	case BLKTAP_IOCTL_FREEINTF:
 	{
 		unsigned long dev = arg;
-		tap_blkif_t *info = NULL;
 
-		if ( (dev > 0) && (dev < MAX_TAP_DEV) ) info = tapfds[dev];
+		/* Looking at another device */
+		info = NULL;
+
+		if ( (dev > 0) && (dev < MAX_TAP_DEV) )
+			info = tapfds[dev];
 
 		if ( (info != NULL) && (info->dev_pending) )
 			info->dev_pending = 0;
@@ -641,12 +617,17 @@ static int blktap_ioctl(struct inode *in
 	case BLKTAP_IOCTL_MINOR:
 	{
 		unsigned long dev = arg;
-		tap_blkif_t *info = NULL;
+
+		/* Looking at another device */
+		info = NULL;
 		
-		if ( (dev > 0) && (dev < MAX_TAP_DEV) ) info = tapfds[dev];
+		if ( (dev > 0) && (dev < MAX_TAP_DEV) )
+			info = tapfds[dev];
 		
-		if (info != NULL) return info->minor;
-		else return -1;
+		if (info != NULL)
+			return info->minor;
+		else
+			return -1;
 	}
 	case BLKTAP_IOCTL_MAJOR:
 		return BLKTAP_DEV_MAJOR;
@@ -661,23 +642,20 @@ static int blktap_ioctl(struct inode *in
 	return -ENOIOCTLCMD;
 }
 
-static unsigned int blktap_poll(struct file *file, poll_table *wait)
+static unsigned int blktap_poll(struct file *filp, poll_table *wait)
 {
-	private_info_t *prv;
-	tap_blkif_t *info;
+	tap_blkif_t *info = filp->private_data;
 	
-	/*Retrieve the dev info*/
-	prv = (private_info_t *)file->private_data;
-	if (prv == NULL) {
+	if (!info) {
 		WPRINTK(" poll, retrieving idx failed\n");
 		return 0;
 	}
-	
-	if (prv->idx == 0) return 0;
-	
-	info = tapfds[prv->idx];
-	
-	poll_wait(file, &info->wait, wait);
+
+	/* do not work on the control device */
+	if (!info->minor)
+		return 0;
+
+	poll_wait(filp, &info->wait, wait);
 	if (info->ufe_ring.req_prod_pvt != info->ufe_ring.sring->req_prod) {
 		mb();
 		RING_PUSH_REQUESTS(&info->ufe_ring);
@@ -690,11 +668,14 @@ void blktap_kick_user(int idx)
 {
 	tap_blkif_t *info;
 
-	if (idx == 0) return;
+	if (idx == 0)
+		return;
 	
 	info = tapfds[idx];
 	
-	if (info != NULL) wake_up_interruptible(&info->wait);
+	if (info != NULL)
+		wake_up_interruptible(&info->wait);
+
 	return;
 }
 
@@ -712,7 +693,6 @@ static int req_increase(void)
 {
 	int i, j;
 	struct page *page;
-	unsigned long flags;
 	int ret;
 
 	ret = -EINVAL;
@@ -1001,7 +982,7 @@ int tap_blkif_schedule(void *arg)
  * COMPLETION CALLBACK -- Called by user level ioctl()
  */
 
-static int blktap_read_ufe_ring(int idx)
+static int blktap_read_ufe_ring(tap_blkif_t *info)
 {
 	/* This is called to read responses from the UFE ring. */
 	RING_IDX i, j, rp;
@@ -1009,12 +990,9 @@ static int blktap_read_ufe_ring(int idx)
 	blkif_t *blkif=NULL;
 	int pending_idx, usr_idx, mmap_idx;
 	pending_req_t *pending_req;
-	tap_blkif_t *info;
 	
-	info = tapfds[idx];
-	if (info == NULL) {
+	if (!info)
 		return 0;
-	}
 
 	/* We currently only forward packets in INTERCEPT_FE mode. */
 	if (!(info->mode & BLKTAP_MODE_INTERCEPT_FE))
@@ -1062,7 +1040,7 @@ static int blktap_read_ufe_ring(int idx)
 				>> PAGE_SHIFT;
 			map[offset] = NULL;
 		}
-		fast_flush_area(pending_req, pending_idx, usr_idx, idx);
+		fast_flush_area(pending_req, pending_idx, usr_idx, info->minor);
 		make_response(blkif, pending_req->id, resp->operation,
 			      resp->status);
 		info->idx_map[usr_idx] = INVALID_REQ;

linux-2.6-xen-blktap-dynamic-major.patch:
 blktapmain.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

--- NEW FILE linux-2.6-xen-blktap-dynamic-major.patch ---
Index: linux-2.6.18.noarch/drivers/xen/blktap/blktapmain.c
===================================================================
--- linux-2.6.18.noarch/drivers/xen/blktap/blktapmain.c.orig
+++ linux-2.6.18.noarch/drivers/xen/blktap/blktapmain.c
@@ -195,13 +195,11 @@ static struct grant_handle_pair 
 
 static int blktap_read_ufe_ring(tap_blkif_t *info); /*local prototypes*/
 
-#define BLKTAP_MINOR 0  /*/dev/xen/blktap resides at device number
-			  major=254, minor numbers begin at 0            */ 
-#define BLKTAP_DEV_MAJOR 252         /* TODO: Make major number dynamic  *
-                                      * and create devices in the kernel *
-				      */
+#define BLKTAP_MINOR 0  /*/dev/xen/blktap has a dynamic major */
 #define BLKTAP_DEV_DIR  "/dev/xen"
 
+static int blktap_major;
+
 /* blktap IOCTLs: */
 #define BLKTAP_IOCTL_KICK_FE         1
 #define BLKTAP_IOCTL_KICK_BE         2 /* currently unused */
@@ -630,7 +628,7 @@ static int blktap_ioctl(struct inode *in
 			return -1;
 	}
 	case BLKTAP_IOCTL_MAJOR:
-		return BLKTAP_DEV_MAJOR;
+		return blktap_major;
 
 	case BLKTAP_QUERY_ALLOC_REQS:
 	{
@@ -1393,13 +1391,16 @@ static int __init blkif_init(void)
 	/*Create the blktap devices, but do not map memory or waitqueue*/
 	for(i = 0; i < MAX_TAP_DEV; i++) translate_domid[i].domid = 0xFFFF;
 
-	ret = register_chrdev(BLKTAP_DEV_MAJOR,"blktap",&blktap_fops);
+	/* Dynamically allocate a major for this device */
+	ret = register_chrdev(0, "blktap", &blktap_fops);
 
-	if ( (ret < 0) ) {
+	if (ret < 0) {
 		WPRINTK("Couldn't register /dev/xen/blktap\n");
 		return -ENOMEM;
 	}	
 	
+	blktap_major = ret;
+
 	for(i = 0; i < MAX_TAP_DEV; i++ ) {
 		info = tapfds[i] = kzalloc(sizeof(tap_blkif_t),GFP_KERNEL);
 		if(tapfds[i] == NULL) return -ENOMEM;

linux-2.6-xen-blktap-fixes.patch:
 kernel-2.6.18.blktap/linux-2.6.18.noarch/drivers/xen/blktap/Makefile |    5 +
 linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c                     |   35 ----------
 linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c                     |    1 
 linux-2.6.18.noarch/drivers/xen/blktap/blktap.c                      |    3 
 4 files changed, 6 insertions(+), 38 deletions(-)

--- NEW FILE linux-2.6-xen-blktap-fixes.patch ---
diff --exclude-from=/dev/fd/63 -ur linux-2.6.18.noarch/drivers/xen/blktap/Makefile kernel-2.6.18.blktap/linux-2.6.18.noarch/drivers/xen/blktap/Makefile
--- linux-2.6.18.noarch/drivers/xen/blktap/Makefile	2006-09-25 21:32:06.000000000 +0100
+++ kernel-2.6.18.blktap/linux-2.6.18.noarch/drivers/xen/blktap/Makefile	2006-09-21 20:25:09.000000000 +0100
@@ -1,3 +1,6 @@
 LINUXINCLUDE += -I../xen/include/public/io
-obj-y	:= xenbus.o interface.o blktap.o 
+
+obj-$(CONFIG_XEN_BLKDEV_TAP) := blktap.o
+
+blktap-y	:= xenbus.o interface.o blktapmain.o 
 
diff --exclude-from=/dev/fd/63 -ur linux-2.6.18.noarch/drivers/xen/blktap/blktap.c linux-2.6.18.noarch/drivers/xen/blktap/blktap.c
--- linux-2.6.18.noarch/drivers/xen/blktap/blktap.c	2006-09-25 21:32:06.000000000 +0100
+++ linux-2.6.18.noarch/drivers/xen/blktap/blktap.c	2006-09-25 15:21:29.000000000 +0100
@@ -203,7 +203,7 @@
 
 #define BLKTAP_MINOR 0  /*/dev/xen/blktap resides at device number
 			  major=254, minor numbers begin at 0            */ 
-#define BLKTAP_DEV_MAJOR 254         /* TODO: Make major number dynamic  *
+#define BLKTAP_DEV_MAJOR 252         /* TODO: Make major number dynamic  *
                                       * and create devices in the kernel *
 				      */
 #define BLKTAP_DEV_DIR  "/dev/xen"
@@ -679,7 +679,6 @@
 	
 	poll_wait(file, &info->wait, wait);
 	if (info->ufe_ring.req_prod_pvt != info->ufe_ring.sring->req_prod) {
-		flush_tlb_all();
 		RING_PUSH_REQUESTS(&info->ufe_ring);
 		return POLLIN | POLLRDNORM;
 	}
diff -r bd811e94d293 -r ed51caee4fe6 linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c
--- linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c	Tue Sep 26 19:50:07 2006 +0100
+++ linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c	Thu Sep 28 15:38:25 2006 +0100
@@ -273,7 +273,6 @@ static void tap_frontend_changed(struct 
 			kthread_stop(be->blkif->xenblkd);
 			be->blkif->xenblkd = NULL;
 		}
-		tap_blkif_unmap(be->blkif);
 		xenbus_switch_state(dev, XenbusStateClosing);
 		break;
 
diff -r ed51caee4fe6 linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c
--- linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c	Thu Sep 28 15:38:25 2006 +0100
+++ linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c	Thu Sep 28 16:44:27 2006 +0100
@@ -716,8 +716,6 @@ static int req_increase(void)
 	unsigned long flags;
 	int ret;
 
-	spin_lock_irqsave(&pending_free_lock, flags);
-
 	ret = -EINVAL;
 	if (mmap_alloc >= MAX_PENDING_REQS || mmap_lock) 
 		goto done;
@@ -782,8 +780,7 @@ static int req_increase(void)
 
 	mmap_alloc++;
 	DPRINTK("# MMAPs increased to %d\n",mmap_alloc);
- done:
-	spin_unlock_irqrestore(&pending_free_lock, flags);
+done:
 	return ret;
 }
 
@@ -811,36 +808,6 @@ static void mmap_req_del(int mmap)
 	mmap_lock = 0;
 	DPRINTK("# MMAPs decreased to %d\n",mmap_alloc);
 	mmap_alloc--;
-}
-
-/*N.B. Currently unused - will be accessed via sysfs*/
-static void req_decrease(void)
-{
-	pending_req_t *req;
-	int i;
-	unsigned long flags;
-
-	spin_lock_irqsave(&pending_free_lock, flags);
-
-	DPRINTK("Req decrease called.\n");
-	if (mmap_lock || mmap_alloc == 1) 
-		goto done;
-
-	mmap_lock = 1;
-	mmap_inuse = MAX_PENDING_REQS;
-	
-        /*Go through reqs and remove any that aren't in use*/
-	for (i = 0; i < MAX_PENDING_REQS ; i++) {
-		req = &pending_reqs[mmap_alloc-1][i];
-		if (req->inuse == 0) {
-			list_del(&req->free_list);
-			mmap_inuse--;
-		}
-	}
-	if (mmap_inuse == 0) mmap_req_del(mmap_alloc-1);
- done:
-	spin_unlock_irqrestore(&pending_free_lock, flags);
-	return;
 }
 
 static pending_req_t* alloc_req(void)

linux-2.6-xen-blktap-sysfs.patch:
 blktapmain.c |   67 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 60 insertions(+), 7 deletions(-)

--- NEW FILE linux-2.6-xen-blktap-sysfs.patch ---
--- linux-2.6.18.noarch/drivers/xen/blktap/blktapmain.c.blksysfs	2006-09-28 17:23:02.000000000 +0100
+++ linux-2.6.18.noarch/drivers/xen/blktap/blktapmain.c	2006-09-28 17:26:40.000000000 +0100
@@ -44,7 +44,6 @@
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/mm.h>
-#include <linux/miscdevice.h>
 #include <linux/errno.h>
 #include <linux/major.h>
 #include <linux/gfp.h>
@@ -54,6 +53,30 @@
 #define MAX_TAP_DEV 100     /*the maximum number of tapdisk ring devices    */
 #define MAX_DEV_NAME 100    /*the max tapdisk ring device name e.g. blktap0 */
 
+
+struct class *xen_class;
+EXPORT_SYMBOL_GPL(xen_class);
+
+/*
+ * Setup the xen class.  This should probably go in another file, but
+ * since blktap is the only user of it so far, it gets to keep it.
+ */
+int setup_xen_class(void)
+{
+	int ret;
+
+	if (xen_class)
+		return 0;
+
+	xen_class = class_create(THIS_MODULE, "xen");
+	if ((ret = IS_ERR(xen_class))) {
+		xen_class = NULL;
+		return ret;
+	}
+
+	return 0;
+}
+
 /*
  * The maximum number of requests that can be outstanding at any time
  * is determined by 
@@ -99,6 +122,7 @@
 	unsigned long *idx_map;       /*Record the user ring id to kern 
 					[req id, idx] tuple                  */
 	blkif_t *blkif;               /*Associate blkif with tapdev          */
+	int sysfs_set;                /*Set if it has a class device.        */
 } tap_blkif_t;
 
 /*Data struct handed back to userspace for tapdisk device to VBD mapping*/
@@ -303,8 +327,6 @@
                         unsigned int cmd, unsigned long arg);
 static unsigned int blktap_poll(struct file *file, poll_table *wait);
 
-struct miscdevice *set_misc(int minor, char *name, int dev);
-
 static struct file_operations blktap_fops = {
 	.owner   = THIS_MODULE,
 	.poll    = blktap_poll,
@@ -336,6 +358,16 @@
 	
 done:
 	spin_unlock_irqrestore(&pending_free_lock, flags);
+
+	/*
+	 * We are protected by having the dev_pending set.
+	 */
+	if (!tapfds[i]->sysfs_set && xen_class) {
+		class_device_create(xen_class, NULL,
+				    MKDEV(blktap_major, ret), NULL,
+				    "blktap%d", ret);
+		tapfds[i]->sysfs_set = 1;
+	}
 	return ret;
 }
 
@@ -427,7 +459,7 @@
 	if (!info) {
 		WPRINTK("Trying to free device that doesn't exist "
 		       "[/dev/xen/blktap%d]\n",iminor(inode) - BLKTAP_MINOR);
-		return -1;
+		return -EBADF;
 	}
 	info->dev_inuse = 0;
 	DPRINTK("Freeing device [/dev/xen/blktap%d]\n",info->minor);
@@ -601,6 +633,7 @@
 	case BLKTAP_IOCTL_FREEINTF:
 	{
 		unsigned long dev = arg;
+		unsigned long flags;
 
 		/* Looking at another device */
 		info = NULL;
@@ -608,8 +641,11 @@
 		if ( (dev > 0) && (dev < MAX_TAP_DEV) )
 			info = tapfds[dev];
 
+		spin_lock_irqsave(&pending_free_lock, flags);
 		if ( (info != NULL) && (info->dev_pending) )
 			info->dev_pending = 0;
+		spin_unlock_irqrestore(&pending_free_lock, flags);
+
 		return 0;
 	}
 	case BLKTAP_IOCTL_MINOR:
@@ -1368,16 +1404,33 @@
 
 	for(i = 0; i < MAX_TAP_DEV; i++ ) {
 		info = tapfds[i] = kzalloc(sizeof(tap_blkif_t),GFP_KERNEL);
-		if(tapfds[i] == NULL) return -ENOMEM;
+		if(tapfds[i] == NULL)
+			return -ENOMEM;
 		info->minor = i;
 		info->pid = 0;
 		info->blkif = NULL;
 
 		info->dev_pending = info->dev_inuse = 0;
-
-		DPRINTK("Created misc_dev [/dev/xen/blktap%d]\n",i);
 	}
 	
+	/* Make sure the xen class exists */
+	if (!setup_xen_class()) {
+		/*
+		 * This will allow udev to create the blktap ctrl device.
+		 * We only want to create blktap0 first.  We don't want
+		 * to flood the sysfs system with needless blktap devices.
+		 * We only create the device when a request of a new device is
+		 * made.
+		 */
+		class_device_create(xen_class, NULL,
+				    MKDEV(blktap_major, 0), NULL,
+				    "blktap0");
+		tapfds[0]->sysfs_set = 1;
+	} else {
+		/* this is bad, but not fatal */
+		WPRINTK("blktap: sysfs xen_class not created\n");
+	}
+
 	DPRINTK("Blktap device successfully created\n");
 
 	return 0;


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.2718
retrieving revision 1.2719
diff -u -r1.2718 -r1.2719
--- kernel-2.6.spec	28 Sep 2006 22:12:16 -0000	1.2718
+++ kernel-2.6.spec	28 Sep 2006 23:17:50 -0000	1.2719
@@ -378,6 +378,10 @@
 Patch956: linux-2.6-xen-execshield-lazy-exec-limit.patch
 Patch957: linux-2.6-xen-x86-relocatable.patch
 Patch958: linux-2.6-ia64-kexec-kdump-xen-conflict.patch
+Patch960: linux-2.6-xen-blktap-fixes.patch
+Patch961: linux-2.6-xen-blktap-cleanup.patch
+Patch962: linux-2.6-xen-blktap-dynamic-major.patch
+Patch963: linux-2.6-xen-blktap-sysfs.patch
 Patch990: linux-2.6-xen-pvfb.patch
 
 #
@@ -912,7 +916,7 @@
 # Delete the rest of the backup files, they just confuse the build later
 find -name "*.p.xen" | xargs rm -f
 
-# utrace
+# Xen utrace
 %patch951 -p1
 %patch952 -p1
 %patch953 -p1
@@ -923,6 +927,15 @@
 # ia64 xen cleanups for kexec/kdump
 %patch958 -p1
 
+# xen blktap fixes
+%patch960 -p1
+# The blktap patch needs to rename a file.  For now, that is far more easily
+# done in the spec file than in the patch itself.
+mv drivers/xen/blktap/blktap.c drivers/xen/blktap/blktapmain.c
+%patch961 -p1
+%patch962 -p1
+%patch963 -p1
+
 # xen framebuffer patches
 %patch990 -p1
 
@@ -1939,6 +1952,12 @@
 %endif
 
 %changelog
+* Thu Sep 28 2006 Stephen C. Tweedie <sct at redhat.com>
+- Fix Xen blktap oops on domain exit
+- Add support for dynamic blktap device nodes (srostedt)
+- Add Xen blktap driver fixes; make it build properly as a module.
+- Reenable blktap on ia64
+
 * Thu Sep 28 2006 Roland McGrath <roland at redhat.com>
 - utrace typo fix for x86-64 watchpoints (#207467)
 




More information about the fedora-cvs-commits mailing list