|
@@ -62,6 +62,8 @@
|
|
|
|
|
|
|
|
#include "xenbus.h"
|
|
#include "xenbus.h"
|
|
|
|
|
|
|
|
|
|
+unsigned int xb_dev_generation_id;
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* An element of a list of outstanding transactions, for which we're
|
|
* An element of a list of outstanding transactions, for which we're
|
|
|
* still waiting a reply.
|
|
* still waiting a reply.
|
|
@@ -69,6 +71,7 @@
|
|
|
struct xenbus_transaction_holder {
|
|
struct xenbus_transaction_holder {
|
|
|
struct list_head list;
|
|
struct list_head list;
|
|
|
struct xenbus_transaction handle;
|
|
struct xenbus_transaction handle;
|
|
|
|
|
+ unsigned int generation_id;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -441,6 +444,7 @@ static int xenbus_write_transaction(unsigned msg_type,
|
|
|
rc = -ENOMEM;
|
|
rc = -ENOMEM;
|
|
|
goto out;
|
|
goto out;
|
|
|
}
|
|
}
|
|
|
|
|
+ trans->generation_id = xb_dev_generation_id;
|
|
|
list_add(&trans->list, &u->transactions);
|
|
list_add(&trans->list, &u->transactions);
|
|
|
} else if (msg->hdr.tx_id != 0 &&
|
|
} else if (msg->hdr.tx_id != 0 &&
|
|
|
!xenbus_get_transaction(u, msg->hdr.tx_id))
|
|
!xenbus_get_transaction(u, msg->hdr.tx_id))
|
|
@@ -449,6 +453,20 @@ static int xenbus_write_transaction(unsigned msg_type,
|
|
|
!(msg->hdr.len == 2 &&
|
|
!(msg->hdr.len == 2 &&
|
|
|
(!strcmp(msg->body, "T") || !strcmp(msg->body, "F"))))
|
|
(!strcmp(msg->body, "T") || !strcmp(msg->body, "F"))))
|
|
|
return xenbus_command_reply(u, XS_ERROR, "EINVAL");
|
|
return xenbus_command_reply(u, XS_ERROR, "EINVAL");
|
|
|
|
|
+ else if (msg_type == XS_TRANSACTION_END) {
|
|
|
|
|
+ trans = xenbus_get_transaction(u, msg->hdr.tx_id);
|
|
|
|
|
+ if (trans && trans->generation_id != xb_dev_generation_id) {
|
|
|
|
|
+ list_del(&trans->list);
|
|
|
|
|
+ kfree(trans);
|
|
|
|
|
+ if (!strcmp(msg->body, "T"))
|
|
|
|
|
+ return xenbus_command_reply(u, XS_ERROR,
|
|
|
|
|
+ "EAGAIN");
|
|
|
|
|
+ else
|
|
|
|
|
+ return xenbus_command_reply(u,
|
|
|
|
|
+ XS_TRANSACTION_END,
|
|
|
|
|
+ "OK");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
rc = xenbus_dev_request_and_reply(&msg->hdr, u);
|
|
rc = xenbus_dev_request_and_reply(&msg->hdr, u);
|
|
|
if (rc && trans) {
|
|
if (rc && trans) {
|