aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2018-03-02 10:31:25 +1100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-06 04:17:27 -0800
commit2e20a07f3b577af0498095193252a8d20489dfc9 (patch)
treebf3cd6e88ecddf7384f6bc1b934a279206636f69
parentstaging: lustre: obdclass: don't require lct_owner to be non-NULL. (diff)
downloadlinux-dev-2e20a07f3b577af0498095193252a8d20489dfc9.tar.xz
linux-dev-2e20a07f3b577af0498095193252a8d20489dfc9.zip
staging: lustre: lnet: keep ln_nportals consistent
ln_nportals should be zero when no portals have been allocated. This ensures that memory allocation failure is handled correctly elsewhere. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/lustre/lnet/lnet/lib-ptl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/staging/lustre/lnet/lnet/lib-ptl.c b/drivers/staging/lustre/lnet/lnet/lib-ptl.c
index 471f2f6c86f4..fc47379c5938 100644
--- a/drivers/staging/lustre/lnet/lnet/lib-ptl.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-ptl.c
@@ -841,6 +841,7 @@ lnet_portals_destroy(void)
cfs_array_free(the_lnet.ln_portals);
the_lnet.ln_portals = NULL;
+ the_lnet.ln_nportals = 0;
}
int
@@ -851,12 +852,12 @@ lnet_portals_create(void)
size = offsetof(struct lnet_portal, ptl_mt_maps[LNET_CPT_NUMBER]);
- the_lnet.ln_nportals = MAX_PORTALS;
- the_lnet.ln_portals = cfs_array_alloc(the_lnet.ln_nportals, size);
+ the_lnet.ln_portals = cfs_array_alloc(MAX_PORTALS, size);
if (!the_lnet.ln_portals) {
CERROR("Failed to allocate portals table\n");
return -ENOMEM;
}
+ the_lnet.ln_nportals = MAX_PORTALS;
for (i = 0; i < the_lnet.ln_nportals; i++) {
if (lnet_ptl_setup(the_lnet.ln_portals[i], i)) {