Hi Michael,
Nice catch..
Attached patch against HEAD should fix this bug!
thanks for the test case.
Very helpful in narrowing it down.
thanks,
Murali

On 6/19/07, Michael Kuhn <[EMAIL PROTECTED]> wrote:
Hi,

I did some tests with large numbers of files and wasn't very creative
naming them. While doing these tests, I encountered a rather strange
bug. Try the following:

% pvfs2-server fs.conf server.conf-localhost -f
[S 06/19 23:41] PVFS2 Server version 2.7.0pre1-2007-06-19-214004
starting...
[D 06/19 23:41] PVFS2 Server: storage space created. Exiting.
% pvfs2-server fs.conf server.conf-localhost
[S 06/19 23:41] PVFS2 Server version 2.7.0pre1-2007-06-19-214004
starting...
% pvfs2-mkdir /pvfs2/dir1 /pvfs2/dir1/{0..9}
% pvfs2-touch /pvfs2/dir1/{0..9}/{0..499}
% pvfs2-mkdir /pvfs2/dir2 /pvfs2/dir2/{0..9}
% pvfs2-touch /pvfs2/dir2/{0..9}/{0..499}
% pvfs2-ls /pvfs2/dir1/{0..9}
Ignoring path /pvfs2/dir1/8
Ignoring path /pvfs2/dir1/9
/dir1/0:
0
[...]
499

/dir1/1:
zsh: segmentation fault (core dumped)  pvfs2-ls /pvfs2/dir1/{0..9}
% pvfs2-ls /pvfs2/dir2/{0..9}
Ignoring path /pvfs2/dir2/8
Ignoring path /pvfs2/dir2/9
/dir2/0:
0
[...]
499

/dir2/1:
0
[...]
499

/dir2/2:
zsh: segmentation fault (core dumped)  pvfs2-ls /pvfs2/dir2/{0..9}

Notice how it crashes on /pvfs2/dir1/1 and /pvfs2/dir2/2. So this crash
seems to have something to do with the name of the parent directory.
The crash occurs in the call of PVFS_sys_lookup() of pvfs2-ls's
do_list().

Here's the Valgrind output:

==2643== Process terminating with default action of signal 11 (SIGSEGV)
==2643==  Access not within mapped region at address 0x0
==2643==    at 0x4022508: strlen (mc_replace_strmem.c:246)
==2643==    by 0x8059C54: PINT_ncache_update (in pvfs2-ls)
==2643==    by 0x8061F39: lookup_segment_lookup_comp_fn (in pvfs2-ls)
==2643==    by 0x809FF58: msgpairarray_completion_fn (in pvfs2-ls)
==2643==    by 0x80A19ED: PINT_state_machine_invoke (in pvfs2-ls)
==2643==    by 0x80A1669: PINT_state_machine_next (in pvfs2-ls)
==2643==    by 0x80A1E00: PINT_state_machine_continue (in pvfs2-ls)
==2643==    by 0x805B2B9: PINT_client_state_machine_test (in pvfs2-ls)
==2643==    by 0x805B415: PINT_client_wait_internal (in pvfs2-ls)
==2643==    by 0x805B4ED: PVFS_sys_wait (in pvfs2-ls)
==2643==    by 0x80626BE: PVFS_sys_ref_lookup (in pvfs2-ls)
==2643==    by 0x80627FB: PVFS_sys_lookup (in pvfs2-ls)


Regards, Michael

_______________________________________________
Pvfs2-users mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-users

Index: src/client/sysint/sys-lookup.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/client/sysint/sys-lookup.sm,v
retrieving revision 1.68
diff -u -r1.68 sys-lookup.sm
--- src/client/sysint/sys-lookup.sm	13 Apr 2007 05:14:16 -0000	1.68
+++ src/client/sysint/sys-lookup.sm	20 Jun 2007 06:08:51 -0000
@@ -170,11 +170,11 @@
     char *pathname,
     PVFS_object_ref ctx_starting_refn)
 {
-    int ret = -PVFS_EINVAL, pathlen = 0, num_segments = 0;
+    int i, ret = -PVFS_EINVAL, pathlen = 0, num_segments = 0;
     void *state = NULL;
     int cur_seg_index = 0, prev_ctx_index = 0;
     char *cur_seg_name = NULL;
-    char *orig_pathname = NULL, *seg_remaining = NULL;
+    char *orig_pathname = NULL, *seg_remaining = NULL, *slash_str = NULL;
     PINT_client_lookup_sm_segment *cur_seg = NULL;
     int num_consecutive_prev_ctx_dot_dots = 0;
     PINT_client_lookup_sm_ctx *ctx = NULL;
@@ -378,7 +378,16 @@
             cur_seg->seg_name = strdup(cur_seg_name);
             assert(cur_seg->seg_name);
 
-            seg_remaining = strstr(orig_pathname, cur_seg_name);
+            slash_str = orig_pathname;
+            for (i = 0; i < cur_seg_index; i++) {
+                slash_str = strrchr(slash_str, '/');
+                if (slash_str == NULL) {
+                    break;
+                }
+                slash_str++;
+            }
+            //seg_remaining = strstr(orig_pathname, cur_seg_name);
+            seg_remaining = slash_str;
             if (seg_remaining)
             {
                 gossip_debug(GOSSIP_LOOKUP_DEBUG,
Index: src/server/lookup.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/lookup.sm,v
retrieving revision 1.53
diff -u -r1.53 lookup.sm
--- src/server/lookup.sm	13 Apr 2007 05:14:30 -0000	1.53
+++ src/server/lookup.sm	20 Jun 2007 06:08:58 -0000
@@ -150,12 +150,6 @@
     struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
     char *ptr = NULL;
 
-    gossip_debug(GOSSIP_SERVER_DEBUG, " STARTING LOOKUP REQUEST "
-                     "(path:%s)(fs_id:%d)(handle:%llu)(attrmask:%u)\n",
-                     s_op->req->u.lookup_path.path,
-                     s_op->req->u.lookup_path.fs_id,
-                     llu(s_op->req->u.lookup_path.starting_handle),
-                     s_op->req->u.lookup_path.attrmask);
 
     /* fill in the lookup portion of the PINT_server_op */
     s_op->u.lookup.segp = NULL;
@@ -165,6 +159,14 @@
     s_op->u.lookup.handle_ct = 0;
     s_op->u.lookup.attr_ct = 0;
 
+    gossip_debug(GOSSIP_SERVER_DEBUG, " STARTING LOOKUP REQUEST "
+                     "(path:%s)(fs_id:%d)(handle:%llu)(attrmask:%u)"
+                     "(# of segments:%u)\n",
+                     s_op->req->u.lookup_path.path,
+                     s_op->req->u.lookup_path.fs_id,
+                     llu(s_op->req->u.lookup_path.starting_handle),
+                     s_op->req->u.lookup_path.attrmask,
+                     s_op->u.lookup.seg_ct);
     if ((s_op->u.lookup.seg_ct < 0) ||
         (s_op->u.lookup.seg_ct > PVFS_REQ_LIMIT_PATH_SEGMENT_COUNT))
     {

_______________________________________________
Pvfs2-users mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-users

Reply via email to