ia64/xen-unstable

changeset 9306:98a6f5ae7b1f

Reinitialize producer and consumer index to 0 if indexes corruption are detected
in XenBus.
Prevent a kernel infinite loop and add more recovering ability.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author vhanquez@kneesa.uk.xensource.com
date Fri Mar 17 10:03:37 2006 +0000 (2006-03-17)
parents 56ec142bdd91
children b8640cd55fd7
files linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c	Fri Mar 17 09:52:05 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c	Fri Mar 17 10:03:37 2006 +0000
     1.3 @@ -106,8 +106,10 @@ int xb_write(const void *data, unsigned 
     1.4  		cons = intf->req_cons;
     1.5  		prod = intf->req_prod;
     1.6  		mb();
     1.7 -		if (!check_indexes(cons, prod))
     1.8 +		if (!check_indexes(cons, prod)) {
     1.9 +			intf->req_cons = intf->req_prod = 0;
    1.10  			return -EIO;
    1.11 +		}
    1.12  
    1.13  		dst = get_output_chunk(cons, prod, intf->req, &avail);
    1.14  		if (avail == 0)
    1.15 @@ -150,8 +152,10 @@ int xb_read(void *data, unsigned len)
    1.16  		cons = intf->rsp_cons;
    1.17  		prod = intf->rsp_prod;
    1.18  		mb();
    1.19 -		if (!check_indexes(cons, prod))
    1.20 +		if (!check_indexes(cons, prod)) {
    1.21 +			intf->rsp_cons = intf->rsp_prod = 0;
    1.22  			return -EIO;
    1.23 +		}
    1.24  
    1.25  		src = get_input_chunk(cons, prod, intf->rsp, &avail);
    1.26  		if (avail == 0)