Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'for-linus-5.2b-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:
"One minor cleanup patch and a fix for handling of live migration when
running as Xen guest"

* tag 'for-linus-5.2b-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
xenbus: Avoid deadlock during suspend due to open transactions
xen/pvcalls: Remove set but not used variable

+26 -6
-4
drivers/xen/pvcalls-front.c
··· 531 531 int pvcalls_front_sendmsg(struct socket *sock, struct msghdr *msg, 532 532 size_t len) 533 533 { 534 - struct pvcalls_bedata *bedata; 535 534 struct sock_mapping *map; 536 535 int sent, tot_sent = 0; 537 536 int count = 0, flags; ··· 542 543 map = pvcalls_enter_sock(sock); 543 544 if (IS_ERR(map)) 544 545 return PTR_ERR(map); 545 - bedata = dev_get_drvdata(&pvcalls_front_dev->dev); 546 546 547 547 mutex_lock(&map->active.out_mutex); 548 548 if ((flags & MSG_DONTWAIT) && !pvcalls_front_write_todo(map)) { ··· 624 626 int pvcalls_front_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, 625 627 int flags) 626 628 { 627 - struct pvcalls_bedata *bedata; 628 629 int ret; 629 630 struct sock_mapping *map; 630 631 ··· 633 636 map = pvcalls_enter_sock(sock); 634 637 if (IS_ERR(map)) 635 638 return PTR_ERR(map); 636 - bedata = dev_get_drvdata(&pvcalls_front_dev->dev); 637 639 638 640 mutex_lock(&map->active.in_mutex); 639 641 if (len > XEN_FLEX_RING_SIZE(PVCALLS_RING_ORDER))
+3
drivers/xen/xenbus/xenbus.h
··· 83 83 int num_vecs; 84 84 int err; 85 85 enum xb_req_state state; 86 + bool user_req; 86 87 void (*cb)(struct xb_req_data *); 87 88 void *par; 88 89 }; ··· 133 132 134 133 int xenbus_dev_request_and_reply(struct xsd_sockmsg *msg, void *par); 135 134 void xenbus_dev_queue_reply(struct xb_req_data *req); 135 + 136 + extern unsigned int xb_dev_generation_id; 136 137 137 138 #endif
+18
drivers/xen/xenbus/xenbus_dev_frontend.c
··· 62 62 63 63 #include "xenbus.h" 64 64 65 + unsigned int xb_dev_generation_id; 66 + 65 67 /* 66 68 * An element of a list of outstanding transactions, for which we're 67 69 * still waiting a reply. ··· 71 69 struct xenbus_transaction_holder { 72 70 struct list_head list; 73 71 struct xenbus_transaction handle; 72 + unsigned int generation_id; 74 73 }; 75 74 76 75 /* ··· 444 441 rc = -ENOMEM; 445 442 goto out; 446 443 } 444 + trans->generation_id = xb_dev_generation_id; 447 445 list_add(&trans->list, &u->transactions); 448 446 } else if (msg->hdr.tx_id != 0 && 449 447 !xenbus_get_transaction(u, msg->hdr.tx_id)) ··· 453 449 !(msg->hdr.len == 2 && 454 450 (!strcmp(msg->body, "T") || !strcmp(msg->body, "F")))) 455 451 return xenbus_command_reply(u, XS_ERROR, "EINVAL"); 452 + else if (msg_type == XS_TRANSACTION_END) { 453 + trans = xenbus_get_transaction(u, msg->hdr.tx_id); 454 + if (trans && trans->generation_id != xb_dev_generation_id) { 455 + list_del(&trans->list); 456 + kfree(trans); 457 + if (!strcmp(msg->body, "T")) 458 + return xenbus_command_reply(u, XS_ERROR, 459 + "EAGAIN"); 460 + else 461 + return xenbus_command_reply(u, 462 + XS_TRANSACTION_END, 463 + "OK"); 464 + } 465 + } 456 466 457 467 rc = xenbus_dev_request_and_reply(&msg->hdr, u); 458 468 if (rc && trans) {
+5 -2
drivers/xen/xenbus/xenbus_xs.c
··· 105 105 106 106 static void xs_suspend_exit(void) 107 107 { 108 + xb_dev_generation_id++; 108 109 spin_lock(&xs_state_lock); 109 110 xs_suspend_active--; 110 111 spin_unlock(&xs_state_lock); ··· 126 125 spin_lock(&xs_state_lock); 127 126 } 128 127 129 - if (req->type == XS_TRANSACTION_START) 128 + if (req->type == XS_TRANSACTION_START && !req->user_req) 130 129 xs_state_users++; 131 130 xs_state_users++; 132 131 rq_id = xs_request_id++; ··· 141 140 spin_lock(&xs_state_lock); 142 141 xs_state_users--; 143 142 if ((req->type == XS_TRANSACTION_START && req->msg.type == XS_ERROR) || 144 - (req->type == XS_TRANSACTION_END && 143 + (req->type == XS_TRANSACTION_END && !req->user_req && 145 144 !WARN_ON_ONCE(req->msg.type == XS_ERROR && 146 145 !strcmp(req->body, "ENOENT")))) 147 146 xs_state_users--; ··· 287 286 req->num_vecs = 1; 288 287 req->cb = xenbus_dev_queue_reply; 289 288 req->par = par; 289 + req->user_req = true; 290 290 291 291 xs_send(req, msg); 292 292 ··· 315 313 req->vec = iovec; 316 314 req->num_vecs = num_vecs; 317 315 req->cb = xs_wake_up; 316 + req->user_req = false; 318 317 319 318 msg.req_id = 0; 320 319 msg.tx_id = t.id;