From ce518ead034a08e7c55ca0b45949929774fae79f Mon Sep 17 00:00:00 2001 From: cek10006 Date: Thu, 11 Oct 2012 08:32:37 -0400 Subject: [PATCH] implementation of regular dir object is done * readdir, readdirplus works * no collection is created --- config.save | 2 +- src/client/sysint/remove.sm | 15 +- src/client/sysint/sys-create.sm | 3 - src/client/sysint/sys-mkdir.sm | 121 ++++++++++-- src/client/sysint/sys-readdir.sm | 3 +- src/client/sysint/sys-readdirplus.sm | 273 +++++++++++++++++++-------- src/common/misc/server-config.c | 2 + 7 files changed, 312 insertions(+), 107 deletions(-) diff --git a/config.save b/config.save index f58ffa7..e5b72f1 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-10-11-023730,;t t +s,@PVFS2_VERSION@,2.8.6-orangefs-2012-10-11-115608,;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/client/sysint/remove.sm b/src/client/sysint/remove.sm index 513bcfc..2b1cf4b 100644 --- a/src/client/sysint/remove.sm +++ b/src/client/sysint/remove.sm @@ -287,16 +287,19 @@ static PINT_sm_action remove_object_remove_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; + struct server_configuration_s *server_config; - int is_osd_md = fsid_is_osd_md(sm_p->object_ref.fs_id); + server_config = PINT_get_server_config_struct( + sm_p->object_ref.fs_id); + PINT_put_server_config_struct(server_config); gossip_debug(GOSSIP_CLIENT_DEBUG, "remove state: object_remove_setup_msgpair\n"); - if (is_osd_md) { - /* no mdfile to remove */ - js_p->error_code = OSD_MDFILE_MSGPAIR; - return SM_ACTION_COMPLETE; + if (server_config->coll_object || sm_p->getattr.attr.objtype != PVFS_TYPE_DIRECTORY) + { + js_p->error_code = OSD_MDFILE_MSGPAIR; + return SM_ACTION_COMPLETE; } PINT_msgpair_init(&sm_p->msgarray_op); @@ -367,7 +370,7 @@ static PINT_sm_action remove_collection( sm_p->object_ref.fs_id); PINT_put_server_config_struct(server_config); - 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)) { + 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) || (!server_config->coll_object)) { js_p->error_code = SKIP_COLLECTION_REMOVAL; return SM_ACTION_COMPLETE; } diff --git a/src/client/sysint/sys-create.sm b/src/client/sysint/sys-create.sm index 520ccc7..4573375 100644 --- a/src/client/sysint/sys-create.sm +++ b/src/client/sysint/sys-create.sm @@ -394,7 +394,6 @@ PVFS_error PVFS_sys_create( static PINT_sm_action create_init( struct PINT_smcb *smcb, job_status_s *js_p) { - gossip_err("create_init\n"); struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT); job_id_t tmp_id; @@ -576,8 +575,6 @@ static int create_datafiles_comp_fn(void *v_p, 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", __func__, llu(oid), llu(first), llu(last));*/ diff --git a/src/client/sysint/sys-mkdir.sm b/src/client/sysint/sys-mkdir.sm index 33e4182..fee6c55 100644 --- a/src/client/sysint/sys-mkdir.sm +++ b/src/client/sysint/sys-mkdir.sm @@ -34,9 +34,10 @@ enum { MKDIR_RETRY = 180, MKDIR_SKIP_EATTR = 181, - OSD_MKDIR_MSGPAIR = 2001, + OSD_MKDIR_COLL_MSGPAIR = 2001, CREATE_COLLECTION = 2002, - SKIP_COLLECTION_CREATE = 2003 + SKIP_COLLECTION_CREATE = 2003, + OSD_MKDIR_MSGPAIR = 2004 }; static int mkdir_msg_comp_fn( @@ -75,7 +76,8 @@ machine pvfs2_client_mkdir_sm state mkdir_msg_setup_msgpair { run mkdir_msg_setup_msgpair; - OSD_MKDIR_MSGPAIR => create_collection; + OSD_MKDIR_MSGPAIR => mkdir_msg_xfer_osd_msgpair; + OSD_MKDIR_COLL_MSGPAIR => create_collection; success => mkdir_msg_xfer_msgpair; default => mkdir_msg_failure; } @@ -86,6 +88,13 @@ machine pvfs2_client_mkdir_sm success => create_collection; 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 { @@ -133,7 +142,7 @@ machine pvfs2_client_mkdir_sm { run mkdir_crdirent_setup_msgpair; success => mkdir_crdirent_xfer_msgpair; - OSD_MKDIR_MSGPAIR => mkdir_crdirent_osd_msgpair; + OSD_MKDIR_COLL_MSGPAIR => mkdir_crdirent_osd_msgpair; default => mkdir_crdirent_failure; } @@ -331,6 +340,20 @@ 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; + } + + sm_p->u.mkdir.metafile_handle = get_ntohll(command->attr[5].val); + sm_p->u.mkdir.cid = get_ntohll(command->attr[5].val); + } + + osd_command_attr_free(command); return osd_errno_from_status(command->status); } else { @@ -384,6 +407,11 @@ static PINT_sm_action mkdir_msg_setup_msgpair( int ret = -PVFS_EINVAL; PVFS_handle_extent_array meta_handle_extent_array; PINT_sm_msgpair_state *msg_p = NULL; + struct server_configuration_s *server_config; + + server_config = PINT_get_server_config_struct( + sm_p->object_ref.fs_id); + PINT_put_server_config_struct(server_config); gossip_debug(GOSSIP_CLIENT_DEBUG, "mkdir state: mkdir_msg_setup_msgpair\n"); @@ -405,8 +433,76 @@ static PINT_sm_action mkdir_msg_setup_msgpair( } if (server_is_osd(msg_p->svr_addr)) { - js_p->error_code = OSD_MKDIR_MSGPAIR; - return SM_ACTION_COMPLETE; + if (server_config->coll_object) + { + js_p->error_code = OSD_MKDIR_COLL_MSGPAIR; + return SM_ACTION_COMPLETE; + } else { + 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 = 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); + + /* retrieve cid, if we have osd md */ + 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; + } } else { PINT_SERVREQ_MKDIR_FILL( msg_p->req, @@ -457,14 +553,14 @@ static PINT_sm_action create_collection_setup_msgpair( js_p->error_code = 0; - if (!is_osd) { - js_p->error_code = SKIP_COLLECTION_CREATE; - return SM_ACTION_COMPLETE; - } - server_config = PINT_get_server_config_struct( sm_p->object_ref.fs_id); PINT_put_server_config_struct(server_config); + + if (!is_osd || !server_config->coll_object) { + js_p->error_code = SKIP_COLLECTION_CREATE; + return SM_ACTION_COMPLETE; + } cur = server_config->host_aliases; while(cur) @@ -606,7 +702,6 @@ static int create_collection_comp_fn(void *v_p, 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; @@ -649,7 +744,7 @@ static PINT_sm_action mkdir_crdirent_setup_msgpair( * here because we'll handle the individual directory operations in a * different state machine. */ - js_p->error_code = OSD_MKDIR_MSGPAIR; + js_p->error_code = OSD_MKDIR_COLL_MSGPAIR; return SM_ACTION_COMPLETE; } else { diff --git a/src/client/sysint/sys-readdir.sm b/src/client/sysint/sys-readdir.sm index 207625b..946d6ee 100644 --- a/src/client/sysint/sys-readdir.sm +++ b/src/client/sysint/sys-readdir.sm @@ -292,7 +292,7 @@ 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 */ + /* Retrieve the attributes of the collection or the regular dir object */ /* Retrieved attribute numbers are the hashed name of each directory entry */ /*ret = osd_command_set_list_collection(command, PVFS_OSD_META_PID, oid, 0, 1024, 0, 0);*/ @@ -334,7 +334,6 @@ static int readdir_msg_comp_fn(void *v_p, struct PVFS_server_resp *resp_p, int index) { - osd_debug("readdir_msg_comp_fn\n"); int ret = 0; PINT_smcb *smcb = v_p; PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM); diff --git a/src/client/sysint/sys-readdirplus.sm b/src/client/sysint/sys-readdirplus.sm index 9f3f61d..0cf491d 100644 --- a/src/client/sysint/sys-readdirplus.sm +++ b/src/client/sysint/sys-readdirplus.sm @@ -505,6 +505,11 @@ static PINT_sm_action readdirplus_fetch_attrs_setup_msgpair(struct PINT_smcb *sm 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); + struct server_configuration_s *server_config; + + server_config = PINT_get_server_config_struct( + sm_p->object_ref.fs_id); + PINT_put_server_config_struct(server_config); gossip_debug(GOSSIP_CLIENT_DEBUG, "readdirplus state: fetch_attrs_setup\n"); /* if there are no dirents then return NO_WORK */ @@ -514,7 +519,7 @@ static PINT_sm_action readdirplus_fetch_attrs_setup_msgpair(struct PINT_smcb *sm js_p->error_code = NO_WORK; return SM_ACTION_COMPLETE; } - + /* From the readdirplus structure figure out which meta servers * we need to speak to to get the attribute information */ @@ -532,93 +537,183 @@ static PINT_sm_action readdirplus_fetch_attrs_setup_msgpair(struct PINT_smcb *sm 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; - } - 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; + if (server_config->coll_object) + { + 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; + } + + /*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; + } } - } - /* 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; - } + /* 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; + } - /* uid, gid & perms */ - attrl[0].len = sizeof(PVFS_uid); - attrl[1].len = sizeof(PVFS_gid); - attrl[2].len = sizeof(PVFS_permissions); + /* 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; + /* 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; + /* 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; + /* 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[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; + 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; + 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_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; + } + } else { + ret = PINT_msgpairarray_init(&sm_p->msgarray_op, sm_p->u.readdirplus.nhandles); + 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) + { + struct osd_command *command = &sm_p->msgarray_op.msgarray[i].osd_command; - 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; - } + msg_p->fs_id = sm_p->object_ref.fs_id; + 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[0]; + msg_p->handle = sm_p->u.readdirplus.input_handle_array[i].handle; + + int j, numattrs = 10; + struct attribute_list attrl[numattrs]; + + /* Set attr type, page and number */ + for (j = 0; j < numattrs - 3; 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; + + ret = osd_command_set_get_attributes(command, PVFS_OSD_META_PID, + sm_p->u.readdirplus.input_handle_array[i].handle); + + if (ret) { + osd_error_xerrno(ret, + "%s: osd_command_set_get_attributes failed", + __func__); + js_p->error_code = ret; + return 1; + } + ret = osd_command_attr_build(command, attrl, 10); + 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) - { + 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; @@ -641,7 +736,7 @@ static PINT_sm_action readdirplus_fetch_attrs_setup_msgpair(struct PINT_smcb *sm PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op); return SM_ACTION_COMPLETE; } - + /* Phase 1 completion callback */ static int readdirplus_fetch_attrs_comp_fn(void *v_p, struct PVFS_server_resp *resp_p, @@ -653,6 +748,11 @@ static int readdirplus_fetch_attrs_comp_fn(void *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]; + struct server_configuration_s *server_config; + + server_config = PINT_get_server_config_struct( + sm_p->object_ref.fs_id); + PINT_put_server_config_struct(server_config); attr = &sm_p->getattr.attr; @@ -671,7 +771,7 @@ static int readdirplus_fetch_attrs_comp_fn(void *v_p, { return status; } - + /* Mark all handles in this server range as having failed a stat */ if (sm_p->msgarray_op.msgarray[index].op_status != 0) { int i, handle_index; @@ -702,7 +802,7 @@ static int readdirplus_fetch_attrs_comp_fn(void *v_p, return ret; } - if (sm_p->u.readdirplus.handle_count[index] > 1) + if (sm_p->u.readdirplus.handle_count[index] > 1 && server_config->coll_object) { for (i = 0; i < sm_p->u.readdirplus.handle_count[index]; i++) { get_handle_index(sm_p->u.readdirplus.input_handle_array, @@ -711,7 +811,7 @@ static int readdirplus_fetch_attrs_comp_fn(void *v_p, &handle_index, NULL); assert(handle_index >= 0); - + memcpy(&sm_p->u.readdirplus.obj_attr_array[handle_index].owner, ((struct attribute_get_multi_results *)attr[0].val)->val[((struct attribute_get_multi_results *)attr[0].val)->numoid-(sm_p->u.readdirplus.nhandles-i)], ((struct attribute_get_multi_results *)attr[0].val)->outlen[((struct attribute_get_multi_results *)attr[0].val)->numoid-(sm_p->u.readdirplus.nhandles-i)]); memcpy(&sm_p->u.readdirplus.obj_attr_array[handle_index].group, ((struct attribute_get_multi_results *)attr[1].val)->val[((struct attribute_get_multi_results *)attr[1].val)->numoid-(sm_p->u.readdirplus.nhandles-i)], ((struct attribute_get_multi_results *)attr[1].val)->outlen[((struct attribute_get_multi_results *)attr[1].val)->numoid-(sm_p->u.readdirplus.nhandles-i)]); @@ -721,12 +821,21 @@ static int readdirplus_fetch_attrs_comp_fn(void *v_p, memcpy(&sm_p->u.readdirplus.obj_attr_array[handle_index].objtype, ((struct attribute_get_multi_results *)attr[4].val)->val[((struct attribute_get_multi_results *)attr[4].val)->numoid-(sm_p->u.readdirplus.nhandles-i)], ((struct attribute_get_multi_results *)attr[4].val)->outlen[((struct attribute_get_multi_results *)attr[4].val)->numoid-(sm_p->u.readdirplus.nhandles-i)]); } } else { - get_handle_index(sm_p->u.readdirplus.input_handle_array, - sm_p->u.readdirplus.nhandles, - sm_p->u.readdirplus.handles[index][0], - &handle_index, - NULL); - + if (server_config->coll_object) + { + get_handle_index(sm_p->u.readdirplus.input_handle_array, + sm_p->u.readdirplus.nhandles, + sm_p->u.readdirplus.handles[index][0], + &handle_index, + NULL); + } else { + get_handle_index(sm_p->u.readdirplus.input_handle_array, + sm_p->u.readdirplus.nhandles, + sm_p->msgarray_op.msgarray[index].handle, + &handle_index, + NULL); + } + /* 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); diff --git a/src/common/misc/server-config.c b/src/common/misc/server-config.c index 8f7733d..23579d8 100644 --- a/src/common/misc/server-config.c +++ b/src/common/misc/server-config.c @@ -3075,7 +3075,9 @@ static DOTCONF_CB(get_coll_object_type) if (!strcmp(str, "no")) config->coll_object = NO_COLL_OBJECT; else if (!strcmp(str, "yes")) + { config->coll_object = COLL_OBJECT; + } else ret = "get_coll_object_type: unknown FileSystem CollectionObject option\n"; return ret;