Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 198351 Details for
Bug 294691
[Xen][5.2] keeping create/destroy causes Dom0 reboots
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Backported patch from upstream to RHEL5
rhel5-xenbus-device.patch (text/plain), 4.14 KB, created by
Flavio Leitner
on 2007-09-18 13:36:14 UTC
(
hide
)
Description:
Backported patch from upstream to RHEL5
Filename:
MIME Type:
Creator:
Flavio Leitner
Created:
2007-09-18 13:36:14 UTC
Size:
4.14 KB
patch
obsolete
>Index: linux-2.6.18.i386/drivers/xen/xenbus/xenbus_dev.c >=================================================================== >--- linux-2.6.18.i386.orig/drivers/xen/xenbus/xenbus_dev.c >+++ linux-2.6.18.i386/drivers/xen/xenbus/xenbus_dev.c >@@ -53,6 +53,13 @@ struct xenbus_dev_transaction { > struct xenbus_transaction handle; > }; > >+struct read_buffer { >+ struct list_head list; >+ unsigned int cons; >+ unsigned int len; >+ char msg[]; >+}; >+ > struct xenbus_dev_data { > /* In-progress transaction. */ > struct list_head transactions; >@@ -68,9 +75,7 @@ struct xenbus_dev_data { > } u; > > /* Response queue. */ >-#define MASK_READ_IDX(idx) ((idx)&(PAGE_SIZE-1)) >- char read_buffer[PAGE_SIZE]; >- unsigned int read_cons, read_prod; >+ struct list_head read_buffers; > wait_queue_head_t read_waitq; > > struct mutex reply_mutex; >@@ -83,35 +88,55 @@ static ssize_t xenbus_dev_read(struct fi > size_t len, loff_t *ppos) > { > struct xenbus_dev_data *u = filp->private_data; >- int i; >+ struct read_buffer *rb; >+ int i, ret; > >- if (wait_event_interruptible(u->read_waitq, >- u->read_prod != u->read_cons)) >- return -EINTR; >- >- for (i = 0; i < len; i++) { >- if (u->read_cons == u->read_prod) >- break; >- put_user(u->read_buffer[MASK_READ_IDX(u->read_cons)], ubuf+i); >- u->read_cons++; >+ mutex_lock(&u->reply_mutex); >+ while (list_empty(&u->read_buffers)) { >+ mutex_unlock(&u->reply_mutex); >+ ret = wait_event_interruptible(u->read_waitq, >+ !list_empty(&u->read_buffers)); >+ if (ret) >+ return ret; >+ mutex_lock(&u->reply_mutex); > } > >+ rb = list_entry(u->read_buffers.next, struct read_buffer, list); >+ for (i = 0; i < len;) { >+ put_user(rb->msg[rb->cons], ubuf + i); >+ i++; >+ rb->cons++; >+ if (rb->cons == rb->len) { >+ list_del(&rb->list); >+ kfree(rb); >+ if (list_empty(&u->read_buffers)) >+ break; >+ rb = list_entry(u->read_buffers.next, >+ struct read_buffer, list); >+ } >+ } >+ mutex_unlock(&u->reply_mutex); >+ > return i; > } > > static void queue_reply(struct xenbus_dev_data *u, > char *data, unsigned int len) > { >- int i; >+ struct read_buffer *rb; > >- mutex_lock(&u->reply_mutex); >+ if (len == 0) >+ return; > >- for (i = 0; i < len; i++, u->read_prod++) >- u->read_buffer[MASK_READ_IDX(u->read_prod)] = data[i]; >+ rb = kmalloc(sizeof(*rb) + len, GFP_KERNEL); >+ BUG_ON(rb == NULL); > >- BUG_ON((u->read_prod - u->read_cons) > sizeof(u->read_buffer)); >+ rb->cons = 0; >+ rb->len = len; > >- mutex_unlock(&u->reply_mutex); >+ memcpy(rb->msg, data, len); >+ >+ list_add_tail(&rb->list, &u->read_buffers); > > wake_up(&u->read_waitq); > } >@@ -150,10 +175,12 @@ static void watch_fired(struct xenbus_wa > > hdr.type = XS_WATCH_EVENT; > hdr.len = body_len; >- >+ >+ mutex_lock(&adap->dev_data->reply_mutex); > queue_reply(adap->dev_data, (char *)&hdr, sizeof(hdr)); > queue_reply(adap->dev_data, (char *)path, path_len); > queue_reply(adap->dev_data, (char *)token, tok_len); >+ mutex_unlock(&adap->dev_data->reply_mutex); > } > > static LIST_HEAD(watch_list); >@@ -217,8 +244,10 @@ static ssize_t xenbus_dev_write(struct f > list_del(&trans->list); > kfree(trans); > } >+ mutex_lock(&u->reply_mutex); > queue_reply(u, (char *)&u->u.msg, sizeof(u->u.msg)); > queue_reply(u, (char *)reply, u->u.msg.len); >+ mutex_unlock(&u->reply_mutex); > kfree(reply); > break; > >@@ -253,8 +282,10 @@ static ssize_t xenbus_dev_write(struct f > > hdr.type = XS_WATCH; > hdr.len = strlen(XS_WATCH_RESP) + 1; >+ mutex_lock(&u->reply_mutex); > queue_reply(u, (char *)&hdr, sizeof(hdr)); > queue_reply(u, (char *)XS_WATCH_RESP, hdr.len); >+ mutex_unlock(&u->reply_mutex); > } else { > list_for_each_entry_safe(watch, tmp_watch, > &u->watches, list) { >@@ -295,6 +326,7 @@ static int xenbus_dev_open(struct inode > > INIT_LIST_HEAD(&u->transactions); > INIT_LIST_HEAD(&u->watches); >+ INIT_LIST_HEAD(&u->read_buffers); > init_waitqueue_head(&u->read_waitq); > > mutex_init(&u->reply_mutex); >@@ -332,7 +364,7 @@ static unsigned int xenbus_dev_poll(stru > struct xenbus_dev_data *u = file->private_data; > > poll_wait(file, &u->read_waitq, wait); >- if (u->read_cons != u->read_prod) >+ if (!list_empty(&u->read_buffers)) > return POLLIN | POLLRDNORM; > return 0; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 294691
: 198351