Skip to content

Commit 00b0a20

Browse files
Shane SnyderShane Snyder
authored andcommitted
gracefully handle case with no DFS mount info
- when using dfs_connect, Darshan has no insight into the pool and container UUIDs being used, so gracefully allow instrumentation to proceed using null UUIDs for those values
1 parent 12fa940 commit 00b0a20

File tree

2 files changed

+34
-31
lines changed

2 files changed

+34
-31
lines changed

darshan-runtime/lib/darshan-dfs.c

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,12 @@ static int my_rank = -1;
202202
#define ID_GLOB_SIZE (sizeof(daos_obj_id_t) + (2*sizeof(uuid_t)))
203203
#define DFS_GEN_DARSHAN_REC_ID(__oid_p, __mnt_info, __rec_id) do { \
204204
unsigned char __id_glob[ID_GLOB_SIZE]; \
205-
memcpy(__id_glob, __mnt_info->pool_uuid, sizeof(__mnt_info->pool_uuid)); \
206-
memcpy(__id_glob+sizeof(__mnt_info->pool_uuid), __mnt_info->cont_uuid, sizeof(__mnt_info->cont_uuid)); \
207-
memcpy(__id_glob+sizeof(__mnt_info->pool_uuid)+sizeof(__mnt_info->cont_uuid), __oid_p, sizeof(*__oid_p)); \
205+
memset(__id_glob, 0, ID_GLOB_SIZE); \
206+
if(__mnt_info) { \
207+
memcpy(__id_glob, __mnt_info->pool_uuid, sizeof(uuid_t)); \
208+
memcpy(__id_glob+sizeof(uuid_t), __mnt_info->cont_uuid, sizeof(uuid_t)); \
209+
} \
210+
memcpy(__id_glob+(2*sizeof(uuid_t)), __oid_p, sizeof(*__oid_p)); \
208211
__rec_id = darshan_hash(__id_glob, ID_GLOB_SIZE, 0); \
209212
} while(0)
210213

@@ -219,7 +222,6 @@ static int my_rank = -1;
219222
darshan_record_id __rec_id; \
220223
struct dfs_file_record_ref *__rec_ref; \
221224
DFS_GET_MOUNT_INFO(__dfs, __mnt_info); \
222-
if(!__mnt_info) break; \
223225
if(dfs_obj2id(*__obj_p, &__oid)) break; \
224226
DFS_GEN_DARSHAN_REC_ID(&__oid, __mnt_info, __rec_id); \
225227
__rec_ref = darshan_lookup_record_ref(dfs_runtime->rec_id_hash, &__rec_id, sizeof(__rec_id)); \
@@ -677,28 +679,25 @@ int DARSHAN_DECL(dfs_remove)(dfs_t *dfs, dfs_obj_t *parent, const char *name, bo
677679

678680
DFS_PRE_RECORD();
679681
DFS_GET_MOUNT_INFO(dfs, mnt_info);
680-
if(mnt_info)
682+
DFS_GEN_DARSHAN_REC_ID(oid, mnt_info, rec_id);
683+
rec_ref = darshan_lookup_record_ref(dfs_runtime->rec_id_hash,
684+
&rec_id, sizeof(rec_id));
685+
if(!rec_ref)
681686
{
682-
DFS_GEN_DARSHAN_REC_ID(oid, mnt_info, rec_id);
683-
rec_ref = darshan_lookup_record_ref(dfs_runtime->rec_id_hash,
684-
&rec_id, sizeof(rec_id));
685-
if(!rec_ref)
687+
DFS_RESOLVE_OBJ_REC_NAME(parent, name, obj_rec_name);
688+
if(obj_rec_name)
686689
{
687-
DFS_RESOLVE_OBJ_REC_NAME(parent, name, obj_rec_name);
688-
if(obj_rec_name)
689-
{
690-
rec_ref = dfs_track_new_file_record(rec_id, obj_rec_name, mnt_info);
691-
free(obj_rec_name);
692-
}
693-
}
694-
if(rec_ref)
695-
{
696-
rec_ref->file_rec->counters[DFS_REMOVES] += 1;
697-
DARSHAN_TIMER_INC_NO_OVERLAP(
698-
rec_ref->file_rec->fcounters[DFS_F_META_TIME],
699-
tm1, tm2, rec_ref->last_meta_end);
690+
rec_ref = dfs_track_new_file_record(rec_id, obj_rec_name, mnt_info);
691+
free(obj_rec_name);
700692
}
701693
}
694+
if(rec_ref)
695+
{
696+
rec_ref->file_rec->counters[DFS_REMOVES] += 1;
697+
DARSHAN_TIMER_INC_NO_OVERLAP(
698+
rec_ref->file_rec->fcounters[DFS_F_META_TIME],
699+
tm1, tm2, rec_ref->last_meta_end);
700+
}
702701
DFS_POST_RECORD();
703702

704703
return(ret);
@@ -895,8 +894,11 @@ static struct dfs_file_record_ref *dfs_track_new_file_record(
895894
/* registering this file record was successful, so initialize some fields */
896895
file_rec->base_rec.id = rec_id;
897896
file_rec->base_rec.rank = my_rank;
898-
uuid_copy(file_rec->pool_uuid, mnt_info->pool_uuid);
899-
uuid_copy(file_rec->cont_uuid, mnt_info->cont_uuid);
897+
if(mnt_info)
898+
{
899+
uuid_copy(file_rec->pool_uuid, mnt_info->pool_uuid);
900+
uuid_copy(file_rec->cont_uuid, mnt_info->cont_uuid);
901+
}
900902
rec_ref->file_rec = file_rec;
901903
dfs_runtime->file_rec_count++;
902904

darshan-util/darshan-dfs-logutils.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,14 @@ static void darshan_log_print_dfs_file(void *file_rec, char *file_name,
213213
char pool_cont_uuid_str[128] = {0};
214214

215215
#ifdef HAVE_LIBUUID
216-
uuid_unparse(dfs_file_rec->pool_uuid, pool_cont_uuid_str);
217-
#else
218-
strcat(pool_cont_uuid_str, "N/A");
219-
#endif
220-
strcat(pool_cont_uuid_str, ":");
221-
#ifdef HAVE_LIBUUID
222-
uuid_unparse(dfs_file_rec->cont_uuid, pool_cont_uuid_str+strlen(pool_cont_uuid_str));
216+
if(!uuid_is_null(dfs_file_rec->pool_uuid) && !uuid_is_null(dfs_file_rec->cont_uuid))
217+
{
218+
uuid_unparse(dfs_file_rec->pool_uuid, pool_cont_uuid_str);
219+
strcat(pool_cont_uuid_str, ":");
220+
uuid_unparse(dfs_file_rec->cont_uuid, pool_cont_uuid_str+strlen(pool_cont_uuid_str));
221+
}
222+
else
223+
strcat(pool_cont_uuid_str, "UNKNOWN");
223224
#else
224225
strcat(pool_cont_uuid_str, "N/A");
225226
#endif

0 commit comments

Comments
 (0)