X-MimeOLE: Produced By Microsoft Exchange V6.5
Received: by onstor-exch02.onstor.net 
	id <01C8A0E5.CCBABAB0@onstor-exch02.onstor.net>; Thu, 17 Apr 2008 16:50:22 -0700
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Content-class: urn:content-classes:message
Subject: RE: what am i not doing?
Date: Thu, 17 Apr 2008 16:50:22 -0700
Message-ID: <BB375AF679D4A34E9CA8DFA650E2B04E03E9A7CC@onstor-exch02.onstor.net>
In-Reply-To: <20080417162951.4242dba7@ripper.onstor.net>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: what am i not doing?
Thread-Index: Acig4vDZGSIbGO1LS9+6pUThtIajJAAApdhQ
From: "Chris Vandever" <chris.vandever@onstor.com>
To: "Andy Sharp" <andy.sharp@onstor.com>

I'll take a closer look later, but your app may need to call
rmc_init_ex().  See the test app in code/ssc-cluster/cluster-test.c for
an example.

ChrisV

-----Original Message-----
From: Andy Sharp=20
Sent: Thursday, April 17, 2008 4:30 PM
To: Chris Vandever
Subject: what am i not doing?

Hi Chris,

I need to enlist your help.

So, I added this routine cluster_getVsMgmtId() to cluster_vsvr_api.c,
and it's supposed to return the mgmt vsvr id, but instead it segfaults
in some rmc routine.  It seems innocent enough to me, but what do I
know.

Here is the stack trace:

(gdb) bt
#0  0x2b278cd0 in rmc_context_add_sess (cb=3D0x2b2c3890, =
sess=3D0x515da8)
    at rmc_api.c:248
#1  0x2b27a254 in rmc_open_shared (sess=3D0x515da8, my_name=3D0x0,
relay=3D0x0,=20
    dest_addr=3D0x7fd663dc, max_pending=3D256, msg=3D0x7fd66248, =
mode=3D16)
    at rmc_api.c:846
#2  0x2b279b64 in rmc_open_ex (sess=3D0x515da8, my_name=3D0x0,=20
    dest_addr=3D0x7fd663dc, max_pending=3D256, msg=3D0x7fd66248, =
mode=3D16)
    at rmc_api.c:700
#3  0x2b05c6ac in cluster_rmc_open (sess=3D0x515da8, =
dest_addr=3D0x7fd663dc,

    max_pending=3D256, mode=3D16) at cluster-rmc.c:1100
#4  0x2b05b01c in cluster_lookup_sess (app=3D0x2b0a2374 "clusterrpc")
    at cluster-rmc.c:641
#5  0x2b05b2b4 in cluster_clientSendRmcRpc (buf=3D0x5164e8, bufLen=3D44, =

    rspBuf=3D0x2b103b28, rspLen=3D0x7fd664c0, app=3D0x2b0a2374 =
"clusterrpc")
    at cluster-rmc.c:711
#6  0x2b039360 in cluster_getRecordIdByKey
(recType=3DCLUSDB_REC_TYPE_FILER,=20
    recId=3D0x7fd6666c, keyLen=3D7, keyVal=3D0x7fd664f4 "coolcat")
    at cluster-api.c:852
#7  0x2b04a23c in cluster_getLocalFilerRecId (recId=3D0x7fd6666c)
    at cluster-filer-api.c:200
#8  0x2b04a2d8 in cluster_getFilerRecId (filerName=3D0x0,=20
    fUseLocalhost=3D1 '\001', recId=3D0x7fd6666c) at =
cluster-filer-api.c:240
#9  0x2b07eda4 in cluster_getFilerMgmtVsvr (filerName=3D0x0,
cfgp=3D0x7fd666b8,
    buffSize=3D2168) at cluster-vsvr-api.c:5855
#10 0x2b07f0a4 in cluster_getVsMgmtId () at cluster-vsvr-api.c:5979
#11 0x0042586c in dns_basic_lookup ()


I don't even know if that buffSize=3D2168 is reasonable.

Is there some kind of setup routine I need to call first?  nfxsh works
fine and commands like "vsvr show VS_MGMT_1884" work fine, sit seems
like things are OK on the filer, it's just my code that is sucking.

Here is the change I made to cluster-vsvr-api.c, which can be found in
~andys/src/dev/nfx-tree/code/ssc-cluster/cluster-vsvr-api.c



$ p4 diff nfx-tree/code/ssc-cluster/cluster-vsvr-api.c
=3D=3D=3D=3D //depot/dev/nfx-tree/code/ssc-cluster/cluster-vsvr-api.c#7 =
-
/homes/andys/src/dev/nfx-tree/code/ssc-cluster/cluster-vsvr-api.c =
=3D=3D=3D=3D
52a53,54
> static int vs_mgmt_id =3D VS_ID_INVALID;
>=20
5952a5955,5992
>  * Routine : cluster_getVsMgmtId
>  *
>  * Description:
>  *   Get vs management name buffer.
>  *
>  * Arguments:
>  *
>  *   NONE
>  *
>  * Return Value:
>  *
>  *  NFX_OK  - success
>  *  NFX_ERR - error
>  *
>  *--------------------------------------------------------------------
>  */
>=20
> int32
> cluster_getVsMgmtId(void)
> {
> 	if (vs_mgmt_id =3D=3D VS_ID_INVALID) {
> 		char		buf[VS_RECORD_MAX_LEN];
> 		vs_rec_t	*vs =3D (vs_rec_t *)buf;
>=20
> 		if (cluster_getFilerMgmtVsvr(NULL, vs, sizeof(buf)) !=3D
NFX_OK) {
> 			CLUSTER_PRINTF((
> 				"%s[%d]: Failed to get Management
Virtual Server Record\n",
> 				__FUNCTION__, __LINE__));
> 			errno =3D EAGAIN;
> 		} else {
> 			vs_mgmt_id =3D vs->vs_id;
> 		}
> 	}
>=20
>     return vs_mgmt_id;
> }
>=20
> /*--------------------------------------------------------------------
