On Wed, 2003-09-17 at 07:22, szonyi calin wrote:
> same question from me :-)
> I started fsck.jfs -f -v /dev/hda6 
> on a 8 GB partition at around 0:00 AM. At 9:45 AM was
> still running (no disk activity - just some messages 
> about Duplicate object found at ... on filesystem object ... --
> i don't recall the exact errror message)
> fsck.jfs was running at -15 priority on a 2.4.18 manfrake kernel
> I was doing a gdb on the fsck process to see what's doing
> gdb said: <a_hex_number> in strncpy 
> 
> I am wondering if I have such a problem on a 120 GB partition
>  how long will it take for fsck to fix it

I don't know how long it would take, but if there's no disk activity,
I'd guess that it won't finish.  It be nice if I could get a stack trace
(compiled with CFLAGS=-g).  fsck doesn't call strncpy from too many
places.  It's probably in fsck_record_msg(), but I don't think it should
hang there, so it may be looping somewhere and calling in here
repeatedly.

Sandr8 tried this and hit a trap.  The patch below should fix that
trap.  I don't think it will fix the hang though.

Index: jfsutils/fsck/fsck_message.c
===================================================================
RCS file: /usr/cvs/jfs/jfsutils/fsck/fsck_message.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- jfsutils/fsck/fsck_message.c        25 Jun 2003 21:04:17 -0000      1.1
+++ jfsutils/fsck/fsck_message.c        16 Sep 2003 21:42:49 -0000      1.2
@@ -31,23 +31,26 @@
        char *buf_entry_ptr;
        int i;
 
-       if ((!agg_recptr->fscklog_full) && (agg_recptr->fscklog_buf_allocated)
-           && (!agg_recptr->fscklog_buf_alloc_err)) {
-               /* logging is active */
-               hdptr = (struct fscklog_entry_hdr *) log_entry;
-               msg = &log_entry[entry_length];
-               strncpy(msg, msg_txt, max_log_entry_length - entry_length);
-               entry_length += strlen(msg_txt);
-               /* add null terminator to string */
-               log_entry[entry_length++] = '\0';
-       }
+       if (agg_recptr->fscklog_full || !agg_recptr->fscklog_buf_allocated ||
+           agg_recptr->fscklog_buf_alloc_err)
+               return;
+
+       /* logging is active */
+       hdptr = (struct fscklog_entry_hdr *) log_entry;
+       msg = &log_entry[entry_length];
+       strncpy(msg, msg_txt, max_log_entry_length - entry_length);
+       entry_length += strlen(msg_txt);
+       /* add null terminator to string */
+       log_entry[entry_length++] = '\0';
 
        /* pad to the next 4 byte boundary */
        entry_length = ((entry_length + 3) / 4) * 4;
        hdptr->entry_length = entry_length;
-       buffer_bytes_left = agg_recptr->fscklog_buf_length - 
agg_recptr->fscklog_buf_data_len;
+       buffer_bytes_left = agg_recptr->fscklog_buf_length -
+                           agg_recptr->fscklog_buf_data_len;
        if (buffer_bytes_left < entry_length) {
-               agg_recptr->fscklog_last_msghdr->entry_length += buffer_bytes_left;
+               agg_recptr->fscklog_last_msghdr->entry_length +=
+                       buffer_bytes_left;
                fscklog_put_buffer();
                // clear the buffer
                memset((void *) (agg_recptr->fscklog_buf_ptr), 0,
@@ -63,7 +66,8 @@
 
                memcpy((void *) buf_entry_ptr, (void *) hdptr, entry_length);
 
-               agg_recptr->fscklog_last_msghdr = (struct fscklog_entry_hdr *) 
buf_entry_ptr;
+               agg_recptr->fscklog_last_msghdr =
+                       (struct fscklog_entry_hdr *) buf_entry_ptr;
                agg_recptr->fscklog_buf_data_len += entry_length;
        }
 }
@@ -104,7 +108,8 @@
        }
 
        // append file and line number information to string for logging
-       strncat(msg_string, debug_detail, max_log_entry_length - 4 - 
strlen(msg_string));
+       strncat(msg_string, debug_detail,
+               max_log_entry_length - 4 - strlen(msg_string));
 
        fsck_record_msg(msg_string);
 



_______________________________________________
Jfs-discussion mailing list
[EMAIL PROTECTED]
http://www-124.ibm.com/developerworks/oss/mailman/listinfo/jfs-discussion

Reply via email to