Re: [Pvfs2-developers] patches: mount bug fixes
Committed to CVS HEAD. -sam On Mar 20, 2007, at 8:43 AM, Phil Carns wrote: initialize-dyn.patch: - This is a correction to the initialize-dyn test program. It previously hardcoded the number of mounted file systems and would crash if a different number were mounted. mount-mem-leaks.patch: -- This patch corrects multiple memory leaks in the mount path. The largest one was happening when the same file system was mounted multiple times. In that case, the configuration data was cached, but not before a new copy had been generated. The new copy was not being free'd. remount.patch: -- This patch fixes a bug in mount.pvfs2 (only used on 2.4 kernels). It did not handle the "remount" flag correctly. Index: pvfs2_src/test/client/sysint/initialize-dyn.c === --- pvfs2_src/test/client/sysint/initialize-dyn.c (revision 2805) +++ pvfs2_src/test/client/sysint/initialize-dyn.c (revision 2806) @@ -11,8 +11,6 @@ #include "client.h" #include "pvfs2-util.h" -#define MAX_NUM_MNT 3 - int main(int argc, char **argv) { int ret = -1; @@ -61,7 +59,7 @@ printf("*** All defaults initialized\n"); /* make sure we can resolve all mnt points */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { ret = PVFS_util_resolve(mntent[i].mnt_dir, &fs_id, buf, PVFS_NAME_MAX); @@ -80,7 +78,7 @@ } /* remove the mount points */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { printf("Removing mount entry %d: %s\n", i, mntent[i].mnt_dir); @@ -94,7 +92,7 @@ } /* make sure we *can't* resolve all mnt points */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { ret = PVFS_util_resolve(mntent[i].mnt_dir, &fs_id, buf, PVFS_NAME_MAX); @@ -112,7 +110,7 @@ } /* re-add the mount points */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { printf("Adding dynamic mount entry %d: %s\n", i, mntent[i].mnt_dir); @@ -129,7 +127,7 @@ make sure we can re-resolve all mnt points now that they've been moved to the dynamic area of the book keeping */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { ret = PVFS_util_resolve(mntent[i].mnt_dir, &fs_id, buf, PVFS_NAME_MAX); @@ -148,7 +146,7 @@ } /* remove the dynamic mount points */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { printf("Removing dynamic mount entry %d: %s\n", i, mntent[i].mnt_dir); @@ -162,7 +160,7 @@ } /* make sure we *can't* resolve all mnt points */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { ret = PVFS_util_resolve(mntent[i].mnt_dir, &fs_id, buf, PVFS_NAME_MAX); @@ -180,7 +178,7 @@ } /* re-add the mount points */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { printf("Adding dynamic mount entry %d: %s\n", i, mntent[i].mnt_dir); @@ -194,7 +192,7 @@ } /* re-resolve one more time -- to be sure ;-) */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { ret = PVFS_util_resolve(mntent[i].mnt_dir, &fs_id, buf, PVFS_NAME_MAX); Index: pvfs2_src/src/apps/kernel/linux/pvfs2-client-core.c === --- pvfs2_src/src/apps/kernel/linux/pvfs2-client-core.c (revision 3131) +++ pvfs2_src/src/apps/kernel/linux/pvfs2-client-core.c (revision 3132) @@ -2345,6 +2345,7 @@ } PVFS_util_free_mntent(vfs_request->mntent); +free(vfs_request->mntent); break; case PVFS2_VFS_OP_RENAME: Index: pvfs2_src/src/common/misc/pvfs2-util.c === --- pvfs2_src/src/common/misc/pvfs2-util.c (revision 3131) +++ pvfs2_src/src/common/misc/pvfs2-util.c (revision 3132) @@ -921,6 +921,7 @@ } PVFS_util_copy_mntent( &tmp_mnt_array[new_count++], current_mnt); +PVFS_util_free_mntent(current_mnt); } /* finally, swap the mntent arrays */ Index: pvfs2_src/src/common/misc/server-config-mgr.c === --- pvfs2_src/src/common/misc/server-config-mgr.c (revision 3132) +++ pvfs2_src/src/common/misc/server-config-mgr.c (revision 3133) @@ -221,12 +221,15 @@ int PINT_server_config_mg
[Pvfs2-developers] patches: mount bug fixes
initialize-dyn.patch: - This is a correction to the initialize-dyn test program. It previously hardcoded the number of mounted file systems and would crash if a different number were mounted. mount-mem-leaks.patch: -- This patch corrects multiple memory leaks in the mount path. The largest one was happening when the same file system was mounted multiple times. In that case, the configuration data was cached, but not before a new copy had been generated. The new copy was not being free'd. remount.patch: -- This patch fixes a bug in mount.pvfs2 (only used on 2.4 kernels). It did not handle the "remount" flag correctly. Index: pvfs2_src/test/client/sysint/initialize-dyn.c === --- pvfs2_src/test/client/sysint/initialize-dyn.c (revision 2805) +++ pvfs2_src/test/client/sysint/initialize-dyn.c (revision 2806) @@ -11,8 +11,6 @@ #include "client.h" #include "pvfs2-util.h" -#define MAX_NUM_MNT 3 - int main(int argc, char **argv) { int ret = -1; @@ -61,7 +59,7 @@ printf("*** All defaults initialized\n"); /* make sure we can resolve all mnt points */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { ret = PVFS_util_resolve(mntent[i].mnt_dir, &fs_id, buf, PVFS_NAME_MAX); @@ -80,7 +78,7 @@ } /* remove the mount points */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { printf("Removing mount entry %d: %s\n", i, mntent[i].mnt_dir); @@ -94,7 +92,7 @@ } /* make sure we *can't* resolve all mnt points */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { ret = PVFS_util_resolve(mntent[i].mnt_dir, &fs_id, buf, PVFS_NAME_MAX); @@ -112,7 +110,7 @@ } /* re-add the mount points */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { printf("Adding dynamic mount entry %d: %s\n", i, mntent[i].mnt_dir); @@ -129,7 +127,7 @@ make sure we can re-resolve all mnt points now that they've been moved to the dynamic area of the book keeping */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { ret = PVFS_util_resolve(mntent[i].mnt_dir, &fs_id, buf, PVFS_NAME_MAX); @@ -148,7 +146,7 @@ } /* remove the dynamic mount points */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { printf("Removing dynamic mount entry %d: %s\n", i, mntent[i].mnt_dir); @@ -162,7 +160,7 @@ } /* make sure we *can't* resolve all mnt points */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { ret = PVFS_util_resolve(mntent[i].mnt_dir, &fs_id, buf, PVFS_NAME_MAX); @@ -180,7 +178,7 @@ } /* re-add the mount points */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { printf("Adding dynamic mount entry %d: %s\n", i, mntent[i].mnt_dir); @@ -194,7 +192,7 @@ } /* re-resolve one more time -- to be sure ;-) */ -for(i = 0; i < MAX_NUM_MNT; i++) +for(i = 0; i < tab->mntent_count; i++) { ret = PVFS_util_resolve(mntent[i].mnt_dir, &fs_id, buf, PVFS_NAME_MAX); Index: pvfs2_src/src/apps/kernel/linux/pvfs2-client-core.c === --- pvfs2_src/src/apps/kernel/linux/pvfs2-client-core.c (revision 3131) +++ pvfs2_src/src/apps/kernel/linux/pvfs2-client-core.c (revision 3132) @@ -2345,6 +2345,7 @@ } PVFS_util_free_mntent(vfs_request->mntent); +free(vfs_request->mntent); break; case PVFS2_VFS_OP_RENAME: Index: pvfs2_src/src/common/misc/pvfs2-util.c === --- pvfs2_src/src/common/misc/pvfs2-util.c (revision 3131) +++ pvfs2_src/src/common/misc/pvfs2-util.c (revision 3132) @@ -921,6 +921,7 @@ } PVFS_util_copy_mntent( &tmp_mnt_array[new_count++], current_mnt); +PVFS_util_free_mntent(current_mnt); } /* finally, swap the mntent arrays */ Index: pvfs2_src/src/common/misc/server-config-mgr.c === --- pvfs2_src/src/common/misc/server-config-mgr.c (revision 3132) +++ pvfs2_src/src/common/misc/server-config-mgr.c (revision 3133) @@ -221,12 +221,15 @@ int PINT_server_config_mgr_add_config( struct server_configuration_s *config_s, -PVFS_fs_id fs_id) +PVFS_fs_id fs_id, +int* fr