diff --git a/config.save b/config.save index 339eee7..d00fc38 100755 --- a/config.save +++ b/config.save @@ -525,7 +525,7 @@ s,@ECHO_C@,,;t t s,@ECHO_N@,-n,;t t s,@ECHO_T@,,;t t s,@LIBS@, -lcrypto -lssl -ldl,;t t -s,@PVFS2_VERSION@,2.8.6-orangefs-2012-09-17-172331,;t t +s,@PVFS2_VERSION@,2.8.6-orangefs-2012-10-01-160125,;t t s,@PVFS2_VERSION_MAJOR@,2,;t t s,@PVFS2_VERSION_MINOR@,8,;t t s,@PVFS2_VERSION_SUB@,6,;t t diff --git a/src/apps/admin/pvfs2-ls.c b/src/apps/admin/pvfs2-ls.c index 75abcc3..1282147 100644 --- a/src/apps/admin/pvfs2-ls.c +++ b/src/apps/admin/pvfs2-ls.c @@ -306,6 +306,7 @@ void print_entry_attr( if ((attr->objtype == PVFS_TYPE_METAFILE) && (attr->mask & PVFS_ATTR_SYS_SIZE)) { + printf("in_here\n"); size = attr->size; } else if ((attr->objtype == PVFS_TYPE_SYMLINK) && @@ -1093,6 +1094,7 @@ static void usage(int argc, char** argv) int main(int argc, char **argv) { + printf("START_LIST\n"); int ret = -1, i = 0; char pvfs_path[MAX_NUM_PATHS][PVFS_NAME_MAX]; PVFS_fs_id fs_id_array[MAX_NUM_PATHS] = {0}; diff --git a/src/client/sysint/osd.c b/src/client/sysint/osd.c index ab01a07..e2f5867 100644 --- a/src/client/sysint/osd.c +++ b/src/client/sysint/osd.c @@ -148,7 +148,6 @@ int PINT_copy_osd_object_attr(PVFS_object_attr *attr, struct osd_command *cmd) if (mask & PVFS_ATTR_META_DFILES) { /* u.meta.dfile_count */ attr->u.meta.dfile_count = cmd->attr[6].outlen/sizeof(PVFS_handle); - /* u.meta.dfile_array */ df_array_size = cmd->attr[6].outlen; if (df_array_size) { @@ -185,9 +184,9 @@ int PINT_copy_osd_object_attr(PVFS_object_attr *attr, struct osd_command *cmd) attr->u.meta.hint.flags = 0; /* convert ms to sec */ - attr->ctime = get_ntohtime(cmd->attr[7].val) / 1000; + /*attr->ctime = get_ntohtime(cmd->attr[7].val) / 1000; attr->atime = get_ntohtime(cmd->attr[8].val) / 1000; - attr->mtime = get_ntohtime(cmd->attr[9].val) / 1000; + attr->mtime = get_ntohtime(cmd->attr[9].val) / 1000;*/ return 0; } @@ -222,9 +221,9 @@ int PINT_copy_osd_dir_attr(PVFS_object_attr *attr, struct osd_command *cmd) attr->u.meta.hint.flags = 0; /* convert ms to sec */ - attr->ctime = get_ntohtime(cmd->attr[7].val) / 1000; + /*attr->ctime = get_ntohtime(cmd->attr[7].val) / 1000; attr->atime = get_ntohtime(cmd->attr[8].val) / 1000; - attr->mtime = get_ntohtime(cmd->attr[9].val) / 1000; + attr->mtime = get_ntohtime(cmd->attr[9].val) / 1000;*/ return 0; } diff --git a/src/client/sysint/remove.sm b/src/client/sysint/remove.sm index f07a775..513bcfc 100644 --- a/src/client/sysint/remove.sm +++ b/src/client/sysint/remove.sm @@ -178,8 +178,7 @@ static PINT_sm_action remove_getattr_analyze_results( switch(attr->objtype) { case PVFS_TYPE_METAFILE: - //assert(attr->mask & PVFS_ATTR_META_DFILES); - //assert(attr->u.meta.dfile_count > 0); + assert(attr->mask & PVFS_ATTR_META_DFILES); gossip_debug(GOSSIP_CLIENT_DEBUG, "%s: must remove %d datafiles\n", __func__, attr->u.meta.dfile_count); @@ -241,7 +240,7 @@ static PINT_sm_action remove_datafile_remove_setup_msgpair( if (attr->u.meta.dfile_array) ret = osd_command_set_remove(command, PVFS_OSD_DATA_PID, attr->u.meta.dfile_array[0]); - else + else ret = osd_command_set_remove(command, PVFS_OSD_DATA_PID, sm_p->object_ref.handle); @@ -294,7 +293,7 @@ static PINT_sm_action remove_object_remove_setup_msgpair( gossip_debug(GOSSIP_CLIENT_DEBUG, "remove state: object_remove_setup_msgpair\n"); - if (is_osd_md && (sm_p->getattr.attr.objtype != PVFS_TYPE_DIRECTORY)) { + if (is_osd_md) { /* no mdfile to remove */ js_p->error_code = OSD_MDFILE_MSGPAIR; return SM_ACTION_COMPLETE; @@ -360,6 +359,7 @@ static PINT_sm_action remove_collection( PINT_llist *cur = NULL; struct host_alias_s *cur_alias; PVFS_BMI_addr_t addr; + int is_osd_md = fsid_is_osd_md(sm_p->object_ref.fs_id); js_p->error_code = 0; @@ -367,11 +367,11 @@ static PINT_sm_action remove_collection( sm_p->object_ref.fs_id); PINT_put_server_config_struct(server_config); - if (!(server_config->member_attr) || sm_p->getattr.attr.objtype != PVFS_TYPE_DIRECTORY) { + if ((!is_osd_md && (!(server_config->member_attr) || sm_p->getattr.attr.objtype != PVFS_TYPE_DIRECTORY)) || (sm_p->getattr.attr.objtype != PVFS_TYPE_DIRECTORY && is_osd_md)) { js_p->error_code = SKIP_COLLECTION_REMOVAL; return SM_ACTION_COMPLETE; } - + cur = server_config->host_aliases; while(cur) { @@ -397,7 +397,10 @@ static PINT_sm_action remove_collection( struct osd_command *command = &sm_p->msgarray_op.msgpair.osd_command; - ret = osd_command_set_remove_collection(command, PVFS_OSD_DATA_PID, sm_p->getattr.attr.cid, 0); + if (is_osd_md) + ret = osd_command_set_remove_collection(command, PVFS_OSD_META_PID, sm_p->object_ref.handle, 0); + else + ret = osd_command_set_remove_collection(command, PVFS_OSD_DATA_PID, sm_p->getattr.attr.cid, 0); if (ret) { osd_error_xerrno(ret, "%s: osd_command_set_remove_collection failed", diff --git a/src/client/sysint/sys-create.sm b/src/client/sysint/sys-create.sm index 6b388b4..4741654 100644 --- a/src/client/sysint/sys-create.sm +++ b/src/client/sysint/sys-create.sm @@ -574,6 +574,8 @@ static int create_datafiles_comp_fn(void *v_p, oid = get_ntohll(sm_p->msgarray_op.msgarray[index].osd_command.attr[6].val); sm_p->u.create.datafile_handles[index] = oid; } + + gossip_err("create_oid: %d\n", oid); if (oid < first || oid > last) gossip_err("%s: OSD-assigned oid %llu out of range %llu-%llu\n", @@ -823,7 +825,7 @@ static PINT_sm_action create_datafiles_setup_msgpair_array( PVFS_ATTR_COMMON_CTIME | PVFS_ATTR_COMMON_MTIME | PVFS_ATTR_META_DIST | - //PVFS_ATTR_META_DFILES | + PVFS_ATTR_META_DFILES | PVFS_ATTR_COMMON_TYPE; sm_p->u.create.attr.objtype = PVFS_TYPE_METAFILE; @@ -839,7 +841,7 @@ static PINT_sm_action create_datafiles_setup_msgpair_array( for (i = 0; i < 6; i++) { attrs[i].type = ATTR_SET; - attrs[i].page = PVFS_USEROBJECT_ATTR_PG; + attrs[i].page = ANY_PG + PVFS_USEROBJECT_ATTR_PG; attrs[i].number = i; } @@ -857,17 +859,17 @@ static PINT_sm_action create_datafiles_setup_msgpair_array( attrs[4].val = &sm_p->u.create.attr.objtype; attrs[4].len = sizeof(PVFS_ds_type); - + attrs[5].val = dist_buf; attrs[5].len = PINT_DIST_PACK_SIZE(sm_p->u.create.dist); if(!sm_p->getattr.attr.cid) { - sm_p->getattr.attr.cid = COLLECTION_OID_LB; /* root directory */ + sm_p->getattr.attr.cid = sm_p->object_ref.handle; /* root directory */ } set_htonll(&attrval, sm_p->getattr.attr.cid); attrs[7].type = ATTR_SET; - attrs[7].page = USER_COLL_PG; + attrs[7].page = ANY_PG + USER_COLL_PG; attrs[7].number = 7; attrs[7].val = &attrval; attrs[7].len = 8; @@ -875,7 +877,7 @@ static PINT_sm_action create_datafiles_setup_msgpair_array( if (sm_p->u.create.datafile_handles) { attrs[6].type = ATTR_SET; - attrs[6].page = PVFS_USEROBJECT_ATTR_PG; + attrs[6].page = ANY_PG + PVFS_USEROBJECT_ATTR_PG; attrs[6].number = 6; attrs[6].val = sm_p->u.create.datafile_handles; attrs[6].len = sizeof(PVFS_handle) * sm_p->u.create.num_data_files; @@ -911,7 +913,7 @@ static PINT_sm_action create_datafiles_setup_msgpair_array( } else { - struct attribute_list attrs = {ATTR_SET, USER_COLL_PG, 1, &attrval, 8}; + struct attribute_list attrs = {ATTR_SET, ANY_PG + USER_COLL_PG, 1, &attrval, 8}; if(!sm_p->getattr.attr.cid) { sm_p->getattr.attr.cid = COLLECTION_OID_LB; /* root directory */ diff --git a/src/client/sysint/sys-getattr.sm b/src/client/sysint/sys-getattr.sm index ac4e2b9..b571562 100644 --- a/src/client/sysint/sys-getattr.sm +++ b/src/client/sysint/sys-getattr.sm @@ -542,7 +542,7 @@ static PINT_sm_action getattr_object_getattr_setup_msgpair( /* Set attr type, page and number */ for (i = 0; i < numattrs - 3; i++) { attrl[i].type = ATTR_GET; - attrl[i].page = PVFS_USEROBJECT_ATTR_PG; + attrl[i].page = ANY_PG + PVFS_USEROBJECT_ATTR_PG; attrl[i].number = i; } @@ -561,17 +561,17 @@ static PINT_sm_action getattr_object_getattr_setup_msgpair( /* ctime, atime & mtime */ attrl[7].type = ATTR_GET; - attrl[7].page = USER_TMSTMP_PG; + attrl[7].page = ANY_PG + USER_TMSTMP_PG; attrl[7].number = UTSAP_CTIME; attrl[7].len = UTSAP_CTIME_LEN; attrl[8].type = ATTR_GET; - attrl[8].page = USER_TMSTMP_PG; + attrl[8].page = ANY_PG + USER_TMSTMP_PG; attrl[8].number = UTSAP_DATA_ATIME; attrl[8].len = UTSAP_DATA_ATIME_LEN; attrl[9].type = ATTR_GET; - attrl[9].page = USER_TMSTMP_PG; + attrl[9].page = ANY_PG + USER_TMSTMP_PG; attrl[9].number = UTSAP_DATA_MTIME; attrl[9].len = UTSAP_DATA_MTIME_LEN; @@ -789,10 +789,8 @@ static int getattr_object_getattr_comp_fn( /* if we requested the datafile handles for the file, did * the datafile array get populated? */ - gossip_err("milan\n"); - assert(attr->u.meta.dfile_array && - (attr->u.meta.dfile_count > 0)); - gossip_err("baros\n"); + //assert(attr->u.meta.dfile_array && + // (attr->u.meta.dfile_count > 0)); gossip_debug(GOSSIP_GETATTR_DEBUG, "getattr_object_getattr_comp_fn: " @@ -964,7 +962,7 @@ static PINT_sm_action getattr_datafile_getattr_setup_msgpairarray( struct osd_command *command = &sm_p->msgarray_op.msgarray[i].osd_command; struct attribute_list id = { .type = ATTR_GET, - .page = 0x1, + .page = ANY_PG + 0x1, .number = 0x82, /* logical length (not used capacity) */ .len = sizeof(uint64_t), }; @@ -1377,7 +1375,7 @@ static PINT_sm_action getattr_datafile_getattr_cleanup( static PINT_sm_action getattr_acache_insert( struct PINT_smcb *smcb, job_status_s *js_p) -{ +{ struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT); PVFS_size* tmp_size = NULL; diff --git a/src/client/sysint/sys-lookup.sm b/src/client/sysint/sys-lookup.sm index 8e55f6d..720874f 100644 --- a/src/client/sysint/sys-lookup.sm +++ b/src/client/sysint/sys-lookup.sm @@ -723,7 +723,7 @@ static PINT_sm_action lookup_segment_setup_msgpair(struct PINT_smcb *smcb, seg_to_lookup = cur_seg->seg_name; attr.type = ATTR_GET; - attr.page = PVFS_USEROBJECT_DIR_PG; + attr.page = ANY_PG + PVFS_USEROBJECT_DIR_PG; attr.number = jenkins_one_at_a_time_hash((uint8_t *)seg_to_lookup, strlen(seg_to_lookup) + 1); attr.len = 1024; diff --git a/src/client/sysint/sys-mkdir.sm b/src/client/sysint/sys-mkdir.sm index 54bea6e..33e4182 100644 --- a/src/client/sysint/sys-mkdir.sm +++ b/src/client/sysint/sys-mkdir.sm @@ -75,7 +75,7 @@ machine pvfs2_client_mkdir_sm state mkdir_msg_setup_msgpair { run mkdir_msg_setup_msgpair; - OSD_MKDIR_MSGPAIR => mkdir_msg_xfer_osd_msgpair; + OSD_MKDIR_MSGPAIR => create_collection; success => mkdir_msg_xfer_msgpair; default => mkdir_msg_failure; } @@ -87,13 +87,6 @@ machine pvfs2_client_mkdir_sm default => mkdir_msg_failure; } - state mkdir_msg_xfer_osd_msgpair - { - jump pvfs2_osd_msgpairarray_sm; - success => create_collection; - default => mkdir_msg_failure; - } - state mkdir_msg_failure { run mkdir_msg_failure; @@ -338,19 +331,6 @@ static int mkdir_msg_comp_fn(void *v_p, if (server_is_osd(msg_p->svr_addr)) { struct osd_command *command = &sm_p->msgarray_op.msgpair.osd_command; - - if (command->status == 0) { - /* Stash the newly created meta handle */ - ret = osd_command_attr_resolve(command); - if (ret) { - osd_error_xerrno(ret, "%s: attr_resolve failed", __func__); - return ret; - } - oid = get_ntohll(command->attr[5].val); - sm_p->u.mkdir.metafile_handle = oid; - } - - osd_command_attr_free(command); return osd_errno_from_status(command->status); } else { @@ -425,71 +405,8 @@ static PINT_sm_action mkdir_msg_setup_msgpair( } if (server_is_osd(msg_p->svr_addr)) { - /* Create a directory object and fill in the default attributes */ - int i, numattrs = 6; - struct attribute_list attr[numattrs]; - struct osd_command *command = &sm_p->msgarray_op.msgpair.osd_command; - - /* Set attr type, page and number */ - for (i = 0; i < numattrs - 1; i++) { - attr[i].type = ATTR_SET; - attr[i].page = PVFS_USEROBJECT_ATTR_PG; - attr[i].number = i; - } - - /* uid */ - attr[0].val = &sm_p->u.mkdir.sys_attr.owner; - attr[0].len = sizeof(PVFS_uid); - - /* gid */ - attr[1].val = &sm_p->u.mkdir.sys_attr.group; - attr[1].len = sizeof(PVFS_gid); - - /* XXX Default to PVFS_PERM_VALID till we can figure out the umask */ - sm_p->u.mkdir.sys_attr.perms = PVFS_PERM_VALID; - attr[2].val = &sm_p->u.mkdir.sys_attr.perms; - attr[2].len = sizeof(PVFS_permissions); - - /* mask */ - sm_p->u.mkdir.sys_attr.mask = PVFS_ATTR_COMMON_UID | - PVFS_ATTR_COMMON_GID | - PVFS_ATTR_COMMON_PERM | - PVFS_ATTR_COMMON_ATIME | - PVFS_ATTR_COMMON_CTIME | - PVFS_ATTR_COMMON_MTIME | - PVFS_ATTR_COMMON_TYPE; - attr[3].val = &sm_p->u.mkdir.sys_attr.mask; - attr[3].len = sizeof(uint32_t); - - /* object type */ - sm_p->u.mkdir.sys_attr.objtype = PVFS_TYPE_DIRECTORY; - attr[4].val = &sm_p->u.mkdir.sys_attr.objtype; - attr[4].len = sizeof(PVFS_ds_type); - - /* retrieve oid */ - attr[5].type = ATTR_GET; - attr[5].page = CUR_CMD_ATTR_PG; - attr[5].number = CCAP_OID; - attr[5].val = NULL; - attr[5].len = CCAP_OID_LEN; - - ret = osd_command_set_create(command, PVFS_OSD_META_PID, 0, 1); - if (ret) { - osd_error_xerrno(ret, "%s: osd_command_set_create failed", - __func__); - js_p->error_code = ret; - return SM_ACTION_COMPLETE; - } - - /* Set/Retrieve the dir. attributes */ - ret = osd_command_attr_build(command, attr, numattrs); - if (ret) { - osd_error_xerrno(ret, "%s: osd_command_attr_build failed", - __func__); - js_p->error_code = ret; - return SM_ACTION_COMPLETE; - } js_p->error_code = OSD_MKDIR_MSGPAIR; + return SM_ACTION_COMPLETE; } else { PINT_SERVREQ_MKDIR_FILL( msg_p->req, @@ -530,7 +447,10 @@ static PINT_sm_action create_collection_setup_msgpair( PINT_llist *cur = NULL; struct host_alias_s *cur_alias; PVFS_BMI_addr_t addr; + int i, numattrs = 7; + uint64_t attrval; int is_osd = fsid_is_osd(sm_p->object_ref.fs_id); + int is_osd_md = fsid_is_osd_md(sm_p->object_ref.fs_id); gossip_debug(GOSSIP_CLIENT_DEBUG, "mkdir state: create_collection_setup_msgpair\n"); @@ -569,9 +489,64 @@ static PINT_sm_action create_collection_setup_msgpair( msg_p->svr_addr = addr; msg_p->comp_fn = create_collection_comp_fn; + struct attribute_list attr[numattrs]; struct osd_command *command = &sm_p->msgarray_op.msgpair.osd_command; - ret = osd_command_set_create_collection(command, PVFS_OSD_DATA_PID, sm_p->u.mkdir.cid); + if (is_osd_md) + { + /* Set attr type, page and number */ + for (i = 0; i < numattrs - 1; i++) { + attr[i].type = ATTR_SET; + attr[i].page = ANY_PG + PVFS_USEROBJECT_ATTR_PG; + attr[i].number = i; + } + + /* uid */ + attr[0].val = &sm_p->u.mkdir.sys_attr.owner; + attr[0].len = sizeof(PVFS_uid); + + /* gid */ + attr[1].val = &sm_p->u.mkdir.sys_attr.group; + attr[1].len = sizeof(PVFS_gid); + + /* XXX Default to PVFS_PERM_VALID till we can figure out the umask */ + sm_p->u.mkdir.sys_attr.perms = 0777; + attr[2].val = &sm_p->u.mkdir.sys_attr.perms; + attr[2].len = sizeof(PVFS_permissions); + + /* mask */ + sm_p->u.mkdir.sys_attr.mask = PVFS_ATTR_COMMON_UID | + PVFS_ATTR_COMMON_GID | + PVFS_ATTR_COMMON_PERM | + PVFS_ATTR_COMMON_ATIME | + PVFS_ATTR_COMMON_CTIME | + PVFS_ATTR_COMMON_MTIME | + PVFS_ATTR_COMMON_TYPE; + attr[3].val = &sm_p->u.mkdir.sys_attr.mask; + attr[3].len = sizeof(uint32_t); + + /* object type */ + sm_p->u.mkdir.sys_attr.objtype = PVFS_TYPE_DIRECTORY; + attr[4].val = &sm_p->u.mkdir.sys_attr.objtype; + attr[4].len = sizeof(PVFS_ds_type); + + /* make this new collection object a member of enclosing collection */ + set_htonll(&attrval, sm_p->object_ref.handle); + + attr[5].type = ATTR_SET; + attr[5].page = ANY_PG + USER_COLL_PG; + attr[5].val = &attrval; + attr[5].len = 8; + + /* retrieve cid, if we have osd md */ + attr[6].type = ATTR_GET; + attr[6].page = CUR_CMD_ATTR_PG; + attr[6].number = CCAP_OID; + attr[6].val = NULL; + attr[6].len = CCAP_OID_LEN; + } + + ret = osd_command_set_create_collection(command, PVFS_OSD_META_PID, sm_p->u.mkdir.cid); if (ret) { osd_error_xerrno(ret, "%s: osd_command_set_create_collection failed", @@ -580,6 +555,17 @@ static PINT_sm_action create_collection_setup_msgpair( return 1; } + if (is_osd_md) + { + ret = osd_command_attr_build(command, attr, numattrs); + if (ret) { + osd_error_xerrno(ret, "%s: osd_command_attr_build failed", + __func__); + js_p->error_code = ret; + return SM_ACTION_COMPLETE; + } + } + PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op); return SM_ACTION_COMPLETE; } @@ -593,6 +579,7 @@ static int create_collection_comp_fn(void *v_p, PVFS_error status; int ret; int is_osd = fsid_is_osd(sm_p->object_ref.fs_id); + int is_osd_md = fsid_is_osd_md(sm_p->object_ref.fs_id); gossip_debug(GOSSIP_CLIENT_DEBUG, "create_collection_comp_fn\n"); @@ -609,7 +596,19 @@ static int create_collection_comp_fn(void *v_p, return status; } + if (is_osd_md) + { + ret = osd_command_attr_resolve(&sm_p->msgarray_op.msgpair.osd_command); + if (ret) { + osd_error_xerrno(ret, "%s: attr_resolve failed", __func__); + return ret; + } + sm_p->u.mkdir.cid = get_ntohll(sm_p->msgarray_op.msgpair.osd_command.attr[6].val); + } + + gossip_err("cid_mkdir: %d\n", sm_p->u.mkdir.cid); sm_p->object_ref.cid = sm_p->u.mkdir.cid; + sm_p->u.mkdir.metafile_handle = sm_p->object_ref.cid; return 0; } diff --git a/src/client/sysint/sys-osd-dir.sm b/src/client/sysint/sys-osd-dir.sm index 016e432..0512897 100644 --- a/src/client/sysint/sys-osd-dir.sm +++ b/src/client/sysint/sys-osd-dir.sm @@ -295,7 +295,7 @@ static PINT_sm_action osd_dirops_attr1_remove_setup_msgpair( object_name = sm_p->u.remove.object_name; attr.type = ATTR_GET; - attr.page = PVFS_USEROBJECT_DIR_PG; + attr.page = ANY_PG + PVFS_USEROBJECT_DIR_PG; attr.number = jenkins_one_at_a_time_hash((uint8_t *)object_name, strlen(object_name) + 1); attr.len = 1024; @@ -398,7 +398,7 @@ static PINT_sm_action osd_dirops_attr1_setup_msgpair( /* cmp */ attr[0].type = ATTR_SET; - attr[0].page = PVFS_USEROBJECT_DIR_PG; + attr[0].page = ANY_PG + PVFS_USEROBJECT_DIR_PG; attr[0].number = jenkins_one_at_a_time_hash((uint8_t *)object_name, strlen(object_name) + 1); attr[0].val = NULL; @@ -406,7 +406,7 @@ static PINT_sm_action osd_dirops_attr1_setup_msgpair( /* swp */ attr[1].type = ATTR_SET; - attr[1].page = PVFS_USEROBJECT_DIR_PG; + attr[1].page = ANY_PG + PVFS_USEROBJECT_DIR_PG; attr[1].number = attr[0].number; attr[1].val = dirent; @@ -418,7 +418,7 @@ static PINT_sm_action osd_dirops_attr1_setup_msgpair( * that the handles are the same, like the lock 0/1 case. */ attr[2].type = ATTR_RESULT; - attr[2].page = PVFS_USEROBJECT_DIR_PG; + attr[2].page = ANY_PG + PVFS_USEROBJECT_DIR_PG; attr[2].number = attr[0].number; attr[2].val = NULL; attr[2].len = 0; @@ -441,7 +441,7 @@ static PINT_sm_action osd_dirops_attr1_setup_msgpair( /* cmp */ attr[0].type = ATTR_SET; - attr[0].page = PVFS_USEROBJECT_DIR_PG; + attr[0].page = ANY_PG + PVFS_USEROBJECT_DIR_PG; attr[0].number = jenkins_one_at_a_time_hash((uint8_t *)object_name, strlen(object_name) + 1); attr[0].val = NULL; @@ -449,13 +449,13 @@ static PINT_sm_action osd_dirops_attr1_setup_msgpair( /* swp */ attr[1].type = ATTR_SET; - attr[1].page = PVFS_USEROBJECT_DIR_PG; + attr[1].page = ANY_PG + PVFS_USEROBJECT_DIR_PG; attr[1].number = attr[0].number; attr[1].val = dirent; /* result */ attr[2].type = ATTR_RESULT; - attr[2].page = PVFS_USEROBJECT_DIR_PG; + attr[2].page = ANY_PG + PVFS_USEROBJECT_DIR_PG; attr[2].number = attr[0].number; attr[2].val = NULL; attr[2].len = 0; @@ -468,7 +468,7 @@ static PINT_sm_action osd_dirops_attr1_setup_msgpair( /* cmp */ attr[0].type = ATTR_SET; - attr[0].page = PVFS_USEROBJECT_DIR_PG; + attr[0].page = ANY_PG + PVFS_USEROBJECT_DIR_PG; attr[0].number = jenkins_one_at_a_time_hash((uint8_t *)object_name, strlen(object_name) + 1); attr[0].len = 8 + strlen(sm_p->u.remove.object_name) + 1; @@ -484,14 +484,14 @@ static PINT_sm_action osd_dirops_attr1_setup_msgpair( /* swp */ attr[1].type = ATTR_SET; - attr[1].page = PVFS_USEROBJECT_DIR_PG; + attr[1].page = ANY_PG + PVFS_USEROBJECT_DIR_PG; attr[1].number = attr[0].number; attr[1].val = NULL; attr[1].len = 0; /* result */ attr[2].type = ATTR_RESULT; - attr[2].page = PVFS_USEROBJECT_DIR_PG; + attr[2].page = ANY_PG + PVFS_USEROBJECT_DIR_PG; attr[2].number = attr[0].number; attr[2].val = dirent; attr[2].len = attr[0].len; @@ -685,7 +685,7 @@ static PINT_sm_action osd_dirops_attr4_setup_lock_msgpair( } else { return 1; } - + ret = osd_command_set_cas(command, PVFS_OSD_META_PID, oid, 8, 0); if (ret) { osd_error_xerrno(ret, "%s: osd_command_set_cas failed", __func__); @@ -807,7 +807,7 @@ static PINT_sm_action osd_dirops_attr4_remove_setup_msgpair( object_name = sm_p->u.remove.object_name; attr.type = ATTR_GET; - attr.page = PVFS_USEROBJECT_DIR_PG; + attr.page = ANY_PG + PVFS_USEROBJECT_DIR_PG; attr.number = jenkins_one_at_a_time_hash((uint8_t *)object_name, strlen(object_name) + 1); attr.len = 1024; @@ -919,7 +919,7 @@ static PINT_sm_action osd_dirops_attr4_setup_lookup_msgpair( /* Perform lookup */ attr.type = ATTR_GET; - attr.page = PVFS_USEROBJECT_DIR_PG; + attr.page = ANY_PG + PVFS_USEROBJECT_DIR_PG; attr.number = jenkins_one_at_a_time_hash((uint8_t *)object_name, strlen(object_name) + 1); attr.len = 1024; @@ -1010,7 +1010,7 @@ static PINT_sm_action osd_dirops_attr4_setup_insert_remove_msgpair( /* Insert dirent as attribute of directory object */ attr.type = ATTR_SET; - attr.page = PVFS_USEROBJECT_DIR_PG; + attr.page = ANY_PG + PVFS_USEROBJECT_DIR_PG; if (smcb->op == PVFS_SYS_CREATE) { /* insert dirent */ @@ -1038,7 +1038,7 @@ static PINT_sm_action osd_dirops_attr4_setup_insert_remove_msgpair( js_p->error_code = -PVFS_ENOMEM; return 1; } - + set_htonll(dirent, sm_p->u.mkdir.metafile_handle); strcpy((char *)&dirent[8], sm_p->u.mkdir.object_name); attr.val = dirent; @@ -1064,6 +1064,7 @@ static PINT_sm_action osd_dirops_attr4_setup_insert_remove_msgpair( attr.number = jenkins_one_at_a_time_hash((uint8_t *)object_name, strlen(object_name) + 1); + gossip_err("sertac: %d\n", attr.number); ret = osd_command_set_set_attributes(command, PVFS_OSD_META_PID, oid); if (ret) { diff --git a/src/client/sysint/sys-osd-io.sm b/src/client/sysint/sys-osd-io.sm index e5db041..de554dd 100644 --- a/src/client/sysint/sys-osd-io.sm +++ b/src/client/sysint/sys-osd-io.sm @@ -408,14 +408,14 @@ static int osd_io_setup_msgpairs(struct PINT_smcb *smcb, job_status_s *js_p) PINT_dist_encode(dist_buf, sm_p->getattr.attr.u.meta.dist); struct attribute_list attrs[] = { - {ATTR_SET, PVFS_USEROBJECT_ATTR_PG, 0, &attr->owner, sizeof(PVFS_uid)}, - {ATTR_SET, PVFS_USEROBJECT_ATTR_PG, 1, &attr->group, sizeof(PVFS_gid)}, - {ATTR_SET, PVFS_USEROBJECT_ATTR_PG, 2, &attr->perms, sizeof(PVFS_permissions)}, - {ATTR_SET, PVFS_USEROBJECT_ATTR_PG, 3, &attr->mask, sizeof(uint32_t)}, - {ATTR_SET, PVFS_USEROBJECT_ATTR_PG, 4, &attr->objtype, sizeof(PVFS_ds_type)}, - {ATTR_SET, PVFS_USEROBJECT_ATTR_PG, 5, dist_buf, PINT_DIST_PACK_SIZE(sm_p->getattr.attr.u.meta.dist)}, - {ATTR_SET, PVFS_USEROBJECT_ATTR_PG, 6, attr->u.meta.dfile_array, sizeof(PVFS_handle) * sm_p->getattr.attr.u.meta.dfile_count }, - {ATTR_SET, USER_COLL_PG, 7, &attrval, 8}}; + {ATTR_SET, ANY_PG + PVFS_USEROBJECT_ATTR_PG, 0, &attr->owner, sizeof(PVFS_uid)}, + {ATTR_SET, ANY_PG + PVFS_USEROBJECT_ATTR_PG, 1, &attr->group, sizeof(PVFS_gid)}, + {ATTR_SET, ANY_PG + PVFS_USEROBJECT_ATTR_PG, 2, &attr->perms, sizeof(PVFS_permissions)}, + {ATTR_SET, ANY_PG + PVFS_USEROBJECT_ATTR_PG, 3, &attr->mask, sizeof(uint32_t)}, + {ATTR_SET, ANY_PG + PVFS_USEROBJECT_ATTR_PG, 4, &attr->objtype, sizeof(PVFS_ds_type)}, + {ATTR_SET, ANY_PG + PVFS_USEROBJECT_ATTR_PG, 5, dist_buf, PINT_DIST_PACK_SIZE(sm_p->getattr.attr.u.meta.dist)}, + {ATTR_SET, ANY_PG + PVFS_USEROBJECT_ATTR_PG, 6, attr->u.meta.dfile_array, sizeof(PVFS_handle) * sm_p->getattr.attr.u.meta.dfile_count }, + {ATTR_SET, ANY_PG + USER_COLL_PG, 7, &attrval, 8}}; if(!sm_p->getattr.attr.cid) { sm_p->getattr.attr.cid = COLLECTION_OID_LB; /* root directory */ @@ -427,7 +427,7 @@ static int osd_io_setup_msgpairs(struct PINT_smcb *smcb, job_status_s *js_p) } else { - struct attribute_list attrs = {ATTR_SET, USER_COLL_PG, 1, &attrval, 8}; + struct attribute_list attrs = {ATTR_SET, ANY_PG + USER_COLL_PG, 1, &attrval, 8}; if(!sm_p->getattr.attr.cid) { sm_p->getattr.attr.cid = COLLECTION_OID_LB; /* root directory */ diff --git a/src/client/sysint/sys-readdir.sm b/src/client/sysint/sys-readdir.sm index 1083b7a..cb56df5 100644 --- a/src/client/sysint/sys-readdir.sm +++ b/src/client/sysint/sys-readdir.sm @@ -243,6 +243,7 @@ static PINT_sm_action readdir_msg_setup_msgpair( struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT); int ret = -PVFS_EINVAL; PINT_sm_msgpair_state *msg_p = NULL; + int is_osd_md = fsid_is_osd_md(sm_p->object_ref.fs_id); gossip_debug(GOSSIP_CLIENT_DEBUG, "readdir state: " "readdir_msg_setup_msgpair\n"); @@ -254,7 +255,7 @@ static PINT_sm_action readdir_msg_setup_msgpair( js_p->error_code = 0; if(!sm_p->getattr.attr.cid) { - sm_p->object_ref.cid = COLLECTION_OID_LB; /* root directory */ + sm_p->object_ref.cid = (is_osd_md ? sm_p->object_ref.handle : COLLECTION_OID_LB); /* root directory */ } else { sm_p->object_ref.cid = sm_p->getattr.attr.cid; } @@ -292,6 +293,9 @@ static PINT_sm_action readdir_msg_setup_msgpair( /* Retrieve all the directory entries */ oid = sm_p->object_ref.handle; + + /* Retrieve the attributes of the collection object */ + /* Retrieved attribute numbers are the hashed name of each directory entry */ ret = osd_command_set_get_attributes(command, PVFS_OSD_META_PID, oid); if (ret) { osd_error_xerrno(ret, "%s: osd_command_set_get_attributes failed", @@ -300,13 +304,13 @@ static PINT_sm_action readdir_msg_setup_msgpair( return 1; } - ret = osd_command_attr_all_build(command, PVFS_USEROBJECT_DIR_PG); - if (ret) { - osd_error_xerrno(ret, "%s: osd_command_attr_all_build failed", - __func__); - js_p->error_code = ret; - return 1; - } + ret = osd_command_attr_all_build(command, ANY_PG + PVFS_USEROBJECT_DIR_PG); + if (ret) { + osd_error_xerrno(ret, "%s: osd_command_attr_all_build failed", + __func__); + js_p->error_code = ret; + return 1; + } } else { js_p->error_code = 0; PINT_SERVREQ_READDIR_FILL( diff --git a/src/client/sysint/sys-readdirplus.sm b/src/client/sysint/sys-readdirplus.sm index 428406c..8fa00ee 100644 --- a/src/client/sysint/sys-readdirplus.sm +++ b/src/client/sysint/sys-readdirplus.sm @@ -68,17 +68,17 @@ machine pvfs2_client_readdirplus_sm default => readdirplus_msg_failure; } - state readdirplus_fetch_attrs_xfer_osd_msgpair + state readdirplus_fetch_attrs_xfer_msgpair { - jump pvfs2_osd_msgpairarray_sm; + jump pvfs2_msgpairarray_sm; success => readdirplus_fetch_sizes_setup_msgpair; default => readdirplus_msg_failure; } - state readdirplus_fetch_attrs_xfer_msgpair + state readdirplus_fetch_attrs_xfer_osd_msgpair { - jump pvfs2_msgpairarray_sm; - success => readdirplus_fetch_sizes_setup_msgpair; + jump pvfs2_osd_msgpairarray_sm; + success => cleanup; default => readdirplus_msg_failure; } @@ -332,7 +332,7 @@ static int create_partition_handles(PVFS_fs_id fsid, int input_handle_count, *svr_addr_array = NULL; *per_server_handle_count = NULL; *per_server_handles = NULL; - + do { for (i = 0; i < input_handle_count; i++) { @@ -415,6 +415,8 @@ static int list_of_meta_servers(PINT_client_sm *sm_p) PVFS_sysresp_readdirplus *readdirplus_resp = sm_p->u.readdirplus.readdirplus_resp; int i, ret, err_array_len, attr_array_len; + gossip_err("LIST_OF_META_SERVERS\n"); + int is_osd_md = fsid_is_osd_md(sm_p->object_ref.fs_id); assert(readdirplus_resp); err_array_len = (sizeof(PVFS_error) * readdirplus_resp->pvfs_dirent_outcount); @@ -453,8 +455,10 @@ static int list_of_meta_servers(PINT_client_sm *sm_p) readdirplus_resp->stat_err_array = NULL; return -PVFS_ENOMEM; } + sm_p->u.readdirplus.obj_attr_array = (PVFS_object_attr *) calloc(sm_p->u.readdirplus.nhandles, sizeof(PVFS_object_attr)); + if (sm_p->u.readdirplus.obj_attr_array == NULL) { free(readdirplus_resp->attr_array); @@ -463,8 +467,10 @@ static int list_of_meta_servers(PINT_client_sm *sm_p) readdirplus_resp->stat_err_array = NULL; return -PVFS_ENOMEM; } + sm_p->u.readdirplus.size_array = (PVFS_size **) calloc(sm_p->u.readdirplus.nhandles, sizeof(PVFS_size *)); + if (sm_p->u.readdirplus.size_array == NULL) { free(readdirplus_resp->attr_array); @@ -500,6 +506,7 @@ static PINT_sm_action readdirplus_fetch_attrs_setup_msgpair(struct PINT_smcb *sm int i, ret; struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT); PINT_sm_msgpair_state *msg_p = NULL; + int is_osd_md = fsid_is_osd_md(sm_p->object_ref.fs_id); gossip_debug(GOSSIP_CLIENT_DEBUG, "readdirplus state: fetch_attrs_setup\n"); /* if there are no dirents then return NO_WORK */ @@ -513,62 +520,113 @@ static PINT_sm_action readdirplus_fetch_attrs_setup_msgpair(struct PINT_smcb *sm /* From the readdirplus structure figure out which meta servers * we need to speak to to get the attribute information */ - if ((ret = list_of_meta_servers(sm_p)) < 0) - { - gossip_err("Could not locate list of attribute servers %d\n", ret); - js_p->error_code = ret; - return SM_ACTION_COMPLETE; - } - if (sm_p->u.readdirplus.svr_count == 0) - { - gossip_err("Number of meta servers to contact cannot be 0 %d\n", -PVFS_EINVAL); - js_p->error_code = -PVFS_EINVAL; - return SM_ACTION_COMPLETE; - } - - ret = PINT_msgpairarray_init( - &sm_p->msgarray_op, sm_p->u.readdirplus.svr_count); - if(ret != 0) - { - gossip_err("Failed to initialize %d msgpairs\n", - sm_p->u.readdirplus.svr_count); - js_p->error_code = ret; - return SM_ACTION_COMPLETE; - } - foreach_msgpair(&sm_p->msgarray_op, msg_p, i) - { - msg_p->fs_id = sm_p->object_ref.fs_id; - msg_p->handle = PVFS_HANDLE_NULL; - msg_p->retry_flag = PVFS_MSGPAIR_RETRY; - msg_p->comp_fn = readdirplus_fetch_attrs_comp_fn; - msg_p->svr_addr = sm_p->u.readdirplus.server_addresses[i]; - - if (server_is_osd(msg_p->svr_addr)) - { - uint64_t oid; - struct osd_command *command = &sm_p->msgarray_op.msgpair.osd_command; + if ((ret = list_of_meta_servers(sm_p)) < 0) + { + gossip_err("Could not locate list of attribute servers %d\n", ret); + js_p->error_code = ret; + return SM_ACTION_COMPLETE; + } + if (sm_p->u.readdirplus.svr_count == 0) + { + gossip_err("Number of meta servers to contact cannot be 0 %d\n", -PVFS_EINVAL); + js_p->error_code = -PVFS_EINVAL; + return SM_ACTION_COMPLETE; + } + + ret = PINT_msgpairarray_init( + &sm_p->msgarray_op, sm_p->u.readdirplus.svr_count); + if(ret != 0) + { + gossip_err("Failed to initialize %d msgpairs\n", + sm_p->u.readdirplus.svr_count); + js_p->error_code = ret; + return SM_ACTION_COMPLETE; + } - /* Retrieve all the directory entries */ - oid = sm_p->object_ref.handle; - ret = osd_command_set_get_attributes(command, PVFS_OSD_META_PID, oid); - if (ret) { - osd_error_xerrno(ret, "%s: osd_command_set_get_attributes failed", - __func__); - js_p->error_code = ret; - return 1; + if (is_osd_md) /* we have a osd metadata server */ + { + /*osd data server has the attributes of the file*/ + /*fetch the attributes from the I/O server*/ + + sm_p->msgarray_op.msgarray[0].handle = sm_p->object_ref.cid; + sm_p->msgarray_op.msgarray[0].fs_id = sm_p->object_ref.fs_id; + sm_p->msgarray_op.msgarray[0].retry_flag = PVFS_MSGPAIR_RETRY; + sm_p->msgarray_op.msgarray[0].comp_fn = readdirplus_fetch_attrs_comp_fn; + sm_p->msgarray_op.msgarray[0].svr_addr = sm_p->u.readdirplus.server_addresses[0]; + + int j, numattrs = 10; + struct attribute_list attrl[numattrs]; + + /* Set attr type */ + for (j = 0; j < numattrs; j++) { + if (sm_p->u.readdirplus.nhandles == 1) { + attrl[j].type = ATTR_GET; + } else { + attrl[j].type = ATTR_GET_MULTI; } + } - ret = osd_command_attr_all_build(command, PVFS_USEROBJECT_DIR_PG); - if (ret) { - osd_error_xerrno(ret, "%s: osd_command_attr_all_build failed", - __func__); - js_p->error_code = ret; - return 1; - } - js_p->error_code = OSD_MSGPAIR; + /* Set attr page and number */ + for (j = 0; j < numattrs - 3; j++) { + attrl[j].page = ANY_PG + PVFS_USEROBJECT_ATTR_PG; + attrl[j].number = j; + } - } else { + /* uid, gid & perms */ + attrl[0].len = sizeof(PVFS_uid); + attrl[1].len = sizeof(PVFS_gid); + attrl[2].len = sizeof(PVFS_permissions); + + /* mask, object type & dist */ + attrl[3].len = sizeof(uint32_t); + attrl[4].len = sizeof(PVFS_ds_type); + attrl[5].len = 1024; + + /* dfile_array */ + attrl[6].len = 1024; + + /* ctime, atime & mtime */ + attrl[7].page = ANY_PG + USER_TMSTMP_PG; + attrl[7].number = UTSAP_CTIME; + attrl[7].len = UTSAP_CTIME_LEN; + + attrl[8].page = ANY_PG + USER_TMSTMP_PG; + attrl[8].number = UTSAP_DATA_ATIME; + attrl[8].len = UTSAP_DATA_ATIME_LEN; + + attrl[9].page = ANY_PG + USER_TMSTMP_PG; + attrl[9].number = UTSAP_DATA_MTIME; + attrl[9].len = UTSAP_DATA_MTIME_LEN; + + struct osd_command *command = &sm_p->msgarray_op.msgarray[0].osd_command; + + ret = osd_command_set_get_member_attributes(command, PVFS_OSD_META_PID, sm_p->object_ref.handle, find_min_handle(sm_p->u.readdirplus.input_handle_array, sm_p->u.readdirplus.nhandles)); + if (ret) { + osd_error_xerrno(ret, "%s: osd_command_set_get_member_attributes failed", + __func__); + js_p->error_code = ret; + return 1; + } + + ret = osd_command_multi_attr_build(command, attrl, numattrs, sm_p->u.readdirplus.nhandles); + if (ret) { + osd_error_xerrno(ret, "%s: osd_command_attr_build failed", + __func__); + js_p->error_code = ret; + return 1; + } + + js_p->error_code = OSD_MSGPAIR; + } else { + foreach_msgpair(&sm_p->msgarray_op, msg_p, i) + { + msg_p->fs_id = sm_p->object_ref.fs_id; + msg_p->handle = PVFS_HANDLE_NULL; + msg_p->retry_flag = PVFS_MSGPAIR_RETRY; + msg_p->comp_fn = readdirplus_fetch_attrs_comp_fn; + msg_p->svr_addr = sm_p->u.readdirplus.server_addresses[i]; + PINT_SERVREQ_LISTATTR_FILL( msg_p->req, *sm_p->cred_p, @@ -579,7 +637,7 @@ static PINT_sm_action readdirplus_fetch_attrs_setup_msgpair(struct PINT_smcb *sm sm_p->hints); /* immediate return. next state jumps to msgpairarray machine */ js_p->error_code = 0; - } + } } PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op); @@ -592,79 +650,125 @@ static int readdirplus_fetch_attrs_comp_fn(void *v_p, int index) { gossip_err("readdirplus_fetch_attrs_comp_fn\n"); + int ret, status; + PVFS_object_attr *attr = NULL; PINT_smcb *smcb = v_p; PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM); + int is_osd = fsid_is_osd(sm_p->object_ref.fs_id); + int64_t size[sm_p->u.readdirplus.nhandles]; + + attr = &sm_p->getattr.attr; gossip_debug(GOSSIP_LISTATTR_DEBUG, "readdirplus_fetch_attrs_comp_fn called\n"); - gossip_err("status: %d\n", sm_p->msgarray_op.msgarray[index].op_status); - assert(resp_p->op == PVFS_SERV_LISTATTR); - + if (is_osd) { + status = osd_errno_from_status( + sm_p->msgarray_op.msgarray[index].osd_command.status); + } else { + assert(resp_p->op == PVFS_SERV_LISTATTR); + status = resp_p->status; + } + + if (status != 0) + { + return status; + } + /* Mark all handles in this server range as having failed a stat */ - gossip_err("status: %d\n", sm_p->msgarray_op.msgarray[index].op_status); if (sm_p->msgarray_op.msgarray[index].op_status != 0) { int i, handle_index; for (i = 0; i < sm_p->u.readdirplus.handle_count[index]; i++) { get_handle_index(sm_p->u.readdirplus.input_handle_array, - sm_p->u.readdirplus.nhandles, - sm_p->u.readdirplus.handles[index][i], - &handle_index, - NULL); + sm_p->u.readdirplus.nhandles, + sm_p->u.readdirplus.handles[index][i], + &handle_index, + NULL); assert(handle_index >= 0); sm_p->u.readdirplus.readdirplus_resp->stat_err_array[handle_index] = - sm_p->msgarray_op.msgarray[index].op_status; + sm_p->msgarray_op.msgarray[index].op_status; } } else if (sm_p->msgarray_op.msgarray[index].op_status == 0) { /* fetch all errors from the servresp structure and copy the object attributes */ - int i, handle_index; + int i, handle_index, aux_index; - /* make sure that we get back responses for all handles that we sent out */ - assert(resp_p->u.listattr.nhandles == sm_p->u.readdirplus.handle_count[index]); - for (i = 0; i < sm_p->u.readdirplus.handle_count[index]; i++) - { - get_handle_index(sm_p->u.readdirplus.input_handle_array, - sm_p->u.readdirplus.nhandles, - sm_p->u.readdirplus.handles[index][i], - &handle_index, - NULL); - assert(handle_index >= 0); - /* Copy any errors */ - sm_p->u.readdirplus.readdirplus_resp->stat_err_array[handle_index] = - resp_p->u.listattr.error[i]; - if (resp_p->u.listattr.error[i] == 0) - { - /* if no errors, stash the object attributes */ - PINT_copy_object_attr(&sm_p->u.readdirplus.obj_attr_array[handle_index], - &resp_p->u.listattr.attr[i]); + if (is_osd) { + for (i = 0; i < sm_p->u.readdirplus.handle_count[index]; i++) { + get_handle_index(sm_p->u.readdirplus.input_handle_array, + sm_p->u.readdirplus.nhandles, + sm_p->u.readdirplus.handles[index][i], + &handle_index, + NULL); + assert(handle_index >= 0); } + + struct osd_command *command = &sm_p->msgarray_op.msgarray[index].osd_command; + + int ret = osd_command_attr_resolve(command); + if (ret) { + osd_error_xerrno(ret, "%s: osd_command_attr_resolve failed", + __func__); + return ret; + } + + if (*(PVFS_ds_type*)command->attr[4].val == PVFS_TYPE_DIRECTORY) { + PINT_copy_osd_dir_attr(&sm_p->u.readdirplus.obj_attr_array[handle_index], command); + } else { + PINT_copy_osd_object_attr(&sm_p->u.readdirplus.obj_attr_array[handle_index], command); + } + + osd_command_attr_free(command); } - } - - /* if this is the last response, check all the status values - and return error codes if any requests failed - */ - if (index == (sm_p->msgarray_op.count - 1)) - { - int i; - for (i = 0; i < sm_p->msgarray_op.count; i++) + else { - if (sm_p->msgarray_op.msgarray[i].op_status != 0) + /* make sure that we get back responses for all handles that we sent out */ + assert(resp_p->u.listattr.nhandles == sm_p->u.readdirplus.handle_count[index]); + for (i = 0; i < sm_p->u.readdirplus.handle_count[index]; i++) { - return sm_p->msgarray_op.msgarray[i].op_status; + get_handle_index(sm_p->u.readdirplus.input_handle_array, + sm_p->u.readdirplus.nhandles, + sm_p->u.readdirplus.handles[index][i], + &handle_index, + NULL); + assert(handle_index >= 0); + /* Copy any errors */ + sm_p->u.readdirplus.readdirplus_resp->stat_err_array[handle_index] = + resp_p->u.listattr.error[i]; + if (resp_p->u.listattr.error[i] == 0) + { + /* if no errors, stash the object attributes */ + PINT_copy_object_attr(&sm_p->u.readdirplus.obj_attr_array[handle_index], + &resp_p->u.listattr.attr[i]); + } } } - /* destroy scratch space.. we need to reuse them in phase 2 */ - destroy_partition_handles(&sm_p->u.readdirplus.svr_count, - &sm_p->u.readdirplus.server_addresses, - &sm_p->u.readdirplus.handle_count, - &sm_p->u.readdirplus.handles); - free(sm_p->u.readdirplus.input_handle_array); - sm_p->u.readdirplus.input_handle_array = NULL; - sm_p->u.readdirplus.nhandles = 0; - } + } + + /* if this is the last response, check all the status values + and return error codes if any requests failed + */ + if (index == (sm_p->msgarray_op.count - 1)) + { + int i; + for (i = 0; i < sm_p->msgarray_op.count; i++) + { + if (sm_p->msgarray_op.msgarray[i].op_status != 0) + { + return sm_p->msgarray_op.msgarray[i].op_status; + } + } + /* destroy scratch space.. we need to reuse them in phase 2 */ + destroy_partition_handles(&sm_p->u.readdirplus.svr_count, + &sm_p->u.readdirplus.server_addresses, + &sm_p->u.readdirplus.handle_count, + &sm_p->u.readdirplus.handles); + free(sm_p->u.readdirplus.input_handle_array); + sm_p->u.readdirplus.input_handle_array = NULL; + sm_p->u.readdirplus.nhandles = 0; + } + return 0; } @@ -673,10 +777,12 @@ static int list_of_data_servers(PINT_client_sm *sm_p) { int i, ret, nhandles; + gossip_err("LIST_OF_DATA_SERVERS\n"); sm_p->u.readdirplus.svr_count = 0; sm_p->u.readdirplus.server_addresses = NULL; sm_p->u.readdirplus.handles = NULL; sm_p->u.readdirplus.handle_count = NULL; + /* Go thru the list of handles and find out which ones are regular files * and send out messages to servers for the sizes of the dfile handles */ @@ -700,6 +806,7 @@ static int list_of_data_servers(PINT_client_sm *sm_p) } } } + /* no meta files */ if (nhandles == 0) return 0; @@ -760,6 +867,7 @@ static PINT_sm_action readdirplus_fetch_sizes_setup_msgpair( struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT); PINT_sm_msgpair_state *msg_p; int is_osd = fsid_is_osd(sm_p->object_ref.fs_id); + int is_osd_md = fsid_is_osd_md(sm_p->object_ref.fs_id); struct server_configuration_s *server_config; server_config = PINT_get_server_config_struct( @@ -774,19 +882,20 @@ static PINT_sm_action readdirplus_fetch_sizes_setup_msgpair( js_p->error_code = NO_WORK; return SM_ACTION_COMPLETE; } - - /* ok, now we have all the data files. split it on a per-server basis */ - if ((ret = list_of_data_servers(sm_p)) < 0) - { - js_p->error_code = ret; - return SM_ACTION_COMPLETE; - } - if (sm_p->u.readdirplus.svr_count == 0) - { - /* no need to contact any server since there are no regular meta files */ - js_p->error_code = NO_WORK; - return SM_ACTION_COMPLETE; - } + + /* ok, now we have all the data files. split it on a per-server basis */ + if ((ret = list_of_data_servers(sm_p)) < 0) + { + js_p->error_code = ret; + return SM_ACTION_COMPLETE; + } + gossip_err("sm_p->u.readdirplus.svr_count: %d\n", sm_p->u.readdirplus.svr_count); + if (sm_p->u.readdirplus.svr_count == 0) + { + /* no need to contact any server since there are no regular meta files */ + js_p->error_code = NO_WORK; + return SM_ACTION_COMPLETE; + } if (is_osd) { @@ -852,16 +961,55 @@ static PINT_sm_action readdirplus_fetch_sizes_setup_msgpair( msg_p->svr_addr = sm_p->u.readdirplus.server_addresses[0]; msg_p->handle = sm_p->u.readdirplus.input_handle_array[i].handle; - struct attribute_list id = { - .type = ATTR_GET, - .page = 0x1, - .number = 0x82, /* logical length (not used capacity) */ - .len = sizeof(uint64_t), - }; + int j, numattrs = 11; + struct attribute_list attrl[numattrs]; + + /* Set attr type, page and number */ + for (j = 0; j < numattrs - 4; j++) { + attrl[j].type = ATTR_GET; + attrl[j].page = ANY_PG + PVFS_USEROBJECT_ATTR_PG; + attrl[j].number = j; + } + + /* uid, gid & perms */ + attrl[0].len = sizeof(PVFS_uid); + attrl[1].len = sizeof(PVFS_gid); + attrl[2].len = sizeof(PVFS_permissions); + + /* mask, object type & dist */ + attrl[3].len = sizeof(uint32_t); + attrl[4].len = sizeof(PVFS_ds_type); + attrl[5].len = 1024; + + /* dfile_array */ + attrl[6].len = 1024; + + /* ctime, atime & mtime */ + attrl[7].type = ATTR_GET; + attrl[7].page = ANY_PG + USER_TMSTMP_PG; + attrl[7].number = UTSAP_CTIME; + attrl[7].len = UTSAP_CTIME_LEN; + + attrl[8].type = ATTR_GET; + attrl[8].page = ANY_PG + USER_TMSTMP_PG; + attrl[8].number = UTSAP_DATA_ATIME; + attrl[8].len = UTSAP_DATA_ATIME_LEN; + + attrl[9].type = ATTR_GET; + attrl[9].page = ANY_PG + USER_TMSTMP_PG; + attrl[9].number = UTSAP_DATA_MTIME; + attrl[9].len = UTSAP_DATA_MTIME_LEN; + + attrl[10].type = ATTR_GET; + attrl[10].page = 0x1; + attrl[10].number = 0x82; /* logical length (not used capacity) */ + attrl[10].len = sizeof(uint64_t); ret = osd_command_set_get_attributes(command, PVFS_OSD_DATA_PID, sm_p->u.readdirplus.input_handle_array[i].handle); + gossip_err("oid: %d\n", sm_p->u.readdirplus.input_handle_array[i].handle); + if (ret) { osd_error_xerrno(ret, "%s: osd_command_set_get_attributes failed", @@ -870,7 +1018,7 @@ static PINT_sm_action readdirplus_fetch_sizes_setup_msgpair( return 1; } - ret = osd_command_attr_build(command, &id, 1); + ret = osd_command_attr_build(command, attrl, 11); if (ret) { osd_error_xerrno(ret, "%s: osd_command_attr_build failed", __func__); @@ -917,6 +1065,7 @@ static int readdirplus_fetch_sizes_comp_fn(void *v_p, struct PVFS_server_resp *resp_p, int index) { + gossip_err("fetch_sizes_comp_fn\n"); PINT_smcb *smcb = v_p; PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM); PVFS_error status; @@ -1027,18 +1176,27 @@ static int readdirplus_fetch_sizes_comp_fn(void *v_p, } } } else { - if (command->attr->outlen != sizeof(uint64_t)) { + /*if (command->attr->outlen != sizeof(uint64_t)) { gossip_err("%s: expecting 8 bytes returned, got %u.\n", __func__, command->attr->outlen); return ret; - } - + }*/ + get_handle_index(sm_p->u.readdirplus.input_handle_array, sm_p->u.readdirplus.nhandles, sm_p->msgarray_op.msgarray[index].handle, &handle_index, &aux_index); - sm_p->u.readdirplus.size_array[handle_index][aux_index] = get_ntohll(command->attr->val); + gossip_err("handle_index: %d\n", handle_index); + gossip_err("aux_index: %d\n", aux_index); + //sm_p->u.readdirplus.size_array[handle_index][aux_index] = get_ntohll(command->attr[10].val); + + /* memcpy the attributes from osd_command attr to sm_p attr object */ + if (*(PVFS_ds_type*)command->attr[4].val == PVFS_TYPE_DIRECTORY) { + PINT_copy_osd_dir_attr(&sm_p->u.readdirplus.obj_attr_array[handle_index], command); + } else { + PINT_copy_osd_object_attr(&sm_p->u.readdirplus.obj_attr_array[handle_index], command); + } } osd_command_attr_free(command); @@ -1087,6 +1245,7 @@ static PINT_sm_action readdirplus_msg_failure( static PINT_sm_action readdirplus_cleanup( struct PINT_smcb *smcb, job_status_s *js_p) { + gossip_err("readdirplus_cleanup\n"); int i; PVFS_sysresp_readdirplus *readdirplus_resp; struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT); diff --git a/src/client/sysint/sys-remove.sm b/src/client/sysint/sys-remove.sm index 8009077..5afd525 100644 --- a/src/client/sysint/sys-remove.sm +++ b/src/client/sysint/sys-remove.sm @@ -375,17 +375,14 @@ static int remove_rmdirent_comp_fn( struct PVFS_server_resp *resp_p, int index) { - gossip_err("remove_rmdirent_comp_fn\n"); int status; PINT_smcb *smcb = v_p; PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM); PINT_sm_msgpair_state *msg_p = &sm_p->msgarray_op.msgpair; if (server_is_osd(msg_p->svr_addr)) { - gossip_err("osd\n"); status = osd_errno_from_status(sm_p->msgarray_op.msgpair.osd_command.status); } else { - gossip_err("not_osd\n"); assert(resp_p->op == PVFS_SERV_RMDIRENT); status = resp_p->status; diff --git a/src/client/sysint/sys-setattr.sm b/src/client/sysint/sys-setattr.sm index c84bc9c..08bedb1 100644 --- a/src/client/sysint/sys-setattr.sm +++ b/src/client/sysint/sys-setattr.sm @@ -257,7 +257,7 @@ static PINT_sm_action setattr_msg_setup_msgpair( /* Set attr type, page and number */ for (i = 0; i < numattrs; i++) { attr[i].type = ATTR_SET; - attr[i].page = PVFS_USEROBJECT_ATTR_PG; + attr[i].page = ANY_PG + PVFS_USEROBJECT_ATTR_PG; attr[i].number = i; }