Skip to content

Commit

Permalink
osd dir sm is functional except readdir and ping
Browse files Browse the repository at this point in the history
Other issues to resolve
* Do we need collections with osd dir sm
* How to handle colliding dir entries
  • Loading branch information
cek10006 committed Sep 17, 2012
1 parent 581b7e8 commit 4821471
Show file tree
Hide file tree
Showing 25 changed files with 793 additions and 254 deletions.
2 changes: 1 addition & 1 deletion config.save
Original file line number Diff line number Diff line change
Expand Up @@ -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-07-19-212817,;t t
s,@PVFS2_VERSION@,2.8.6-orangefs-2012-09-15-003549,;t t
s,@PVFS2_VERSION_MAJOR@,2,;t t
s,@PVFS2_VERSION_MINOR@,8,;t t
s,@PVFS2_VERSION_SUB@,6,;t t
Expand Down
2 changes: 1 addition & 1 deletion src/apps/admin/pvfs2-chmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ int pvfs2_chmod (PVFS_permissions perms, char *destfile) {
}
memset(&resp_getattr,0,sizeof(PVFS_sysresp_getattr));
attrmask = (PVFS_ATTR_SYS_ALL_SETABLE);

ret = PVFS_sys_getattr(resp_lookup.ref,attrmask,&credentials,&resp_getattr, NULL);
if (ret < 0)
{
Expand Down
1 change: 0 additions & 1 deletion src/apps/admin/pvfs2-cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ int main (int argc, char ** argv)

ret = generic_open(&dest, &credentials, user_opts->num_datafiles, user_opts->strip_size,
user_opts->srcfile, OPEN_DEST);

if (ret < 0)
{
fprintf(stderr, "Could not open %s\n", user_opts->destfile);
Expand Down
2 changes: 1 addition & 1 deletion src/apps/admin/pvfs2-mkdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int main(int argc, char **argv)
fprintf(stderr, "Unable to allocate memory\n");
return(-1);
}

ret = PVFS_util_init_defaults();
if (ret < 0)
{
Expand Down
5 changes: 3 additions & 2 deletions src/client/sysint/acache.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ int PINT_acache_update(

gossip_debug(GOSSIP_ACACHE_DEBUG, "acache: update(): H=%llu\n",
llu(refn.handle));

if(!attr && !size)
{
return(-PVFS_EINVAL);
Expand Down Expand Up @@ -605,6 +605,7 @@ int PINT_acache_update(
if(attr->mask & PVFS_ATTR_META_DIST)
{
tmp_payload->dist = PINT_dist_copy(attr->u.meta.dist);

if(!tmp_payload->dist)
{
ret = -PVFS_ENOMEM;
Expand Down Expand Up @@ -670,7 +671,7 @@ int PINT_acache_update(
}

gen_mutex_unlock(&acache_mutex);

return(0);

err:
Expand Down
3 changes: 3 additions & 0 deletions src/client/sysint/client-state-machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,9 @@ extern struct PINT_state_machine_s pvfs2_client_datafile_getattr_sizes_sm;
extern struct PINT_state_machine_s pvfs2_client_setattr_sm;
extern struct PINT_state_machine_s pvfs2_client_io_sm;
extern struct PINT_state_machine_s pvfs2_client_osd_io_sm;
extern struct PINT_state_machine_s pvfs2_client_osd_dirops_sm;
extern struct PINT_state_machine_s pvfs2_client_osd_dirops_attr1_sm;
extern struct PINT_state_machine_s pvfs2_client_osd_dirops_attr4_sm;
extern struct PINT_state_machine_s pvfs2_client_small_io_sm;
extern struct PINT_state_machine_s pvfs2_client_flush_sm;
extern struct PINT_state_machine_s pvfs2_client_sysint_readdir_sm;
Expand Down
3 changes: 2 additions & 1 deletion src/client/sysint/module.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ CLIENT_SMCGEN := \
$(DIR)/mgmt-get-dirdata-handle.c \
$(DIR)/mgmt-get-uid-list.c \
$(DIR)/osdsm.c \
$(DIR)/sys-osd-io.c
$(DIR)/sys-osd-io.c \
$(DIR)/sys-osd-dir.c

# track generated .c files that need to be removed during dist clean, etc.
SMCGEN += $(CLIENT_SMCGEN)
Expand Down
4 changes: 2 additions & 2 deletions src/client/sysint/remove.sm
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ nested machine pvfs2_client_remove_helper_sm
state object_remove_xfer_osd_msgpair
{
jump pvfs2_osd_msgpairarray_sm;
success => remove_helper_cleanup;
success => remove_collection;
default => object_remove_failure;
}

Expand Down Expand Up @@ -289,7 +289,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) {
if (is_osd_md && (sm_p->getattr.attr.objtype != PVFS_TYPE_DIRECTORY)) {
/* no mdfile to remove */
js_p->error_code = OSD_MDFILE_MSGPAIR;
return SM_ACTION_COMPLETE;
Expand Down
58 changes: 55 additions & 3 deletions src/client/sysint/server-get-config.sm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include "pint-util.h"
#include "pint-cached-config.h"
#include "PINT-reqproto-encode.h"
#include "osd-util/osd-sense.h"
#include "osd-initiator/sense.h"

extern job_context_id pint_client_sm_context;

Expand All @@ -30,17 +32,29 @@ static int server_parse_config(
static int server_get_config_comp_fn(
void *v_p, struct PVFS_server_resp *resp_p, int i);

enum {
OSD_MSGPAIR = 2001,
};

%%

nested machine pvfs2_server_get_config_nested_sm
{
state setup_msgpair
{
run server_get_config_setup_msgpair;
OSD_MSGPAIR => osd_xfer_msgpair;
success => xfer_msgpair;
default => cleanup;
}

state osd_xfer_msgpair
{
jump pvfs2_osd_msgpairarray_sm;
success => parse;
default => cleanup;
}

state xfer_msgpair
{
jump pvfs2_msgpairarray_sm;
Expand Down Expand Up @@ -318,16 +332,31 @@ static PINT_sm_action server_get_config_setup_msgpair(
return SM_ACTION_COMPLETE;
}

PINT_SERVREQ_GETCONFIG_FILL(msg_p->req, *sm_p->cred_p, sm_p->hints);
if (server_is_osd(serv_addr)) {
struct osd_command *command = &msg_p->osd_command;
int len = 64 * 1024;

ret = osd_command_set_read(command, PVFS_OSD_META_PID,
PVFS_OSD_FSCONF_OID, len, 0);
command->inlen_alloc = len;
command->indata = malloc(len);
if (!command->indata) {
js_p->error_code = -ENOMEM;
return SM_ACTION_COMPLETE;
}
js_p->error_code = OSD_MSGPAIR;
} else {
PINT_SERVREQ_GETCONFIG_FILL(msg_p->req, *sm_p->cred_p, sm_p->hints);
js_p->error_code = 0;
}

msg_p->fs_id = PVFS_FS_ID_NULL;
msg_p->handle = PVFS_HANDLE_NULL;
msg_p->retry_flag = PVFS_MSGPAIR_RETRY;
msg_p->comp_fn = server_get_config_comp_fn;
msg_p->svr_addr = serv_addr;

PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
js_p->error_code = 0;
return SM_ACTION_COMPLETE;
}

Expand Down Expand Up @@ -421,6 +450,29 @@ static int server_get_config_comp_fn(
{
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.msgarray[0];

if (server_is_osd(msg_p->svr_addr)) {
struct osd_command *command = &msg_p->osd_command;

if (command->status == SAM_STAT_CHECK_CONDITION) {
int key, code;
osd_sense_extract(command->sense, command->sense_len, &key, &code);
/* ignore "read past end of user object" */
if (key == OSD_SSK_RECOVERED_ERROR &&
code == OSD_ASC_READ_PAST_END_OF_USER_OBJECT) {
command->status = 0;
}
}
if (command->status != 0)
return osd_errno_from_status(command->status);
if (command->inlen == 0)
return -ENOENT;
sm_p->u.get_config.fs_config_buf = strdup(command->indata);
sm_p->u.get_config.fs_config_buf_size = command->inlen + 1;
free(command->indata);
return 0;
}

/* only posted one msgpair */
assert(i==0);
Expand Down
Loading

0 comments on commit 4821471

Please sign in to comment.