ia64/xen-unstable

changeset 8269:ac3ceb2d37d1

Fix the startup behaviour when the tdb file exists. We were attempting to
remove and recreate the /local directory, but the manual_node call only works
if the tdb is empty -- we must use create_node, otherwise the store is
corrupted.

It's not clear to me that the other manual_node calls are safe, but I have only
made this smaller change for the sake of stability. These other calls should
be reviewed.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Wed Dec 07 15:44:38 2005 +0000 (2005-12-07)
parents ab300e9fe02b
children 436c3b6d09a6
files tools/xenstore/xenstored_core.c
line diff
     1.1 --- a/tools/xenstore/xenstored_core.c	Wed Dec 07 15:41:41 2005 +0000
     1.2 +++ b/tools/xenstore/xenstored_core.c	Wed Dec 07 15:44:38 2005 +0000
     1.3 @@ -823,7 +823,7 @@ static struct node *construct_node(struc
     1.4  	node->num_perms = parent->num_perms;
     1.5  	node->perms = talloc_memdup(node, parent->perms,
     1.6  				    node->num_perms * sizeof(node->perms[0]));
     1.7 -	if (conn->id)
     1.8 +	if (conn && conn->id)
     1.9  		node->perms[0].id = conn->id;
    1.10  
    1.11  	/* No children, no data */
    1.12 @@ -1441,8 +1441,10 @@ static void setup_structure(void)
    1.13  		   balloon driver will pick up stale entries.  In the case of
    1.14  		   the balloon driver, this can be fatal.
    1.15  		*/
    1.16 +		char *tlocal = talloc_strdup(talloc_autofree_context(),
    1.17 +					     "/local");
    1.18  		internal_rm("/local");
    1.19 -		manual_node("/", "local");
    1.20 +		create_node(NULL, tlocal, NULL, 0);
    1.21  	}
    1.22  	else {
    1.23  		tdb_ctx = tdb_open(tdbname, 7919, TDB_FLAGS, O_RDWR|O_CREAT,