[Pvfs2-cvs] commit by kunkel in pvfs2/src/apps/admin:
pvfs2-validate.c pvfs2-rm.c pvfs2-ls.c pvfs2-fsck.c
pvfs2-migrate-collection.c module.mk.in pvfs2-xattr.c
pvfs2-config.in pvfs2-genconfig
CVS commit program
cvs at parl.clemson.edu
Wed May 23 16:48:41 EDT 2007
Update of /projects/cvsroot/pvfs2/src/apps/admin
In directory parlweb1:/tmp/cvs-serv20193/src/apps/admin
Modified Files:
Tag: pvfs2-kunkel-tas-branch
pvfs2-rm.c pvfs2-ls.c pvfs2-fsck.c pvfs2-migrate-collection.c
module.mk.in pvfs2-xattr.c pvfs2-config.in pvfs2-genconfig
Added Files:
Tag: pvfs2-kunkel-tas-branch
pvfs2-validate.c
Log Message:
Merge HEAD changes to TAS-branch.
--- /dev/null 2004-06-24 14:04:38.000000000 -0400
+++ pvfs2-validate.c 2007-05-23 16:48:41.000000000 -0400
@@ -0,0 +1,437 @@
+/*
+ * Copyright © Acxiom Corporation, 2006
+ *
+ * See COPYING in top-level directory.
+ */
+
+#include <stdio.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "pvfs2.h"
+#include "pvfs2-internal.h"
+
+
+#include "fsck-utils.h"
+
+#define VERSION "0.1"
+/** \defgroup pvfs2validate PVFS2 Validate
+ *
+ * The pvfs2-validate implementation provides a client side utility to find and
+ * repair PVFS2 file system problems.
+ *
+ * @see fsckutils
+ *
+ * Before running pvfs2-validate, the following requirements must be met:
+ * - The PVFS2 servers must be running
+ * - No clients should be accssing the file system
+ * .
+ *
+ * TODO:
+ * - Need to design a way to kick off process on the pvfs2-server to check
+ * for orphaned bstreams (bstreams with no attributes and/or dfiles)
+ * - Needs to enter admin mode in beginning if needed, and leave at end.
+ * Shouldn't leave admin mode during operation.
+ * - Add ability to run pvfs2-validate on an unmounted filesytem, and on a system
+ * with no entries in tabfiles (pvfs2tab, /etc/mtab, /etc/fstab)
+ * - Force a sync on filesystem before beginning fsck
+ * .
+ *
+ * QUESTIONS:
+ * - Does the underlying filesystem fsck interfere with pvfs2-validate?
+ * - Should the underlying filesytem fsck be run in any conditions?
+ * - How/When to clean up lost+found directory?
+ * - What happens when lost+found directory has errors?
+ * - Can anyone with root access run pvfs2-validate? Do we need some sort of authorization?
+ * - Any known limits? (memory usage in pvfs2-validate, number of files)?
+ * - Should we enter admin mode if there is no chance of repairs on found objects?
+ * - Can pvfs2-validate be initiated automatically in some cases?
+ * - When pvfs2-validate runs, how does is affect performance (readonly/repair)?
+ * - Can the this be parallelized?
+ * - Can we have a "conditional admin mode", where admin mode only entered after
+ * a certain time condition where no file system activity takes place? This
+ * would keep servers from entering admin mode in the middle of operations.
+ * .
+ *
+ * @{
+ */
+
+/** \file
+ * Implementation of PVFS2 FSCK tool.
+ */
+
+/* Function Prototypes */
+static void usage(
+ int,
+ char **);
+
+int validate_pvfs_object(
+ const struct PINT_fsck_options *fsck_options,
+ const PVFS_object_ref * pref,
+ const PVFS_credentials * creds,
+ int *cur_fs,
+ char *current_path);
+
+static struct PINT_fsck_options *parse_args(
+ int argc,
+ char **argv);
+
+int main(int argc, char **argv)
+{
+ int ret = 0;
+ int cur_fs = 0;
+ char pvfs_path[PVFS_NAME_MAX] = { 0 };
+ PVFS_credentials creds;
+ PVFS_sysresp_lookup lookup_resp;
+ struct PINT_fsck_options *fsck_options = NULL;
+
+ memset(&creds, 0, sizeof(creds));
+ memset(&lookup_resp, 0, sizeof(lookup_resp));
+
+ fsck_options = parse_args(argc, argv);
+ if(!fsck_options)
+ {
+ fprintf(stderr, "Error: failed to parse arguments.\n");
+ usage(argc, argv);
+ return -1;
+ }
+
+ if (!fsck_options->start_path)
+ {
+ fprintf(stderr, "Error: no starting path specified (See -d option below).\n");
+ usage(argc, argv);
+ free(fsck_options);
+ return -1;
+ }
+
+ ret = PVFS_util_init_defaults();
+ if (ret != 0)
+ {
+ PVFS_perror("PVFS_util_init_defaults", ret);
+ free(fsck_options);
+ return -1;
+ }
+
+ /* translate local path into pvfs2 relative path */
+ ret = PVFS_util_resolve(
+ fsck_options->start_path,
+ &cur_fs, pvfs_path,
+ sizeof(pvfs_path));
+
+ if (ret != 0)
+ {
+ PVFS_perror("PVFS_util_resolve", ret);
+ PVFS_sys_finalize();
+ free(fsck_options);
+ return -1;
+ }
+
+ if (fsck_options->check_stranded_objects && (strcmp(pvfs_path, "/") != 0))
+ {
+ fprintf(stderr, "Error: -d must specify the pvfs2 root directory when utilizing the -c option.\n");
+ usage(argc, argv);
+ PVFS_sys_finalize();
+ free(fsck_options);
+ return -1;
+ }
+
+ PVFS_util_gen_credentials(&creds);
+
+ ret = PVFS_sys_lookup(
+ cur_fs, pvfs_path,
+ &creds,
+ &lookup_resp,
+ PVFS2_LOOKUP_LINK_NO_FOLLOW);
+
+ if (ret != 0)
+ {
+ fprintf(stderr, "Error: failed lookup on [%s]\n", pvfs_path);
+ PVFS_perror("PVFS_sys_lookup", ret);
+ PVFS_sys_finalize();
+ free(fsck_options);
+ return -1;
+ }
+
+ ret = PVFS_fsck_initialize(fsck_options, &creds, &cur_fs);
+ if (ret < 0)
+ {
+ PVFS_perror("PVFS_fsck_initialize", ret);
+ PVFS_sys_finalize();
+ free(fsck_options);
+ return(-1);
+ }
+
+ ret = PVFS_fsck_check_server_configs(fsck_options, &creds, &cur_fs);
+ if (ret < 0)
+ {
+ fprintf(stderr, "Error: a difference was detected while validating the server fs configs.\n");
+ PVFS_perror("PVFS_fsck_check_server_configs", ret);
+ PVFS_sys_finalize();
+ free(fsck_options);
+ return(-1);
+ }
+
+ /* stop right here if check_fs_configs option is enabled */
+ if (fsck_options->check_fs_configs)
+ {
+ printf("All PVFS2 servers have consistent fs configurations.\n");
+ free(fsck_options);
+ return 0;
+ }
+
+ printf("pvfs2-validate starting validation at object [%s]\n",
+ fsck_options->start_path);
+
+ /* validate the object */
+ ret = validate_pvfs_object(
+ fsck_options,
+ &lookup_resp.ref,
+ &creds,
+ &cur_fs,
+ fsck_options->start_path);
+
+ if (ret != 0)
+ {
+ printf("failed to validate object tree starting at [%s]. rc=[%d]\n",
+ fsck_options->start_path, ret);
+ }
+ else
+ {
+ printf("pvfs2-validate done validating object tree at [%s]\n",
+ fsck_options->start_path);
+ }
+
+ PVFS_fsck_finalize(fsck_options, &cur_fs, &creds);
+ PVFS_sys_finalize();
+ free(fsck_options);
+
+ return 0;
+}
+
+/**
+ * Validate a PVFS2 file, directory or symlink. Operates recursively to
+ * descend into directories.
+ *
+ * \retval 0 on success
+ * \retval -PVFS_EWARNING for non critical warnings
+ * \retval -PVFS_error on failure
+ */
+int validate_pvfs_object(
+ const struct PINT_fsck_options *fsck_options, /**< fsck options */
+ const PVFS_object_ref * pref, /**< object to validate */
+ const PVFS_credentials * creds, /**< caller's credentials */
+ int *cur_fs, /**< file system */
+ char *current_path) /**< path to object */
+{
+ int ret = 0;
+ int j = 0;
+ PVFS_sysresp_getattr attributes;
+ PVFS_dirent *directory_entries = NULL;
+ char* err_string = NULL;
+
+ memset(&attributes, 0, sizeof(attributes));
+
+ /* get this objects attributes */
+ ret = PVFS_fsck_get_attributes(fsck_options, pref, creds, &attributes);
+ if(ret < 0)
+ {
+ fprintf(stderr, "Error: [%s] cannot retrieve attributes.\n", current_path);
+ }
+ else if (attributes.attr.objtype == PVFS_TYPE_METAFILE)
+ {
+ /* metadata file */
+ ret = PVFS_fsck_validate_metafile(fsck_options, pref,
+ &attributes, creds);
+ }
+ else if (attributes.attr.objtype == PVFS_TYPE_DIRECTORY)
+ {
+ /* directory */
+ directory_entries = calloc(attributes.attr.dirent_count, sizeof(PVFS_dirent));
+ if (directory_entries == NULL)
+ {
+ perror("calloc");
+ return -PVFS_ENOMEM;
+ }
+
+ ret = PVFS_fsck_validate_dir(fsck_options, pref, &attributes, creds,
+ directory_entries);
+
+ if(ret == 0)
+ {
+ /* validate all directory entries recursively */
+ for (j = 0; j < attributes.attr.dirent_count; j++)
+ {
+ PVFS_object_ref obj_ref;
+ char new_path[PVFS_SEGMENT_MAX];
+
+ obj_ref.handle = directory_entries[j].handle;
+ obj_ref.fs_id = *cur_fs;
+
+ /* build full path name of the next object */
+ strcpy(new_path, current_path);
+ strcat(new_path, "/");
+ strcat(new_path, directory_entries[j].d_name);
+
+ /* recurse */
+ ret = validate_pvfs_object(fsck_options, &obj_ref, creds,
+ cur_fs, new_path);
+ }
+ }
+
+ free(directory_entries);
+ }
+ else if (attributes.attr.objtype == PVFS_TYPE_SYMLINK)
+ {
+ /* symbolic link */
+ ret = PVFS_fsck_validate_symlink(fsck_options, pref,
+ &attributes);
+ free(attributes.attr.link_target);
+ }
+ else
+ {
+ fprintf(stderr, "Error: [%s] is of an unknown object type: [%d]\n",
+ current_path, attributes.attr.objtype);
+ ret = -PVFS_EINVAL;
+ }
+
+ if (ret == 0)
+ {
+ if (fsck_options->verbose)
+ {
+ printf("validated [%s] object ret=[%d]\n", current_path, ret);
+ }
+ }
+ else
+ {
+ err_string = (char*)malloc(128*sizeof(char));
+ if(err_string)
+ {
+ PVFS_strerror_r(ret, err_string, 128);
+ fprintf(stderr, "Error: [%s] object is invalid (%s)\n",
+ current_path, err_string);
+ free(err_string);
+ }
+ else
+ {
+ fprintf(stderr, "Error: [%s] object is invalid (%d)\n",
+ current_path, ret);
+ }
+ }
+
+ /* Return 0, rather than "ret", too keep from propogating errors
+ * all the way back to the root object. We want to continue and show all
+ * problem rather than stopping on the first
+ */
+ return 0;
+}
+
+static void usage(
+ int argc,
+ char **argv)
+{
+ fprintf(stderr, "\n");
+ fprintf(stderr, "Usage : %s [-Vvharsfc] -d pvfs2_directory\n", argv[0]);
+ fprintf(stderr, "Recursively checks a PVFS2 directory or file for problems.\n");
+ fprintf(stderr, " -h \t print this help screen\n");
+ fprintf(stderr, " -d \t path to a PVFS2 directory/file\n");
+ fprintf(stderr, " \t (specify mount point to check entire file system)\n");
+ fprintf(stderr, " -c \t check for stranded objects\n");
+ fprintf(stderr, " \t (requires that -d refer to the PVFS2 root directory)\n");
+ fprintf(stderr, " -s \t check for bad practice in symbolic links\n");
+ fprintf(stderr, " -f \t check for bad practice in directory/file names\n");
+ fprintf(stderr,
+ " -F \t stop after confirming consistent configuration of all servers\n");
+ fprintf(stderr, " -V \t run in verbose mode\n");
+ fprintf(stderr, " -v \t print version and exit\n");
+ fprintf(stderr, " -a \t fix all problems found (NOT IMPLEMENTED)\n");
+ fprintf(stderr, " -r \t run in interactive mode (NOT IMPLEMENTED)\n");
+ fprintf(stderr, "\n\n");
+ fprintf(stderr, " Return Codes:\n");
+ fprintf(stderr,
+ " \tThe exit code returned by %s is the sum of the following conditions:\n", argv[0]);
+ fprintf(stderr, " \t\t 0 - No errors\n");
+ fprintf(stderr, " \t\t 1 - File system errors corrected\n");
+ fprintf(stderr, " \t\t 2 - System should be rebooted\n");
+ fprintf(stderr, " \t\t 4 - File system errors left uncorrected\n\n");
+
+ fprintf(stderr, " Example: %s -d /mnt/pvfs2\n", argv[0]);
+}
+
+static struct PINT_fsck_options *parse_args(int argc, char **argv)
+{
+ int opt = 0;
+ int path_length = 0;
+
+ struct PINT_fsck_options *opts;
+ opts = calloc(1, sizeof(struct PINT_fsck_options));
+ if (opts == NULL)
+ {
+ return NULL;
+ }
+
+ while ((opt = getopt(argc, argv, "d:VvharsfcF")) != EOF)
+ {
+ switch (opt)
+ {
+ case 'd':
+ opts->start_path = optarg;
+ path_length = strlen(optarg);
+ /* remove trailing extraneous */
+ if (optarg[path_length - 1] == '/' && path_length > 1)
+ {
+ optarg[path_length - 1] = '\0';
+ }
+ break;
+ case 'V':
+ opts->verbose = 1;
+ break;
+ case 'v':
+ printf("pvfs2-fsck version %s\n", VERSION);
+ exit(0);
+ break;
+ case 'c':
+ opts->check_stranded_objects = 1;
+ break;
+ case 'a':
+ opts->fix_errors = 1;
+ printf("Error: file system repair not implemented\n");
+ usage(argc, argv);
+ exit(-PVFS_ENOSYS);
+ break;
+ case 'r':
+ printf("Error: interactive mode not implemented\n");
+ usage(argc, argv);
+ exit(-PVFS_ENOSYS);
+ break;
+ case 's':
+ opts->check_symlink_target = 1;
+ break;
+ case 'F':
+ opts->check_fs_configs = 1;
+ break;
+ case 'f':
+ opts->check_dir_entry_names = 1;
+ break;
+ case 'h':
+ usage(argc, argv);
+ exit(0);
+ break;
+ case '?':
+ usage(argc, argv); /* unknown option */
+ exit(3);
+ }
+ }
+
+ return opts;
+}
+
+/* @} */
+
+/*
+ * Local variables:
+ * c-indent-level: 4
+ * c-basic-offset: 4
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 expandtab
+ */
Index: pvfs2-rm.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/pvfs2-rm.c,v
diff -p -u -r1.9 -r1.9.40.1
--- pvfs2-rm.c 22 Jul 2005 20:39:12 -0000 1.9
+++ pvfs2-rm.c 23 May 2007 20:48:41 -0000 1.9.40.1
@@ -39,6 +39,7 @@ int main(int argc, char **argv)
{
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 @@ int main(int argc, char **argv)
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 @@ int main(int argc, char **argv)
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)
@@ -99,9 +143,6 @@ int main(int argc, char **argv)
ret = -1;
break;
}
-
- credentials.uid = getuid();
- credentials.gid = getuid();
memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
rc = PVFS_sys_lookup(cur_fs, directory, &credentials,
Index: pvfs2-ls.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/pvfs2-ls.c,v
diff -p -u -r1.68 -r1.68.2.1
--- pvfs2-ls.c 23 Oct 2006 15:23:18 -0000 1.68
+++ pvfs2-ls.c 23 May 2007 20:48:41 -0000 1.68.2.1
@@ -424,8 +424,9 @@ int do_list(
pvfs_dirent_incount = MAX_NUM_DIRENTS;
memset(&getattr_response,0,sizeof(PVFS_sysresp_getattr));
- if (PVFS_sys_getattr(ref, PVFS_ATTR_SYS_ALL_NOHINT,
- &credentials, &getattr_response) == 0)
+ ret = PVFS_sys_getattr(ref, PVFS_ATTR_SYS_ALL_NOHINT,
+ &credentials, &getattr_response);
+ if(ret == 0)
{
if ((getattr_response.attr.objtype == PVFS_TYPE_METAFILE) ||
(getattr_response.attr.objtype == PVFS_TYPE_SYMLINK) ||
@@ -461,6 +462,11 @@ int do_list(
}
return 0;
}
+ }
+ else
+ {
+ PVFS_perror("PVFS_sys_getattr", ret);
+ return -1;
}
if (do_timing)
Index: pvfs2-fsck.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/pvfs2-fsck.c,v
diff -p -u -r1.21 -r1.21.2.1
--- pvfs2-fsck.c 23 Oct 2006 15:22:35 -0000 1.21
+++ pvfs2-fsck.c 23 May 2007 20:48:41 -0000 1.21.2.1
@@ -434,7 +434,7 @@ int traverse_directory_tree(PVFS_fs_id c
int server_count,
PVFS_credentials *creds)
{
- int ret, server_idx;
+ int ret, server_idx = 0;
PVFS_sysresp_lookup lookup_resp;
PVFS_sysresp_getattr getattr_resp;
PVFS_object_ref pref;
@@ -519,7 +519,7 @@ int descend(PVFS_fs_id cur_fs,
PVFS_ds_position token;
PVFS_sysresp_readdir readdir_resp;
PVFS_sysresp_getattr getattr_resp;
- PVFS_object_ref entry_ref;
+ PVFS_object_ref entry_ref = {0, 0};
count = 64;
@@ -534,7 +534,7 @@ int descend(PVFS_fs_id cur_fs,
for (i = 0; i < readdir_resp.pvfs_dirent_outcount; i++)
{
- int server_idx, ret, in_main_list = 0, in_alt_list = 0;
+ int server_idx = 0, ret, in_main_list = 0, in_alt_list = 0;
char *cur_file;
PVFS_handle cur_handle;
@@ -698,7 +698,7 @@ int verify_datafiles(PVFS_fs_id cur_fs,
int df_count,
PVFS_credentials *creds)
{
- int ret, i, server_idx, error = 0;
+ int ret, i, server_idx = 0, error = 0;
PVFS_handle *df_handles;
df_handles = (PVFS_handle *) malloc(df_count * sizeof(PVFS_handle));
Index: pvfs2-migrate-collection.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/pvfs2-migrate-collection.c,v
diff -p -u -r1.18.2.1 -r1.18.2.2
--- pvfs2-migrate-collection.c 29 Oct 2006 13:19:22 -0000 1.18.2.1
+++ pvfs2-migrate-collection.c 23 May 2007 20:48:41 -0000 1.18.2.2
@@ -1251,28 +1251,28 @@ static int translate_keyval_key_0_0_1(TR
if(!strncmp(db_key->data, "root_handle", strlen("root_handle")))
{
keyval->buffer = ROOT_HANDLE_KEYSTR;
- keyval->buffer_sz = strlen(ROOT_HANDLE_KEYSTR);
+ keyval->buffer_sz = ROOT_HANDLE_KEYLEN;
}
else if(!strncmp(db_key->data, "dir_ent", strlen("dir_ent")))
{
keyval->buffer = DIRECTORY_ENTRY_KEYSTR;
- keyval->buffer_sz = strlen(DIRECTORY_ENTRY_KEYSTR);
+ keyval->buffer_sz = DIRECTORY_ENTRY_KEYLEN;
}
else if(!strncmp(db_key->data,
"datafile_handles", strlen("datafile_handles")))
{
keyval->buffer = DATAFILE_HANDLES_KEYSTR;
- keyval->buffer_sz = strlen(DATAFILE_HANDLES_KEYSTR);
+ keyval->buffer_sz = DATAFILE_HANDLES_KEYLEN;
}
else if(!strncmp(db_key->data, "metafile_dist", strlen("metafile_dist")))
{
keyval->buffer = METAFILE_DIST_KEYSTR;
- keyval->buffer_sz = strlen(METAFILE_DIST_KEYSTR);
+ keyval->buffer_sz = METAFILE_DIST_KEYLEN;
}
else if(!strncmp(db_key->data, "symlink_target", strlen("symlink_target")))
{
keyval->buffer = SYMLINK_TARGET_KEYSTR;
- keyval->buffer_sz = strlen(SYMLINK_TARGET_KEYSTR);
+ keyval->buffer_sz = SYMLINK_TARGET_KEYLEN;
}
else
{
@@ -1385,11 +1385,12 @@ static int translate_keyval_db_0_0_1(
/* assume its a component name of a directory entry */
t_key.buffer = key.data;
t_key.buffer_sz = key.size;
+ t_val.buffer = data.data;
+ t_val.buffer_sz = data.size;
trove_flags |= TROVE_KEYVAL_HANDLE_COUNT;
trove_flags |= TROVE_NOOVERWRITE;
}
-
- if(!strncmp(t_key.buffer, "md", 2)) /* metafile_dist */
+ else if(!strncmp(t_key.buffer, "md", 2)) /* metafile_dist */
{
PINT_dist *newdist;
newdist = data.data;
Index: module.mk.in
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/module.mk.in,v
diff -p -u -r1.41.4.1 -r1.41.4.2
--- module.mk.in 31 Oct 2006 09:40:36 -0000 1.41.4.1
+++ module.mk.in 23 May 2007 20:48:41 -0000 1.41.4.2
@@ -20,6 +20,7 @@ ADMINSRC := \
$(DIR)/pvfs2-chown.c \
$(DIR)/pvfs2-fs-dump.c\
$(DIR)/pvfs2-fsck.c\
+ $(DIR)/pvfs2-validate.c\
$(DIR)/pvfs2-cp.c \
$(DIR)/pvfs2-viewdist.c \
$(DIR)/pvfs2-xattr.c \
Index: pvfs2-xattr.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/pvfs2-xattr.c,v
diff -p -u -r1.2 -r1.2.4.1
--- pvfs2-xattr.c 12 Oct 2006 17:07:34 -0000 1.2
+++ pvfs2-xattr.c 23 May 2007 20:48:41 -0000 1.2.4.1
@@ -22,14 +22,8 @@
#include "pint-util.h"
#include "pvfs2-internal.h"
#include "pvfs2-req-proto.h"
-#ifdef HAVE_SYS_XATTR_H
-#include <sys/xattr.h>
-#endif
-
-#ifdef HAVE_ATTR_XATTR_H
-#include <attr/xattr.h>
-#endif
+#include "xattr-utils.h"
#define VALBUFSZ 1024
@@ -219,7 +213,16 @@ static int pvfs2_eattr(int get, file_obj
}
else
{
- if ((ret = fsetxattr(obj->u.ufs.fd, key_p->buffer, val_p->buffer, val_p->buffer_sz, 0)) < 0)
+#ifdef HAVE_FSETXATTR
+ if ((ret = fsetxattr(obj->u.ufs.fd, key_p->buffer,
+ val_p->buffer, val_p->buffer_sz, 0
+#ifdef HAVE_FSETXATTR_EXTRA_ARGS
+ ,0
+#endif
+ )) < 0)
+#else
+ errno = ENOSYS;
+#endif
{
perror("fsetxattr:");
return -1;
@@ -416,7 +419,8 @@ static int generic_open(file_object *obj
return -1;
}
- if (resp_getattr.attr.objtype != PVFS_TYPE_METAFILE)
+ if (resp_getattr.attr.objtype != PVFS_TYPE_METAFILE &&
+ resp_getattr.attr.objtype != PVFS_TYPE_DIRECTORY)
{
fprintf(stderr, "Not a meta file!\n");
return -1;
Index: pvfs2-config.in
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/pvfs2-config.in,v
diff -p -u -r1.9 -r1.9.22.1
--- pvfs2-config.in 30 May 2006 20:26:26 -0000 1.9
+++ pvfs2-config.in 23 May 2007 20:48:41 -0000 1.9.22.1
@@ -70,7 +70,7 @@ while test $# -gt 0; do
libflags="$libflags -L at IB_LIBDIR@ -lvapi -lmtl_common -lmosal -lmpga -lpthread -ldl"
fi
if [ x"@BUILD_OPENIB@" = x"1" ]; then
- libflags="$libflags -L at OEPNIB_LIBDIR@ -libverbs"
+ libflags="$libflags -L at OPENIB_LIBDIR@ -libverbs"
fi
echo $libflags
Index: pvfs2-genconfig
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/admin/pvfs2-genconfig,v
diff -p -u -r1.63 -r1.63.2.1
--- pvfs2-genconfig 18 Oct 2006 19:34:11 -0000 1.63
+++ pvfs2-genconfig 23 May 2007 20:48:41 -0000 1.63.2.1
@@ -15,15 +15,18 @@ use strict 'vars';
# ugly global variables for option parsing
my $opt_protocol = '';
my $opt_port = '';
+my $opt_board = '';
my $opt_tcpport = '';
my $opt_gmport = '';
+my $opt_mxboard = '';
+my $opt_mxendpoint = '';
my $opt_ibport = '';
my $opt_ioservers = '';
my $opt_metaservers = '';
my $opt_logfile = '';
my $opt_storage = '';
my $opt_trovesync = '1';
-my $opt_trovemethod = 'dbpf';
+my $opt_trovemethod = '';
my $opt_quiet = '';
my $opt_logging = '';
my $opt_logstamp = '';
@@ -176,18 +179,6 @@ sub emit_defaults
print $target "<Defaults>\n";
print $target "\tUnexpectedRequests $num_unexp\n";
-
- if(defined($logfile))
- {
- # remove quotes from logfile if any
- if ($logfile =~ /\".*\"/)
- {
- $logfile =~ s/\"//g;
- }
-
- print $target "\tLogFile $logfile\n";
- }
-
print $target "\tEventLogging $logging\n";
print $target "\tLogStamp $logstamp\n";
print $target "\tBMIModules $bmi_module\n";
@@ -199,7 +190,6 @@ sub emit_defaults
print $target "\tClientJobFlowTimeoutSecs $client_job_timeout\n";
print $target "\tClientRetryLimit 5\n";
print $target "\tClientRetryDelayMilliSecs 2000\n";
- print $target "\tTroveMethod $opt_trovemethod\n";
print $target "</Defaults>\n";
}
@@ -290,6 +280,11 @@ sub emit_filesystem
print $target "\t\tCoalescingLowWatermark 1\n";
}
+ if($opt_trovemethod ne "")
+ {
+ print $target "\t\tTroveMethod $opt_trovemethod\n";
+ }
+
print $target "\t</StorageHints>\n";
if($opt_gen_key ne "0")
@@ -387,7 +382,7 @@ sub specusage
from the rest of the spec. While the protocols and ports are different, the
host for each uri must be the same. For example:
- --metaspec="[ib://myhosta:3335,gm://myhosta:6]:/psto,tcp://myhostb:3334"
+ --metaspec="[ib://myhosta:3335,gm://myhosta:6,mx://myhosta:0:3]:/psto,tcp://myhostb:3334"
This specifies that one endpoint is at myhosta with the infiniband and myrinet
protocols enabled, and the other endpoint is at myhostb with tcp enabled.
@@ -437,9 +432,11 @@ Usage: pvfs2-genconfig [OPTIONS] <fs.con
One of the two [] grouped options below must be chosen (for non-interactive):
[
- --protocol <PROTO>[,<PROTO>..] protocol(s) to use (tcp,gm,ib)
+ --protocol <PROTO>[,<PROTO>..] protocol(s) to use (tcp,gm,mx,ib)
--port <NUM> port to use (any single protocol)
- --ioservers <STRING> hostnames of data servers. Can be
+ --board <NUM> board index number for MX
+ (only required if --protocol=mx)
+ --ioservers <STRING> hostnames of data servers. Can be
<prefix>{#-#,#,#-#,...}
--metaservers <STRING> hostnames of meta servers.
]
@@ -454,6 +451,8 @@ Usage: pvfs2-genconfig [OPTIONS] <fs.con
--tcpport <NUM> TCP port to use
--gmport <NUM> GM port to use
+ --mxboard <NUM> MX board to use (default is 0)
+ --mxendpoint <NUM> MX endpoint to use (default is 3)
--ibport <NUM> IB port to use
--logging <STRING> debugging mask for log messages
--logstamp <STRING> timestamp type for log messages
@@ -539,7 +538,7 @@ sub get_protocol
# get network type
print $OUT <<"PROTOCOL"
You must first select the network protocol that your file system will use.
-The only currently supported options are \"tcp\", \"gm\", and \"ib\".
+The only currently supported options are \"tcp\", \"gm\", \"mx\", and \"ib\".
(For multi-homed configurations, use e.g. \"ib,tcp\".)
PROTOCOL
;;
@@ -573,10 +572,12 @@ PROTOCOL
}
} elsif ($_ eq "gm") {
$port{'gm'} = gm_get_port();
+ } elsif ($_ eq "mx") {
+ $port{'mx'} = mx_get_endpoint();
} elsif ($_ eq "ib") {
$port{'ib'} = ib_get_port();
} else {
- die "Sorry. At this time, only the tcp, gm and ib protocols are available\nfor use with this configuration utility.\n";
+ die "Sorry. At this time, only the tcp, gm, mx and ib protocols are available\nfor use with this configuration utility.\n";
}
}
@@ -752,6 +753,46 @@ sub gm_get_port
return $port;
}
+sub mx_get_endpoint
+{
+ my $port;
+ my $board = '0';
+
+ if ($opt_mxboard) {
+ $board = $opt_mxboard;
+ } elsif ($opt_board) {
+ $board = $opt_board;
+ } elsif (!$opt_iospec) {
+ if (!$opt_quiet) {
+ print $OUT "Choose a MX board (in the range of 0 to 4) for the servers to listen on. \n";
+ print $OUT "This script assumes that all servers will use the same board number.\n";
+ }
+ $board = prompt_num("Enter board number [Default is 0]: ","0");
+ }
+ # The number of boards is only limited by the number of PCI-X or PCI-Express
+ # slots in the machine. This is reasonable maximum.
+ ($board < 8) or die "MX board must be in the range 0 to 7";
+
+ if ($opt_mxendpoint) {
+ $port = $opt_mxendpoint;
+ } elsif ($opt_port) {
+ $port = $opt_port;
+ $opt_port = '';
+ } elsif (!$opt_iospec) {
+ if (!$opt_quiet) {
+ print $OUT "Choose a MX endpoint (in the range of 0 to 7) for the servers to listen on. \n";
+ print $OUT "This script assumes that all servers will use the same port number.\n";
+ }
+ $port = prompt_num("Enter port number [Default is 3]: ","3");
+ }
+ # The number of endpoints in MX is configurable. The default value is 4
+ # but may be changing to 8. It can be higher, but this is reasonable.
+ ($port < 8) or die "MX endpoint must be in the range 0 to 7";
+
+ $port = $board . ":" . $port;
+ return $port;
+}
+
sub ib_get_port
{
my $port;
@@ -1099,8 +1140,11 @@ my $show_specusage = '';
$opt_quiet = 0;
GetOptions('protocol=s' => \$opt_protocol,
'port=i' => \$opt_port,
+ 'board=i' => \$opt_board,
'tcpport=i' => \$opt_tcpport,
'gmport=i' => \$opt_gmport,
+ 'mxboard=i' => \$opt_mxboard,
+ 'mxendpoint=i' => \$opt_mxendpoint,
'ibport=i' => \$opt_ibport,
'ioservers=s' => \$opt_ioservers,
'metaservers=s' => \$opt_metaservers,
@@ -1177,6 +1221,8 @@ else
die "-port not allowed with -iospec or -metaspec."
if($opt_port ne '' && defined($opt_iospec) && defined($opt_metaspec));
+die "-board not allowed with -iospec or -metaspec."
+if($opt_board ne '' && defined($opt_iospec) && defined($opt_metaspec));
die "-iospec requires -metaspec."
if(defined($opt_iospec) && !defined($opt_metaspec));
die "-metaspec requires -iospec."
@@ -1315,7 +1361,7 @@ if ($opt_security == 1)
}
emit_aliases($output_target);
emit_filesystem($output_target, "pvfs2-fs", $fsid, $root_handle,
- $last_handle, $first_handle, $count, $default_num_dfiles);
+ $last_handle, $first_handle, $meta_count + $io_count, $default_num_dfiles);
# close fs.conf
if ($using_stdout == 0)
More information about the Pvfs2-cvs
mailing list