From: Liang Zhen Date: Fri, 5 Dec 2014 08:52:55 +0000 (+0800) Subject: LU-5990 lnet: fix for lnet_prepare failure handling X-Git-Tag: 2.6.93~34 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=5c0db17244d2e7c3e209e55298f8fdb05422384d;p=fs%2Flustre-release.git LU-5990 lnet: fix for lnet_prepare failure handling lnet_prepare() should return errno on failure Signed-off-by: Liang Zhen Change-Id: Ie86b4ba71550628e293352d8bff4d17af80e8e05 Reviewed-on: http://review.whamcloud.com/12973 Reviewed-by: Andreas Dilger Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Isaac Huang Reviewed-by: Oleg Drokin --- diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index ae10aa8..fefeb69 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -728,26 +728,25 @@ lnet_prepare(lnet_pid_t requested_pid) return -ENETDOWN; } - LASSERT (the_lnet.ln_refcount == 0); + LASSERT(the_lnet.ln_refcount == 0); - the_lnet.ln_routing = 0; + the_lnet.ln_routing = 0; #ifdef __KERNEL__ - LASSERT ((requested_pid & LNET_PID_USERFLAG) == 0); - the_lnet.ln_pid = requested_pid; + LASSERT((requested_pid & LNET_PID_USERFLAG) == 0); + the_lnet.ln_pid = requested_pid; #else - if (the_lnet.ln_server_mode_flag) {/* server case (uOSS) */ + if (the_lnet.ln_server_mode_flag) {/* server case (uOSS) */ LASSERT ((requested_pid & LNET_PID_USERFLAG) == 0); - - if (current_uid() != 0) /* Only root can run user-space server */ + /* Only root can run user-space server */ + if (current_uid() != 0) return -EPERM; the_lnet.ln_pid = requested_pid; - } else {/* client case (liblustre) */ - - /* My PID must be unique on this node and flag I'm userspace */ - the_lnet.ln_pid = getpid() | LNET_PID_USERFLAG; - } + } else {/* client case (liblustre) */ + /* My PID must be unique on this node and flag I'm userspace */ + the_lnet.ln_pid = getpid() | LNET_PID_USERFLAG; + } #endif INIT_LIST_HEAD(&the_lnet.ln_test_peers); @@ -788,15 +787,19 @@ lnet_prepare(lnet_pid_t requested_pid) recs = lnet_res_containers_create(LNET_COOKIE_TYPE_ME, LNET_FL_MAX_MES, sizeof(lnet_me_t)); - if (recs == NULL) + if (recs == NULL) { + rc = -ENOMEM; goto failed; + } the_lnet.ln_me_containers = recs; recs = lnet_res_containers_create(LNET_COOKIE_TYPE_MD, LNET_FL_MAX_MDS, sizeof(lnet_libmd_t)); - if (recs == NULL) + if (recs == NULL) { + rc = -ENOMEM; goto failed; + } the_lnet.ln_md_containers = recs;