From: Darek Stojaczyk Date: Fri, 29 Mar 2019 09:52:39 +0000 (+0100) Subject: fbarray: fix attach deadlock X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5a98bc5e83b1562d5b688a3d5a6dd3ee977694d2;p=dpdk.git fbarray: fix attach deadlock rte_fbarray_attach() currently locks its internal spinlock, but never releases it. Secondary processes won't even start if there is more than one fbarray to be attached to - the second rte_fbarray_attach() would be just stuck. Fix it by releasing the lock at the end of rte_fbarray_attach(). I believe this was the original intention. Fixes: 5b61c62cfd76 ("fbarray: add internal tailq for mapped areas") Signed-off-by: Darek Stojaczyk Reviewed-by: Gavin Hu Acked-by: Anatoly Burakov --- diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c index 0e7366e5e9..31cce80a88 100644 --- a/lib/librte_eal/common/eal_common_fbarray.c +++ b/lib/librte_eal/common/eal_common_fbarray.c @@ -859,8 +859,10 @@ rte_fbarray_attach(struct rte_fbarray *arr) } page_sz = sysconf(_SC_PAGESIZE); - if (page_sz == (size_t)-1) - goto fail; + if (page_sz == (size_t)-1) { + free(ma); + return -1; + } mmap_len = calc_data_size(page_sz, arr->elt_sz, arr->len); @@ -906,6 +908,7 @@ rte_fbarray_attach(struct rte_fbarray *arr) /* we're done */ + rte_spinlock_unlock(&mem_area_lock); return 0; fail: if (data) @@ -913,6 +916,7 @@ fail: if (fd >= 0) close(fd); free(ma); + rte_spinlock_unlock(&mem_area_lock); return -1; }