Scott Atchley
2007-Apr-13 07:35 UTC
[Lustre-devel] Patch for MXLND to enable lctl->peer_list
Hi Eric, I have attached a patch to enable using peer_list in lctl. The basic code was in there, I simply needed to set the correct return value and add MXLND to the supported LNDs in $LUSTRE/lnet/utils/portals.c. It should apply with patch -p0 in $LUSTRE. Regards, Scott -------------- next part -------------- A non-text attachment was scrubbed... Name: mxlnd-peer_list-fix.patch Type: application/octet-stream Size: 1135 bytes Desc: not available Url : http://mail.clusterfs.com/pipermail/lustre-devel/attachments/20070413/6b8bf8cc/mxlnd-peer_list-fix.obj
Scott Atchley
2007-Apr-13 09:02 UTC
[Lustre-devel] Patch for MXLND to enable lctl->peer_list
Hi Eric, I forgot to include one other small change. The corrected patch is attached. Scott -------------- next part -------------- A non-text attachment was scrubbed... Name: mxlnd-peer_list-fix.patch Type: application/octet-stream Size: 1820 bytes Desc: not available Url : http://mail.clusterfs.com/pipermail/lustre-devel/attachments/20070413/db8060a7/mxlnd-peer_list-fix.obj
Alexey Lyashkov
2007-Apr-13 09:37 UTC
[Lustre-devel] Patch for MXLND to enable lctl->peer_list
this change is wrong.
you need read_unlock(&kmxlnd_data.kmx_peers_lock); before return from
mxlnd_get_peer_info to avoid leak lock.
diff -pru ../lustre-old/lnet/klnds/mxlnd/mxlnd_cb.c
./lnet/klnds/mxlnd/mxlnd_cb.c
--- ../lustre-old/lnet/klnds/mxlnd/mxlnd_cb.c 2007-02-09
19:04:46.000000000 -0500
+++ ./lnet/klnds/mxlnd/mxlnd_cb.c 2007-04-13 09:24:50.000000000
-0400
@@ -1099,6 +1099,7 @@ mxlnd_get_peer_info(int index, lnet_nid_
*nidp = peer->mxp_nid;
*count = atomic_read(&peer->mxp_refcount);
+ return 0;
}
}
read_unlock(&kmxlnd_data.kmx_peers_lock);
On Fri, 2007-04-13 at 18:01, Scott Atchley wrote:> Hi Eric,
>
> I forgot to include one other small change. The corrected patch is
> attached.
>
> Scott
>
>
> ______________________________________________________________________
> _______________________________________________
> Lustre-devel mailing list
> Lustre-devel@clusterfs.com
> https://mail.clusterfs.com/mailman/listinfo/lustre-devel
--
Alexey Lyashkov <shadow@clusterfs.com>
Beaver team
Scott Atchley
2007-Apr-13 13:17 UTC
[Lustre-devel] Patch for MXLND to enable lctl->peer_list
Alexey,
Thanks for the catch. :-)
Rather than release the lock, let me set the return value and let it
exit in the usual point.
Scott
--- ../lustre-old/lnet/klnds/mxlnd/mxlnd.c 2007-02-09
19:04:46.000000000 -0500
+++ ./lnet/klnds/mxlnd/mxlnd.c 2007-04-13 10:59:06.000000000 -0400
@@ -579,7 +579,7 @@ mxlnd_init_mx(lnet_ni_t *ni)
mx_finalize();
return -1;
}
- mxret = mx_set_request_timeout(kmxlnd_data.kmx_endpt, NULL,
MXLND_COMM_TIMEOUT/HZ);
+ mxret = mx_set_request_timeout(kmxlnd_data.kmx_endpt, NULL,
MXLND_COMM_TIMEOUT/HZ*1000);
if (mxret != MX_SUCCESS) {
CERROR("mx_set_request_timeout() failed with %s\n",
mx_strerror(mxret));
diff -pru ../lustre-old/lnet/klnds/mxlnd/mxlnd_cb.c ./lnet/klnds/
mxlnd/mxlnd_cb.c
--- ../lustre-old/lnet/klnds/mxlnd/mxlnd_cb.c 2007-02-09
19:04:46.000000000 -0500
+++ ./lnet/klnds/mxlnd/mxlnd_cb.c 2007-04-13 15:16:29.000000000
-0400
@@ -1087,6 +1087,7 @@ int
mxlnd_get_peer_info(int index, lnet_nid_t *nidp, int *count)
{
int i = 0;
+ int ret = -ENOENT;
struct kmx_peer *peer = NULL;
struct kmx_conn *conn = NULL;
@@ -1099,11 +1100,12 @@ mxlnd_get_peer_info(int index, lnet_nid_
*nidp = peer->mxp_nid;
*count = atomic_read(&peer->mxp_refcount);
+ ret = 0;
}
}
read_unlock(&kmxlnd_data.kmx_peers_lock);
- return -ENOENT;
+ return ret;
}
void
diff -pru ../lustre-old/lnet/utils/portals.c ./lnet/utils/portals.c
--- ../lustre-old/lnet/utils/portals.c 2007-03-09 16:38:32.000000000
-0500
+++ ./lnet/utils/portals.c 2007-04-13 09:25:13.000000000 -0400
@@ -570,7 +570,7 @@ jt_ptl_print_peers (int argc, char **arg
int index;
int rc;
- if (!g_net_is_compatible (argv[0], SOCKLND, RALND, PTLLND,
+ if (!g_net_is_compatible (argv[0], SOCKLND, RALND, PTLLND,
MXLND,
OPENIBLND, CIBLND, IIBLND,
VIBLND, O2IBLND, 0))
return -1;
On Apr 13, 2007, at 11:37 AM, Alexey Lyashkov wrote:
> this change is wrong.
>
> you need read_unlock(&kmxlnd_data.kmx_peers_lock); before return from
> mxlnd_get_peer_info to avoid leak lock.
>
>
> diff -pru ../lustre-old/lnet/klnds/mxlnd/mxlnd_cb.c
> ./lnet/klnds/mxlnd/mxlnd_cb.c
> --- ../lustre-old/lnet/klnds/mxlnd/mxlnd_cb.c 2007-02-09
> 19:04:46.000000000 -0500
> +++ ./lnet/klnds/mxlnd/mxlnd_cb.c 2007-04-13 09:24:50.000000000
> -0400
> @@ -1099,6 +1099,7 @@ mxlnd_get_peer_info(int index, lnet_nid_
>
> *nidp = peer->mxp_nid;
> *count = atomic_read(&peer->mxp_refcount);
> + return 0;
> }
> }
> read_unlock(&kmxlnd_data.kmx_peers_lock);
>
>
> On Fri, 2007-04-13 at 18:01, Scott Atchley wrote:
>> Hi Eric,
>>
>> I forgot to include one other small change. The corrected patch is
>> attached.
>>
>> Scott
>>
>>
>> _____________________________________________________________________
>> _
>> _______________________________________________
>> Lustre-devel mailing list
>> Lustre-devel@clusterfs.com
>> https://mail.clusterfs.com/mailman/listinfo/lustre-devel
> --
> Alexey Lyashkov <shadow@clusterfs.com>
> Beaver team
Alexey Lyashkov
2007-Apr-14 01:42 UTC
[Lustre-devel] Patch for MXLND to enable lctl->peer_list
Scott,> diff -pru ../lustre-old/lnet/klnds/mxlnd/mxlnd_cb.c ./lnet/klnds/ > mxlnd/mxlnd_cb.c > --- ../lustre-old/lnet/klnds/mxlnd/mxlnd_cb.c 2007-02-09 > 19:04:46.000000000 -0500 > +++ ./lnet/klnds/mxlnd/mxlnd_cb.c 2007-04-13 15:16:29.000000000 > -0400 > @@ -1087,6 +1087,7 @@ int > mxlnd_get_peer_info(int index, lnet_nid_t *nidp, int *count) > { > int i = 0; > + int ret = -ENOENT; > struct kmx_peer *peer = NULL; > struct kmx_conn *conn = NULL; > @@ -1099,11 +1100,12 @@ mxlnd_get_peer_info(int index, lnet_nid_ > *nidp = peer->mxp_nid; > *count = atomic_read(&peer->mxp_refcount); > + ret = 0;+ break; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ need exit from loop.> } > } > read_unlock(&kmxlnd_data.kmx_peers_lock); > > - return -ENOENT; > + return ret; > } > voidI think not need others loops after found data. -- Alexey Lyashkov <shadow@clusterfs.com> Beaver team
Scott Atchley
2007-Apr-14 04:58 UTC
[Lustre-devel] Patch for MXLND to enable lctl->peer_list
On Apr 14, 2007, at 3:41 AM, Alexey Lyashkov wrote:> Scott, > > + break; > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > need exit from loop. > I think not need others loops after found data.Trying to do too many things at once. ;-) Thanks again for the catch. Would you like another patch or did you add the break? Thanks, Scott
Andreas Dilger
2007-Apr-14 08:05 UTC
[Lustre-devel] Patch for MXLND to enable lctl->peer_list
On Apr 14, 2007 06:58 -0400, Scott Atchley wrote:> On Apr 14, 2007, at 3:41 AM, Alexey Lyashkov wrote: > > > >+ break; > >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > >need exit from loop. > >I think not need others loops after found data. > > Trying to do too many things at once. ;-) > > Thanks again for the catch. > > Would you like another patch or did you add the break?Scott, it would probably be best to attach the patch to a new bug in bugzilla and CC eeb@clusterfs.com, so that we can track its inclusion into a release properly. Cheers, Andreas -- Andreas Dilger Principal Software Engineer Cluster File Systems, Inc.
Scott Atchley
2007-Apr-14 08:27 UTC
[Lustre-devel] Patch for MXLND to enable lctl->peer_list
On Apr 14, 2007, at 10:05 AM, Andreas Dilger wrote:> Scott, > it would probably be best to attach the patch to a new bug in bugzilla > and CC eeb@clusterfs.com, so that we can track its inclusion into a > release properly. > > Cheers, AndreasHi Andreas, I will do this today. Thanks, Scott