[Pvfs2-developers] patches: misc small fixes
Sam Lang
slang at mcs.anl.gov
Thu Apr 5 16:59:23 EDT 2007
Committed. Thanks Phil.
-sam
On Apr 5, 2007, at 3:55 PM, Phil Carns wrote:
> These are all pretty minor:
>
> mod-parm-desc.patch:
> --------------------
> The pvfs2 kernel module is missing the parameter description for
> the op_timeout_secs option that can be set at insmod time.
>
> server-gossip-errno.patch:
> --------------------------
> The pvfs2-server is trying to use errno to propigate errors from
> gossip_enable_file(), but this function returns its error code in
> the return value. I think maybe the errno handling logic may have
> just been mistakenly pasted from the fopen() error handling earlir
> in this same file.
>
> mgmt-getconfig-wait.patch:
> --------------------------
> I don't think this makes a significant difference, but all of the
> mgmt*.sm state machines are using mgmt_wait and mgmt_release to
> handle their operations, except for mgmt-getconfig which is using
> sys_wait and sys_release. This patch updates mgmt-getconfig to
> match the other mgmt state machines.
>
> pvfs2-rm.patch:
> ---------------
> This is an old patch that apparently just forgot to submit a long
> time ago. At any rate, it makes two changes to pvfs2-rm. First of
> all, it updates pvfs2-rm to use the gen_credentials() function to
> fill in its credentials rather than manually setting the credential
> fields. It also introduces some extra sanity checking on removal
> of objects that appear to be directories. I think some error
> handling has been beefed up elsewhere since the time this patch was
> generated, so the sanity check isn't as important any more- but it
> does still result in a better error message if you try to remove a
> normal file as if it is a directory.
>
> -Phil
> diff -Naur pvfs2/src/client/sysint/mgmt-get-config.c pvfs2-patched/
> src/client/sysint/mgmt-get-config.c
> --- pvfs2/src/client/sysint/mgmt-get-config.c 2007-04-05
> 10:59:20.000000000 -0400
> +++ pvfs2-patched/src/client/sysint/mgmt-get-config.c 2007-04-05
> 16:17:24.000000000 -0400
> @@ -94,10 +94,10 @@
> }
> else
> {
> - ret = PVFS_sys_wait(op_id, "X-get_config", &error);
> + ret = PVFS_mgmt_wait(op_id, "X-get_config", &error);
> if (ret)
> {
> - PVFS_perror_gossip("PVFS_sys_wait call", ret);
> + PVFS_perror_gossip("PVFS_mgmt_wait call", ret);
> error = ret;
> }
> }
> @@ -129,7 +129,7 @@
> sm_p->u.get_config.server_config_buf = NULL;
> }
>
> - PVFS_sys_release(op_id);
> + PVFS_mgmt_release(op_id);
> return error;
> }
>
> diff -Naur pvfs2/src/kernel/linux-2.6/pvfs2-mod.c pvfs2-patched/src/
> kernel/linux-2.6/pvfs2-mod.c
> --- pvfs2/src/kernel/linux-2.6/pvfs2-mod.c 2006-09-13
> 16:22:55.000000000 -0400
> +++ pvfs2-patched/src/kernel/linux-2.6/pvfs2-mod.c 2007-04-05
> 16:04:03.000000000 -0400
> @@ -31,6 +31,7 @@
> MODULE_AUTHOR("PVFS2 Development Team");
> MODULE_DESCRIPTION("The Linux Kernel VFS interface to PVFS2");
> MODULE_PARM_DESC(debug, "debugging level (0 for none, 1 for
> verbose)");
> +MODULE_PARM_DESC(op_timeout_secs, "Operation timeout in seconds");
> MODULE_PARM_DESC(hash_table_size, "size of hash table for
> operations in progress");
>
> #ifdef PVFS2_LINUX_KERNEL_2_4
> diff -Naur pvfs2/src/apps/admin/pvfs2-rm.c pvfs2-patched/src/apps/
> admin/pvfs2-rm.c
> --- pvfs2/src/apps/admin/pvfs2-rm.c 2005-07-22 16:39:12.000000000
> -0400
> +++ pvfs2-patched/src/apps/admin/pvfs2-rm.c 2007-04-05
> 15:19:13.000000000 -0400
> @@ -39,6 +39,7 @@
> {
> int ret = -1, i = 0;
> struct options *user_opts = NULL;
> + PVFS_sysresp_getattr resp_getattr;
>
> /* look at command line arguments */
> user_opts = parse_args(argc, argv);
> @@ -70,6 +71,9 @@
> PVFS_sysresp_lookup resp_lookup;
> PVFS_credentials credentials;
> PVFS_object_ref parent_ref;
> + int tmp_len = 0;
> +
> + PVFS_util_gen_credentials(&credentials);
>
> /* Translate path into pvfs2 relative path */
> rc = PVFS_util_resolve(working_file, &cur_fs, pvfs_path,
> @@ -81,6 +85,46 @@
> break;
> }
>
> + tmp_len = strlen(pvfs_path);
> + if(pvfs_path[tmp_len - 1] == '/')
> + {
> + /* User requested removal of something with a trailing
> slash.
> + * Strip slashes, but then confirm that the target is
> in fact a
> + * directory, or else the request is invalid
> + */
> + while(tmp_len > 1 && pvfs_path[tmp_len - 1] == '/')
> + {
> + pvfs_path[tmp_len - 1] = '\0';
> + tmp_len--;
> + }
> +
> + memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
> + rc = PVFS_sys_lookup(cur_fs, pvfs_path, &credentials,
> + &resp_lookup,
> PVFS2_LOOKUP_LINK_NO_FOLLOW);
> + if (rc)
> + {
> + PVFS_perror("PVFS_sys_lookup", rc);
> + ret = -1;
> + break;
> + }
> +
> + memset(&resp_getattr, 0, sizeof(PVFS_sysresp_getattr));
> + rc = PVFS_sys_getattr(resp_lookup.ref,
> PVFS_ATTR_SYS_TYPE,
> + &credentials, &resp_getattr);
> + if (rc)
> + {
> + PVFS_perror("PVFS_sys_getattr", rc);
> + ret = -1;
> + break;
> + }
> + if (resp_getattr.attr.objtype != PVFS_TYPE_DIRECTORY)
> + {
> + fprintf(stderr, "Error: object is not a directory.
> \n");
> + ret = -1;
> + break;
> + }
> + }
> +
> /* break into file and directory */
> rc = PINT_get_base_dir(pvfs_path, directory, PVFS_NAME_MAX);
> if(rc < 0)
> @@ -100,9 +144,6 @@
> break;
> }
>
> - credentials.uid = getuid();
> - credentials.gid = getuid();
> -
> memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
> rc = PVFS_sys_lookup(cur_fs, directory, &credentials,
> &resp_lookup,
> PVFS2_LOOKUP_LINK_NO_FOLLOW);
> diff -Naur pvfs2/src/server/pvfs2-server.c pvfs2-patched/src/server/
> pvfs2-server.c
> --- pvfs2/src/server/pvfs2-server.c 2007-04-05 10:59:22.000000000
> -0400
> +++ pvfs2-patched/src/server/pvfs2-server.c 2007-04-05
> 16:10:40.000000000 -0400
> @@ -768,10 +768,9 @@
> ret = gossip_enable_file(server_config.logfile, "a");
> if (ret < 0)
> {
> - int tmp_errno = errno;
> gossip_lerr("error opening log file %s\n",
> server_config.logfile);
> - return -tmp_errno;
> + return ret;
> }
> /* log starting message again so it appears in log file,
> not just
> * console
> _______________________________________________
> Pvfs2-developers mailing list
> Pvfs2-developers at beowulf-underground.org
> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers
More information about the Pvfs2-developers
mailing list