ia64/xen-unstable

changeset 10868:d2bf1a7cc131

Limit the number of opened transactions per connection to 5.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author vhanquez@gwig.uk.xensource.com
date Sat Jul 29 14:05:59 2006 +0100 (2006-07-29)
parents edf7a25fdc43
children f67d23e37921 c471b326b75e
files tools/xenstore/xenstored_transaction.c
line diff
     1.1 --- a/tools/xenstore/xenstored_transaction.c	Sat Jul 29 13:06:41 2006 +0100
     1.2 +++ b/tools/xenstore/xenstored_transaction.c	Sat Jul 29 14:05:59 2006 +0100
     1.3 @@ -125,6 +125,7 @@ void do_transaction_start(struct connect
     1.4  {
     1.5  	struct transaction *trans, *exists;
     1.6  	char id_str[20];
     1.7 +	int started;
     1.8  
     1.9  	/* We don't support nested transactions. */
    1.10  	if (conn->transaction) {
    1.11 @@ -132,6 +133,15 @@ void do_transaction_start(struct connect
    1.12  		return;
    1.13  	}
    1.14  
    1.15 +	started = 0;
    1.16 +	list_for_each_entry(trans, &conn->transaction_list, list)
    1.17 +		started++;
    1.18 +
    1.19 +	if (started > 5) {
    1.20 +		send_error(conn, ENOSPC);
    1.21 +		return;
    1.22 +	}
    1.23 +
    1.24  	/* Attach transaction to input for autofree until it's complete */
    1.25  	trans = talloc(in, struct transaction);
    1.26  	INIT_LIST_HEAD(&trans->changes);