[PVFS2-CVS]
commit by neill in pvfs2/src/client/sysint: remove.sm sys-remove.sm
CVS commit program
cvs at parl.clemson.edu
Wed Sep 15 15:46:21 EDT 2004
Update of /projects/cvsroot/pvfs2/src/client/sysint
In directory parlweb:/tmp/cvs-serv25854/src/client/sysint
Modified Files:
remove.sm sys-remove.sm
Log Message:
- modify server side remove state machine to check the k_size of the
dirdata object being removed if it's a directory to report early
back to the client that the directory is not empty (if it's not)
- remove the readdir checks in the client remove path now that the
server-side remove can tell us directly if a directory is not empty
- modified PVFS specific error routines to print the value of
unrecognized error codes if encountered
- some cleanups
Index: remove.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/remove.sm,v
diff -p -u -r1.10 -r1.11
--- remove.sm 29 Jul 2004 19:52:33 -0000 1.10
+++ remove.sm 15 Sep 2004 18:46:21 -0000 1.11
@@ -23,16 +23,13 @@ extern job_context_id pint_client_sm_con
enum
{
REMOVE_MUST_REMOVE_DATAFILES = 1,
- REMOVE_MUST_CHECK_DIR_CONTENTS,
- MSGPAIR_RETURN_SUCCESS
+ MSGPAIR_RETURN_SUCCESS,
};
static int remove_getattr_setup_msgpair(
PINT_client_sm *sm_p, job_status_s *js_p);
static int remove_getattr_failure(
PINT_client_sm *sm_p, job_status_s *js_p);
-static int remove_check_dir_contents_setup_msgpair(
- PINT_client_sm *sm_p, job_status_s *js_p);
static int remove_datafile_remove_setup_msgpair(
PINT_client_sm *sm_p, job_status_s *js_p);
static int remove_datafile_remove_failure(
@@ -46,8 +43,6 @@ static int remove_helper_cleanup(
static int remove_getattr_comp_fn(
void *v_p, struct PVFS_server_resp *resp_p, int i);
-static int remove_check_dir_contents_comp_fn(
- void *v_p, struct PVFS_server_resp *resp_p, int i);
#define HANDLE_REMOVE_ERROR(state) \
do { \
@@ -67,9 +62,6 @@ nested machine pvfs2_client_remove_helpe
getattr_setup_msgpair,
getattr_xfer_msgpair,
getattr_failure,
- check_dir_contents_setup_msgpair,
- check_dir_contents_xfer_msgpair,
- check_dir_contents_failure,
datafile_remove_setup_msgpair,
datafile_remove_xfer_msgpair,
datafile_remove_failure,
@@ -91,7 +83,6 @@ nested machine pvfs2_client_remove_helpe
success => object_remove_setup_msgpair;
MSGPAIR_RETURN_SUCCESS => object_remove_setup_msgpair;
REMOVE_MUST_REMOVE_DATAFILES => datafile_remove_setup_msgpair;
- REMOVE_MUST_CHECK_DIR_CONTENTS => check_dir_contents_setup_msgpair;
default => getattr_failure;
}
@@ -101,20 +92,6 @@ nested machine pvfs2_client_remove_helpe
default => remove_helper_cleanup;
}
- state check_dir_contents_setup_msgpair
- {
- run remove_check_dir_contents_setup_msgpair;
- success => check_dir_contents_xfer_msgpair;
- default => remove_helper_cleanup;
- }
-
- state check_dir_contents_xfer_msgpair
- {
- jump pvfs2_msgpairarray_sm;
- success => object_remove_setup_msgpair;
- default => remove_helper_cleanup;
- }
-
state datafile_remove_setup_msgpair
{
run remove_datafile_remove_setup_msgpair;
@@ -262,7 +239,7 @@ static int remove_getattr_comp_fn(
return REMOVE_MUST_REMOVE_DATAFILES;
case PVFS_TYPE_DIRECTORY:
- return REMOVE_MUST_CHECK_DIR_CONTENTS;
+ return 0;
case PVFS_TYPE_SYMLINK:
return 0;
case PVFS_TYPE_DATAFILE:
@@ -275,68 +252,6 @@ static int remove_getattr_comp_fn(
return -PVFS_EINVAL;
}
-static int remove_check_dir_contents_comp_fn(
- void *v_p, struct PVFS_server_resp *resp_p, int i)
-{
- gossip_debug(GOSSIP_CLIENT_DEBUG,
- "remove_check_dir_contents_comp_fn\n");
-
- assert(resp_p->op == PVFS_SERV_READDIR);
-
- if (resp_p->status != 0)
- {
- return resp_p->status;
- }
-
- if (resp_p->u.readdir.dirent_count > 0)
- {
- gossip_debug(GOSSIP_CLIENT_DEBUG, "Directory is not empty\n");
- resp_p->status = -PVFS_ENOTEMPTY;
- return resp_p->status;
- }
- return 0;
-}
-static int remove_check_dir_contents_setup_msgpair(PINT_client_sm *sm_p,
- job_status_s *js_p)
-{
- int ret = -PVFS_EINVAL;
- PINT_sm_msgpair_state *msg_p = NULL;
-
- gossip_debug(GOSSIP_CLIENT_DEBUG, "remove state: "
- "remove_check_dir_contents_setup_msgpair\n");
-
- js_p->error_code = 0;
-
- PINT_init_msgpair(sm_p, msg_p);
-
- PINT_SERVREQ_READDIR_FILL(
- msg_p->req,
- *sm_p->cred_p,
- sm_p->object_ref.fs_id,
- sm_p->object_ref.handle,
- PVFS_READDIR_START,
- 1);
-
- gossip_debug(GOSSIP_REMOVE_DEBUG, "- doing READDIR on %Lu,%d\n",
- Lu(sm_p->object_ref.handle), sm_p->object_ref.fs_id);
-
- msg_p->fs_id = sm_p->object_ref.fs_id;
- msg_p->handle = sm_p->object_ref.handle;
- msg_p->retry_flag = PVFS_MSGPAIR_RETRY;
- msg_p->comp_fn = remove_check_dir_contents_comp_fn;
-
- ret = PINT_cached_config_map_to_server(
- &msg_p->svr_addr, msg_p->handle,
- msg_p->fs_id);
-
- if (ret)
- {
- gossip_err("Failed to map meta server address\n");
- js_p->error_code = ret;
- }
- return 1;
-}
-
static int remove_datafile_remove_setup_msgpair(PINT_client_sm *sm_p,
job_status_s *js_p)
{
@@ -354,10 +269,7 @@ static int remove_datafile_remove_setup_
gossip_debug(GOSSIP_CLIENT_DEBUG,
"remove state: datafile_remove_setup_msgpair\n");
- attr = (sm_p->acache_hit ?
- &sm_p->pinode->attr :
- &sm_p->acache_attr);
-
+ attr = (sm_p->acache_hit ? &sm_p->pinode->attr : &sm_p->acache_attr);
assert(attr);
sm_p->msgarray = (PINT_sm_msgpair_state *)malloc(
@@ -454,7 +366,21 @@ static int remove_datafile_remove_failur
static int remove_object_remove_failure(PINT_client_sm *sm_p,
job_status_s *js_p)
{
- HANDLE_REMOVE_ERROR("object_remove_failure");
+ gossip_debug(GOSSIP_CLIENT_DEBUG, "remove state: "
+ "object_remove_failure\n");
+ /*
+ catch and return acceptable errors here to avoid generic
+ post-remove-failure cleanup
+ */
+ if (js_p->error_code == -PVFS_ENOTEMPTY)
+ {
+ gossip_debug(GOSSIP_CLIENT_DEBUG, " directory not empty -- "
+ "returning error\n");
+ }
+ else
+ {
+ HANDLE_REMOVE_ERROR("object_remove_failure");
+ }
return 1;
}
Index: sys-remove.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-remove.sm,v
diff -p -u -r1.78 -r1.79
--- sys-remove.sm 9 Sep 2004 14:29:10 -0000 1.78
+++ sys-remove.sm 15 Sep 2004 18:46:21 -0000 1.79
@@ -39,7 +39,7 @@ enum
MSGPAIR_RETURN_SUCCESS = 1,
RMDIRENT_RETRY,
CRDIRENT_RETRY,
- RETURN_STORED_ERROR_CODE,
+ RETURN_STORED_ERROR_CODE
};
static int remove_init(
@@ -402,15 +402,18 @@ static int remove_check_error_code(
"remove_check_error_code got %d\n", js_p->error_code);
/*
- check for error codes which are ok to return to the caller at
+ separate error codes which are ok to return to the caller at
this point without trying to undo what we've done and retry the
removal
*/
switch(js_p->error_code)
{
+ case -PVFS_ENOTEMPTY:
+ /* let the error pass through for the crdirent cleanup */
+ break;
case -PVFS_EINVAL:
case -PVFS_ENOMEM:
- case -PVFS_ENOTEMPTY:
+ /* don't undo after these errors */
sm_p->u.remove.stored_error_code = js_p->error_code;
js_p->error_code = RETURN_STORED_ERROR_CODE;
break;
More information about the PVFS2-CVS
mailing list