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 <pizhenwei@bytedance.com>
This commit is contained in:
zhenwei pi
2020-02-26 11:49:18 +08:00
parent e2a7fdfb36
commit d020bb003d

View File

@@ -17,6 +17,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/prctl.h>
#include <fcntl.h>
#include <stdlib.h>
#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) {