Skip to content

Commit cd124ce

Browse files
authored
Merge pull request #8330 from devreal/opal-cstring-info
Use reference-counted immutable strings with info objects
2 parents 5585b03 + 3c5c132 commit cd124ce

33 files changed

+939
-605
lines changed

ompi/communicator/comm_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ static void ompi_comm_destruct(ompi_communicator_t* comm)
492492
}
493493

494494
#define OMPI_COMM_SET_INFO_FN(name, flag) \
495-
static char *ompi_comm_set_ ## name (opal_infosubscriber_t *obj, char *key, char *value) \
495+
static const char *ompi_comm_set_ ## name (opal_infosubscriber_t *obj, const char *key, const char *value) \
496496
{ \
497497
ompi_communicator_t *comm = (ompi_communicator_t *) obj; \
498498
\

ompi/dpm/dpm.c

Lines changed: 172 additions & 123 deletions
Large diffs are not rendered by default.

ompi/info/info.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,10 @@ int ompi_info_set_value_enum (ompi_info_t *info, const char *key, int value,
224224
{
225225
return opal_info_set_value_enum (&(info->super), key, value, var_enum);
226226
}
227-
int ompi_info_get (ompi_info_t *info, const char *key, int valuelen,
228-
char *value, int *flag)
227+
int ompi_info_get (ompi_info_t *info, const char *key,
228+
opal_cstring_t **value, int *flag)
229229
{
230-
return opal_info_get (&(info->super), key, valuelen, value, flag);
230+
return opal_info_get (&(info->super), key, value, flag);
231231
}
232232
int ompi_info_get_value_enum (ompi_info_t *info, const char *key, int *value,
233233
int default_value, mca_base_var_enum_t *var_enum,
@@ -247,7 +247,7 @@ int ompi_info_get_valuelen (ompi_info_t *info, const char *key, int *valuelen,
247247
{
248248
return opal_info_get_valuelen (&(info->super), key, valuelen, flag);
249249
}
250-
int ompi_info_get_nthkey (ompi_info_t *info, int n, char *key) {
250+
int ompi_info_get_nthkey (ompi_info_t *info, int n, opal_cstring_t **key) {
251251
return opal_info_get_nthkey (&(info->super), n, key);
252252
}
253253
int ompi_info_get_nkeys(ompi_info_t *info, int *nkeys)
@@ -304,8 +304,8 @@ int ompi_mpiinfo_finalize(void)
304304
item = opal_list_get_next(item)) {
305305
entry = (opal_info_entry_t *) item;
306306
opal_output(0, "WARNING: key=\"%s\", value=\"%s\"",
307-
entry->ie_key,
308-
NULL != entry->ie_value ? entry->ie_value : "(null)");
307+
entry->ie_key->string,
308+
NULL != entry->ie_value ? entry->ie_value->string : "(null)");
309309
found = true;
310310
}
311311
}

ompi/info/info.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ OMPI_DECLSPEC int ompi_info_get_value_enum (ompi_info_t *info, const char *key,
130130
/**
131131
* ompi_info_foo() wrapper around various opal_info_foo() calls
132132
*/
133-
OMPI_DECLSPEC int ompi_info_get (ompi_info_t *info, const char *key, int valuelen,
134-
char *value, int *flag);
133+
OMPI_DECLSPEC int ompi_info_get (ompi_info_t *info, const char *key,
134+
opal_cstring_t **value, int *flag);
135135
/**
136136
* ompi_info_foo() wrapper around various opal_info_foo() calls
137137
*/
@@ -144,7 +144,7 @@ OMPI_DECLSPEC int ompi_info_get_valuelen (ompi_info_t *info, const char *key, in
144144
/**
145145
* ompi_info_foo() wrapper around various opal_info_foo() calls
146146
*/
147-
OMPI_DECLSPEC int ompi_info_get_nthkey (ompi_info_t *info, int n, char *key);
147+
OMPI_DECLSPEC int ompi_info_get_nthkey (ompi_info_t *info, int n, opal_cstring_t **key);
148148
/**
149149
* ompi_info_foo() wrapper around various opal_info_foo() calls
150150
*/

ompi/mca/coll/base/coll_base_comm_select.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ static opal_list_t *check_components(opal_list_t * components,
348348
mca_coll_base_module_t *module;
349349
opal_list_t *selectable;
350350
mca_coll_base_avail_coll_t *avail;
351-
char info_val[OPAL_MAX_INFO_VAL+1];
352351
char **coll_argv = NULL, **coll_exclude = NULL, **coll_include = NULL;
353352

354353
/* Check if this communicator comes with restrictions on the collective modules
@@ -360,12 +359,14 @@ static opal_list_t *check_components(opal_list_t * components,
360359
* force a change in the component priority.
361360
*/
362361
if( NULL != comm->super.s_info) {
362+
opal_cstring_t *info_str;
363363
opal_info_get(comm->super.s_info, "ompi_comm_coll_preference",
364-
sizeof(info_val), info_val, &flag);
364+
&info_str, &flag);
365365
if( !flag ) {
366366
goto proceed_to_select;
367367
}
368-
coll_argv = opal_argv_split(info_val, ',');
368+
coll_argv = opal_argv_split(info_str->string, ',');
369+
OBJ_RELEASE(info_str);
369370
if(NULL == coll_argv) {
370371
goto proceed_to_select;
371372
}

ompi/mca/coll/han/coll_han_module.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,17 @@ mca_coll_han_comm_query(struct ompi_communicator_t * comm, int *priority)
225225
char info_val[OPAL_MAX_INFO_VAL+1];
226226

227227
/* Get the info value disaqualifying coll components */
228+
opal_cstring_t *info_str;
228229
opal_info_get(comm->super.s_info, "ompi_comm_coll_han_topo_level",
229-
sizeof(info_val), info_val, &flag);
230+
&info_str, &flag);
230231

231232
if (flag) {
232-
if (0 == strcmp(info_val, "INTER_NODE")) {
233+
if (0 == strcmp(info_str->string, "INTER_NODE")) {
233234
han_module->topologic_level = INTER_NODE;
234235
} else {
235236
han_module->topologic_level = INTRA_NODE;
236237
}
238+
OBJ_RELEASE(info_str);
237239
}
238240
}
239241

ompi/mca/common/ompio/common_ompio_file_open.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ int mca_common_ompio_set_file_defaults (ompio_file_t *fh)
415415
{
416416

417417
if (NULL != fh) {
418-
char char_stripe[MPI_MAX_INFO_VAL];
418+
opal_cstring_t *stripe_str;
419419
ompi_datatype_t *types[2];
420420
int blocklen[2] = {1, 1};
421421
ptrdiff_t d[2], base;
@@ -426,11 +426,12 @@ int mca_common_ompio_set_file_defaults (ompio_file_t *fh)
426426
fh->f_flags = 0;
427427

428428
fh->f_bytes_per_agg = OMPIO_MCA_GET(fh, bytes_per_agg);
429-
opal_info_get (fh->f_info, "cb_buffer_size", MPI_MAX_INFO_VAL, char_stripe, &flag);
429+
opal_info_get (fh->f_info, "cb_buffer_size", &stripe_str, &flag);
430430
if ( flag ) {
431431
/* Info object trumps mca parameter value */
432-
sscanf ( char_stripe, "%d", &fh->f_bytes_per_agg );
433-
OMPIO_MCA_PRINT_INFO(fh, "cb_buffer_size", char_stripe, "");
432+
sscanf ( stripe_str->string, "%d", &fh->f_bytes_per_agg );
433+
OMPIO_MCA_PRINT_INFO(fh, "cb_buffer_size", stripe_str->string, "");
434+
OBJ_RELEASE(stripe_str);
434435
}
435436

436437
fh->f_atomicity = 0;

ompi/mca/common/ompio/common_ompio_file_view.c

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -220,19 +220,21 @@ int mca_common_ompio_set_view (ompio_file_t *fh,
220220
}
221221
}
222222

223-
char char_stripe[MPI_MAX_INFO_VAL];
223+
opal_cstring_t *stripe_str;
224224
/* Check the info object set during File_open */
225-
opal_info_get (fh->f_info, "cb_nodes", MPI_MAX_INFO_VAL, char_stripe, &flag);
225+
opal_info_get (fh->f_info, "cb_nodes", &stripe_str, &flag);
226226
if ( flag ) {
227-
sscanf ( char_stripe, "%d", &num_cb_nodes );
228-
OMPIO_MCA_PRINT_INFO(fh, "cb_nodes", char_stripe, "");
227+
sscanf ( stripe_str->string, "%d", &num_cb_nodes );
228+
OMPIO_MCA_PRINT_INFO(fh, "cb_nodes", stripe_str->string, "");
229+
OBJ_RELEASE(stripe_str);
229230
}
230231
else {
231232
/* Check the info object set during file_set_view */
232-
opal_info_get (info, "cb_nodes", MPI_MAX_INFO_VAL, char_stripe, &flag);
233+
opal_info_get (info, "cb_nodes", &stripe_str, &flag);
233234
if ( flag ) {
234-
sscanf ( char_stripe, "%d", &num_cb_nodes );
235-
OMPIO_MCA_PRINT_INFO(fh, "cb_nodes", char_stripe, "");
235+
sscanf ( stripe_str->string, "%d", &num_cb_nodes );
236+
OMPIO_MCA_PRINT_INFO(fh, "cb_nodes", stripe_str->string, "");
237+
OBJ_RELEASE(stripe_str);
236238
}
237239
}
238240

@@ -323,23 +325,25 @@ int mca_common_ompio_set_view (ompio_file_t *fh,
323325
}
324326

325327
bool info_is_set=false;
326-
opal_info_get (fh->f_info, "collective_buffering", MPI_MAX_INFO_VAL, char_stripe, &flag);
328+
opal_info_get (fh->f_info, "collective_buffering", &stripe_str, &flag);
327329
if ( flag ) {
328-
if ( strncmp ( char_stripe, "false", sizeof("true") )){
330+
if ( strncmp ( stripe_str->string, "false", sizeof("true") )){
329331
info_is_set = true;
330-
OMPIO_MCA_PRINT_INFO(fh, "collective_buffering", char_stripe, "enforcing using individual fcoll component");
332+
OMPIO_MCA_PRINT_INFO(fh, "collective_buffering", stripe_str->string, "enforcing using individual fcoll component");
331333
} else {
332-
OMPIO_MCA_PRINT_INFO(fh, "collective_buffering", char_stripe, "");
334+
OMPIO_MCA_PRINT_INFO(fh, "collective_buffering", stripe_str->string, "");
333335
}
336+
OBJ_RELEASE(stripe_str);
334337
} else {
335-
opal_info_get (info, "collective_buffering", MPI_MAX_INFO_VAL, char_stripe, &flag);
338+
opal_info_get (info, "collective_buffering", &stripe_str, &flag);
336339
if ( flag ) {
337-
if ( strncmp ( char_stripe, "false", sizeof("true") )){
340+
if ( strncmp ( stripe_str->string, "false", sizeof("true") )){
338341
info_is_set = true;
339-
OMPIO_MCA_PRINT_INFO(fh, "collective_buffering", char_stripe, "enforcing using individual fcoll component");
342+
OMPIO_MCA_PRINT_INFO(fh, "collective_buffering", stripe_str->string, "enforcing using individual fcoll component");
340343
} else {
341-
OMPIO_MCA_PRINT_INFO(fh, "collective_buffering", char_stripe, "");
344+
OMPIO_MCA_PRINT_INFO(fh, "collective_buffering", stripe_str->string, "");
342345
}
346+
OBJ_RELEASE(stripe_str);
343347
}
344348
}
345349

ompi/mca/fs/gpfs/fs_gpfs_file_set_info.c

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
4444
{
4545
int rc = 0;
4646
int flag;
47-
int valueLen = MPI_MAX_INFO_VAL;
48-
char value[MPI_MAX_INFO_VAL + 1];
47+
opal_cstring_t *info_str;
4948
char gpfsHintsKey[50];
49+
bool info_bool;
5050
const char* split = ",";
5151
char* token;
5252
int ret = OMPI_SUCCESS;
@@ -163,9 +163,9 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
163163
*/
164164

165165
strcpy(gpfsHintsKey, "useSIOXLib");
166-
ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag);
166+
ompi_info_get_bool(info_selected, gpfsHintsKey, &info_bool, &flag);
167167
if (flag) {
168-
if(strcmp(value, "true") == 0) {
168+
if(info_bool) {
169169
//using the SIOX lib and the I/O pattern selection
170170
ret = mca_fs_gpfs_io_selection(fh, info, info_selected);
171171
if (ret != OMPI_SUCCESS)
@@ -179,23 +179,26 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
179179

180180
//Setting GPFS Hint - gpfsAccessRange
181181
strcpy(gpfsHintsKey, "gpfsAccessRange");
182-
ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag);
182+
ompi_info_get(info_selected, gpfsHintsKey, &info_str, &flag);
183183
if (flag) {
184184
opal_output(ompi_fs_base_framework.framework_output,
185-
"GPFS Access Range is set: %s: %s\n", gpfsHintsKey, value);
185+
"GPFS Access Range is set: %s: %s\n", gpfsHintsKey, info_str->string);
186186
gpfs_hint_AccessRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_AccessRange);
187187
gpfs_hint_AccessRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
188188
gpfs_hint_AccessRange.gpfsFcntlHeader.fcntlReserved = 0;
189189

190190
gpfs_hint_AccessRange.gpfsAccessRange.structLen =
191191
sizeof(gpfs_hint_AccessRange.gpfsAccessRange);
192192
gpfs_hint_AccessRange.gpfsAccessRange.structType = GPFS_ACCESS_RANGE;
193-
token = strtok(value, split);
193+
char *info_str_dup = strdup(info_str->string);
194+
OBJ_RELEASE(info_str);
195+
token = strtok(info_str_dup, split);
194196
gpfs_hint_AccessRange.gpfsAccessRange.start = atol(token);
195197
token = strtok(NULL, split);
196198
gpfs_hint_AccessRange.gpfsAccessRange.length = atol(token);
197199
token = strtok(NULL, split);
198200
gpfs_hint_AccessRange.gpfsAccessRange.isWrite = atoi(token);
201+
free(info_str_dup);
199202

200203
rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_AccessRange);
201204
if (rc != 0) {
@@ -209,21 +212,24 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
209212

210213
//Setting GPFS Hint - gpfsFreeRange
211214
strcpy(gpfsHintsKey, "gpfsFreeRange");
212-
ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag);
215+
ompi_info_get(info_selected, gpfsHintsKey, &info_str, &flag);
213216
if (flag) {
214217
opal_output(ompi_fs_base_framework.framework_output,
215-
"GPFS Free Range is set: %s: %s\n", gpfsHintsKey, value);
218+
"GPFS Free Range is set: %s: %s\n", gpfsHintsKey, info_str->string);
216219
gpfs_hint_FreeRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_FreeRange);
217220
gpfs_hint_FreeRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
218221
gpfs_hint_FreeRange.gpfsFcntlHeader.fcntlReserved = 0;
219222

220223
gpfs_hint_FreeRange.gpfsFreeRange.structLen =
221224
sizeof(gpfs_hint_FreeRange.gpfsFreeRange);
222225
gpfs_hint_FreeRange.gpfsFreeRange.structType = GPFS_FREE_RANGE;
223-
token = strtok(value, split);
226+
char *info_str_dup = strdup(info_str->string);
227+
OBJ_RELEASE(info_str);
228+
token = strtok(info_str_dup, split);
224229
gpfs_hint_FreeRange.gpfsFreeRange.start = atol(token);
225230
token = strtok(NULL, split);
226231
gpfs_hint_FreeRange.gpfsFreeRange.length = atol(token);
232+
free(info_str_dup);
227233

228234
rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_FreeRange);
229235
if (rc != 0) {
@@ -241,10 +247,10 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
241247

242248
//Setting GPFS Hint - gpfsClearFileCache
243249
strcpy(gpfsHintsKey, "gpfsClearFileCache");
244-
ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag);
245-
if (flag & (strcmp(value, "true") == 0)) {
250+
ompi_info_get_bool(info_selected, gpfsHintsKey, &info_bool, &flag);
251+
if (flag && info_bool) {
246252
opal_output(ompi_fs_base_framework.framework_output,
247-
"GPFS Clear File Cache is set: %s: %s\n", gpfsHintsKey, value);
253+
"GPFS Clear File Cache is set: %s\n", gpfsHintsKey);
248254
gpfs_hint_ClearFileCache.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_ClearFileCache);
249255
gpfs_hint_ClearFileCache.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
250256
gpfs_hint_ClearFileCache.gpfsFcntlHeader.fcntlReserved = 0;
@@ -265,10 +271,10 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
265271

266272
//Setting GPFS Hint - gpfsCancelHints
267273
strcpy(gpfsHintsKey, "gpfsCancelHints");
268-
ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag);
269-
if (flag & (strcmp(value, "true") == 0)) {
274+
ompi_info_get_bool(info_selected, gpfsHintsKey, &info_bool, &flag);
275+
if (flag && info_bool) {
270276
opal_output(ompi_fs_base_framework.framework_output,
271-
"GPFS Cancel Hints is set: %s: %s\n", gpfsHintsKey, value);
277+
"GPFS Cancel Hints is set: %s\n", gpfsHintsKey);
272278
gpfs_hint_CancelHints.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_CancelHints);
273279
gpfs_hint_CancelHints.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
274280
gpfs_hint_CancelHints.gpfsFcntlHeader.fcntlReserved = 0;
@@ -289,23 +295,26 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
289295

290296
//Setting GPFS Hint - gpfsSetReplication
291297
strcpy(gpfsHintsKey, "gpfsSetReplication");
292-
ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag);
298+
ompi_info_get(info_selected, gpfsHintsKey, &info_str, &flag);
293299
if (flag) {
294300
opal_output(ompi_fs_base_framework.framework_output,
295-
"GPFS Set Replication is set: %s: %s\n", gpfsHintsKey, value);
301+
"GPFS Set Replication is set: %s: %s\n", gpfsHintsKey, info_str->string);
296302
gpfs_hint_SetReplication.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_SetReplication);
297303
gpfs_hint_SetReplication.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
298304
gpfs_hint_SetReplication.gpfsFcntlHeader.fcntlReserved = 0;
299305

300306
gpfs_hint_SetReplication.gpfsSetReplication.structLen =
301307
sizeof(gpfs_hint_SetReplication.gpfsSetReplication);
302308
gpfs_hint_SetReplication.gpfsSetReplication.structType = GPFS_FCNTL_SET_REPLICATION;
303-
token = strtok(value, split);
309+
char *info_str_dup = strdup(info_str->string);
310+
OBJ_RELEASE(info_str);
311+
token = strtok(info_str_dup, split);
304312
gpfs_hint_SetReplication.gpfsSetReplication.metadataReplicas = atoi(token);
305313
gpfs_hint_SetReplication.gpfsSetReplication.maxMetadataReplicas = atoi(token);
306314
gpfs_hint_SetReplication.gpfsSetReplication.dataReplicas = atoi(token);
307315
gpfs_hint_SetReplication.gpfsSetReplication.maxDataReplicas = atoi(token);
308316
gpfs_hint_SetReplication.gpfsSetReplication.reserved = 0;
317+
free(info_str_dup);
309318

310319
rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_SetReplication);
311320
if (rc != 0) {
@@ -322,18 +331,21 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
322331

323332
//Setting GPFS Hint - gpfsByteRange
324333
strcpy(gpfsHintsKey, "gpfsByteRange");
325-
ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag);
334+
ompi_info_get(info_selected, gpfsHintsKey, &info_str, &flag);
326335
if (flag) {
327336
opal_output(ompi_fs_base_framework.framework_output,
328-
"GPFS Byte Range is set: %s: %s\n", gpfsHintsKey, value);
337+
"GPFS Byte Range is set: %s: %s\n", gpfsHintsKey, info_str->string);
329338
gpfs_hint_ByteRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_ByteRange);
330339
gpfs_hint_ByteRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
331340
gpfs_hint_ByteRange.gpfsFcntlHeader.fcntlReserved = 0;
332341

333-
token = strtok(value, split);
342+
char *info_str_dup = strdup(info_str->string);
343+
OBJ_RELEASE(info_str);
344+
token = strtok(info_str_dup, split);
334345
gpfs_hint_ByteRange.gpfsByteRange.startOffset = atol(token);
335-
token = strtok(value, split);
346+
token = strtok(NULL, split);
336347
gpfs_hint_ByteRange.gpfsByteRange.numOfBlks = atol(token);
348+
free(info_str_dup);
337349

338350
rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_ByteRange);
339351
if (rc != 0) {
@@ -347,21 +359,24 @@ int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
347359

348360
//Setting GPFS Hint - gpfsRestripeData
349361
strcpy(gpfsHintsKey, "gpfsRestripeData");
350-
ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag);
362+
ompi_info_get(info_selected, gpfsHintsKey, &info_str, &flag);
351363
if (flag) {
352364
opal_output(ompi_fs_base_framework.framework_output,
353-
"GPFS Restripe Data is set: %s: %s\n", gpfsHintsKey, value);
365+
"GPFS Restripe Data is set: %s: %s\n", gpfsHintsKey, info_str->string);
354366
gpfs_hint_RestripeData.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_RestripeData);
355367
gpfs_hint_RestripeData.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
356368
gpfs_hint_RestripeData.gpfsFcntlHeader.fcntlReserved = 0;
357369

358370
gpfs_hint_RestripeData.gpfsRestripeData.structLen =
359371
sizeof(gpfs_hint_RestripeData.gpfsRestripeData);
360372
gpfs_hint_RestripeData.gpfsRestripeData.structType = GPFS_FCNTL_RESTRIPE_DATA;
361-
token = strtok(value, split);
373+
char *info_str_dup = strdup(info_str->string);
374+
OBJ_RELEASE(info_str);
375+
token = strtok(info_str_dup, split);
362376
gpfs_hint_RestripeData.gpfsRestripeData.options = atoi(token);
363377
gpfs_hint_RestripeData.gpfsRestripeData.reserved1 = 0;
364378
gpfs_hint_RestripeData.gpfsRestripeData.reserved2 = 0;
379+
free(info_str_dup);
365380

366381
rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_RestripeData);
367382
if (rc != 0) {

0 commit comments

Comments
 (0)