From d020bb003dd9a8274c964c95f49d65f951324901 Mon Sep 17 00:00:00 2001 From: zhenwei pi Date: Wed, 26 Feb 2020 11:49:18 +0800 Subject: [PATCH] iser: set iser cm thread proc name as "iscsi_cm_thread" libiscsi is usually linked by QEMU, and QEMU sets thread proc name by function. But iser cm thread is created by libiscsi privately, QEMU can't set this thread. After attaching a iser disk, we can find a new thread 'qemu-system-x86' in QEMU process. With this patch, iser cm thread works with thread name 'iscsi_cm_thread'. Signed-off-by: zhenwei pi --- lib/iser.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/iser.c b/lib/iser.c index 66f51a7..3e50489 100644 --- a/lib/iser.c +++ b/lib/iser.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include "slist.h" @@ -48,6 +49,9 @@ #ifdef __linux +/* the name can be up to 16 bytes long, including the terminating null byte*/ +#define ISER_CM_THREAD_NAME "iscsi_cm_thread" + /* MUST keep in sync with socket.c */ union socket_address { struct sockaddr_in sin; @@ -1370,6 +1374,9 @@ static void *cm_thread(void *arg) int ret; struct iscsi_context *iscsi = iser_conn->cma_id->context; + /* supported since Linux 2.6.9, not fatal error, ignore return value */ + prctl(PR_SET_NAME, ISER_CM_THREAD_NAME); + while (1) { ret = rdma_get_cm_event(iser_conn->cma_channel, &iser_conn->cma_event); if (ret) {