From: eeb Date: Thu, 22 Sep 2005 13:05:19 +0000 (+0000) Subject: * Fixed bugs in new lnet_[k]iov2[k]iov() that skipped fragments incorrectly. X-Git-Tag: v1_7_100~1^25~6^2~152 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=46b0b64ac24fd6d42de150bce03c25bd885b6ce0;p=fs%2Flustre-release.git * Fixed bugs in new lnet_[k]iov2[k]iov() that skipped fragments incorrectly. These bugs would manifest as data corruption or crashes. * Reduced verbosity of router buffer allocation CDEBUGs --- diff --git a/lnet/lnet/lib-move.c b/lnet/lnet/lib-move.c index 8a967e7..87e2626 100644 --- a/lnet/lnet/lib-move.c +++ b/lnet/lnet/lib-move.c @@ -314,17 +314,19 @@ lnet_copy_iov2iov (unsigned int ndiov, struct iovec *diov, unsigned int doffset, siov->iov_base + soffset, this_nob); nob -= this_nob; - if (diov->iov_len < doffset + this_nob) { + if (diov->iov_len > doffset + this_nob) { doffset += this_nob; } else { diov++; + ndiov--; doffset = 0; } - if (siov->iov_len < soffset + this_nob) { + if (siov->iov_len > soffset + this_nob) { soffset += this_nob; } else { siov++; + nsiov--; soffset = 0; } } while (nob > 0); @@ -488,6 +490,7 @@ lnet_copy_kiov2kiov (unsigned int ndiov, lnet_kiov_t *diov, unsigned int doffset cfs_kunmap(diov->kiov_page); daddr = NULL; diov++; + ndiov--; doffset = 0; } @@ -498,6 +501,7 @@ lnet_copy_kiov2kiov (unsigned int ndiov, lnet_kiov_t *diov, unsigned int doffset cfs_kunmap(siov->kiov_page); saddr = NULL; siov++; + nsiov--; soffset = 0; } } while (nob > 0); @@ -552,20 +556,22 @@ lnet_copy_kiov2iov (unsigned int niov, struct iovec *iov, unsigned int iovoffset memcpy (iov->iov_base + iovoffset, addr, this_nob); nob -= this_nob; - if (iov->iov_len < iovoffset + this_nob) { + if (iov->iov_len > iovoffset + this_nob) { iovoffset += this_nob; } else { iov++; + niov--; iovoffset = 0; } - if (kiov->kiov_len < kiovoffset + this_nob) { + if (kiov->kiov_len > kiovoffset + this_nob) { addr += this_nob; kiovoffset += this_nob; } else { cfs_kunmap(kiov->kiov_page); addr = NULL; kiov++; + nkiov--; kiovoffset = 0; } @@ -619,20 +625,22 @@ lnet_copy_iov2kiov (unsigned int nkiov, lnet_kiov_t *kiov, unsigned int kiovoffs memcpy (addr, iov->iov_base + iovoffset, this_nob); nob -= this_nob; - if (kiov->kiov_len < kiovoffset + this_nob) { + if (kiov->kiov_len > kiovoffset + this_nob) { addr += this_nob; kiovoffset += this_nob; } else { cfs_kunmap(kiov->kiov_page); addr = NULL; kiov++; + nkiov--; kiovoffset = 0; } - if (iov->iov_len < iovoffset + this_nob) { + if (iov->iov_len > iovoffset + this_nob) { iovoffset += this_nob; } else { iov++; + niov--; iovoffset = 0; } } while (nob > 0); diff --git a/lnet/lnet/router.c b/lnet/lnet/router.c index 1a5701b..5001d77 100644 --- a/lnet/lnet/router.c +++ b/lnet/lnet/router.c @@ -249,7 +249,7 @@ lnet_add_route (__u32 net, unsigned int hops, lnet_nid_t gateway) __u32 net2; int rc; - CDEBUG(D_WARNING, "Add route: net %s hops %u gw %s\n", + CDEBUG(D_NET, "Add route: net %s hops %u gw %s\n", libcfs_net2str(net), hops, libcfs_nid2str(gateway)); if (gateway == LNET_NID_ANY || @@ -369,7 +369,7 @@ lnet_del_route (__u32 net, lnet_nid_t gw_nid) struct list_head *e2; int rc = -ENOENT; - CDEBUG(D_WARNING, "Del route: net %s : gw %s\n", + CDEBUG(D_NET, "Del route: net %s : gw %s\n", libcfs_net2str(net), libcfs_nid2str(gw_nid)); /* NB Caller may specify either all routes via the given gateway @@ -586,7 +586,7 @@ lnet_alloc_rtrpools(void) lnet_rtrpool_init(&the_lnet.ln_rtrpools[2], large_pages); for (rc = 0; rc < LNET_NRBPOOLS; rc++) - CDEBUG(D_WARNING, "Pages[%d]: %d\n", rc, + CDEBUG(D_NET, "Pages[%d]: %d\n", rc, the_lnet.ln_rtrpools[rc].rbp_npages); the_lnet.ln_routing = forwarding;