[ofa-general] RE: [PATCH] When no DM ports are found return an error

Ishai Rabinovitz ishai at mellanox.co.il
Sun Apr 12 06:58:22 PDT 2009


Hi Ira,

Good catch, thank you.
I applied it, but I changed the return value to be 0, because we do not
want to end the execution.
So the final patch is:

commit d89490a22f0b781a505311bfa53f0acca983e097
Author: Ishai Rabinovitz <ishai at vnc1.lab.mtl.com>
Date:   Sun Apr 12 11:54:56 2009 +0300

    Fix a bug when there is no target in the fabric
    
    Signed-off-by: Ira Weiny <weiny2 at llnl.gov>
    Signed-off-by: Ishai Rabinovitz <ishai at mellanox.co.il>

diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c
index 5e1e198..14087bd 100644
--- a/srp_daemon/srp_daemon.c
+++ b/srp_daemon/srp_daemon.c
@@ -943,6 +943,13 @@ static int do_dm_port_list(struct resources *res)
 
 	size = ib_get_attr_size(in_sa_mad->attr_offset);
 
+	if (!size) {
+		if (config->verbose) {
+			printf("Query did not find any targets\n");
+		}
+		return 0;
+	}
+
 	for (i = 0; (i + 1) * size <= len - MAD_RMPP_HDR_SIZE; ++i) {
 		port_info = (void *) in_sa_mad->data + i * size;

Ishai
> -----Original Message-----
> From: Ira Weiny [mailto:weiny2 at llnl.gov]
> Sent: Friday, April 10, 2009 3:02 AM
> To: Ishai Rabinovitz
> Cc: OpenFabrics; D. Marc Stearman
> Subject: [PATCH] When no DM ports are found return an error
> 
> I think I have found a bug in srp_daemon when running on a fabric with
> no SRP targets.
> 
> The patch below fixes the issue.  This is when running against OpenSM
> 3.2.5.  Without this fix the daemon goes into an endless loop looking
> for the node with lid 0!
> 
> Ira
> 
> 
> From: Ira Weiny <weiny2 at llnl.gov>
> Date: Thu, 9 Apr 2009 16:41:58 -0700
> Subject: [PATCH] When no DM ports are found return an error.
> 
> 
> Signed-off-by: Ira Weiny <weiny2 at llnl.gov>
> ---
>  srp_daemon/srp_daemon.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c
> index 5e1e198..621678b 100644
> --- a/srp_daemon/srp_daemon.c
> +++ b/srp_daemon/srp_daemon.c
> @@ -943,6 +943,9 @@ static int do_dm_port_list(struct resources *res)
> 
>  	size = ib_get_attr_size(in_sa_mad->attr_offset);
> 
> +	if (!size)
> +		return -1;
> +
>  	for (i = 0; (i + 1) * size <= len - MAD_RMPP_HDR_SIZE; ++i) {
>  		port_info = (void *) in_sa_mad->data + i * size;
> 
> --
> 1.5.4.5




More information about the general mailing list