Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
CORTX-32172: Fixes ADDB client logs to bundled it in rgw support bundle
Browse files Browse the repository at this point in the history
Signed-off-by: Rahul Kumar <rahul.kumar@seagate.com>
  • Loading branch information
rahul27kumar committed Aug 23, 2022
1 parent 0cd7e68 commit 2f7b4b3
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions motr/client_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1527,8 +1527,13 @@ M0_INTERNAL int m0_client_global_init(void)
return M0_RC(rc);
}

/**
* To get the enviroment value for M0_CLIENT_ADDB_DIR
*/
#ifndef __KERNEL__
#include <stdlib.h>
#endif
#define NOT_EMPTY(x) (x != NULL && *x != '\0')

static struct m0 m0_client_motr_instance;
int m0_client_init(struct m0_client **m0c_p,
struct m0_config *conf, bool init_m0)
Expand Down Expand Up @@ -1678,16 +1683,37 @@ int m0_client_init(struct m0_client **m0c_p,
}

if (conf->mc_is_addb_init) {
char buf[64];
char buf[128];
const char *addb_stob_location = NULL;
/* Default client addb record file size set to 128M */
m0_bcount_t size = DEFAULT_CLIENT_ADDB2_RECORD_SIZE;
/* uint64 max character size */
enum { MAX_PID_IN_CHAR_SIZE = 20 };

if (conf->mc_addb_size != 0) {
if (conf->mc_addb_size > MAX_ADDB2_RECORD_SIZE)
M0_LOG(M0_WARN, "ADDB size is more than recommended");
size = conf->mc_addb_size;
M0_LOG(M0_DEBUG, "ADDB size = %" PRIu64 "", size);
}
sprintf(buf, "linuxstob:./addb_%d", (int)m0_pid());
#ifndef __KERNEL__
addb_stob_location = getenv("M0_CLIENT_ADDB_DIR");
#endif
if(addb_stob_location == NULL)
{
addb_stob_location = ".";
}
/* checking for buf size overflow */
if(addb_stob_location != NULL && sizeof(&addb_stob_location) >=
sizeof(buf) - (sizeof("linuxstob:/addb_") +
MAX_PID_IN_CHAR_SIZE))
{
M0_LOG(M0_WARN, "ADDB location is more than defined "
"size");

}
snprintf(buf, "linuxstob:%s/addb_%d",
addb_stob_location, (int)m0_pid());
M0_LOG(M0_DEBUG, "addb size=%llu\n", (unsigned long long)size);
rc = m0_reqh_addb2_init(&m0c->m0c_reqh, buf,
0xaddbf11e, true, true, size);
Expand Down

0 comments on commit 2f7b4b3

Please # to comment.