Whamcloud - gitweb
Branch b_release_1_8_1
authortianzy <tianzy>
Wed, 3 Jun 2009 03:48:40 +0000 (03:48 +0000)
committertianzy <tianzy>
Wed, 3 Jun 2009 03:48:40 +0000 (03:48 +0000)
fix soft lockup in tracefiled()
b=19263
i=robert.read
i=johann

libcfs/libcfs/tracefile.c

index ff61359..af9250d 100644 (file)
@@ -953,6 +953,7 @@ static int tracefiled(void *arg)
         struct trace_page *tmp;
         struct ptldebug_header *hdr;
         cfs_file_t *filp;
+        int last_loop = 0;
         int rc;
 
         CFS_DECL_MMSPACE;
@@ -970,7 +971,7 @@ static int tracefiled(void *arg)
                 pc.pc_want_daemon_pages = 0;
                 collect_pages(&pc);
                 if (list_empty(&pc.pc_pages))
-                        continue;
+                        goto end_loop;
 
                 filp = NULL;
                 tracefile_read_lock();
@@ -986,7 +987,7 @@ static int tracefiled(void *arg)
                 if (filp == NULL) {
                         put_pages_on_daemon_list(&pc);
                         __LASSERT(list_empty(&pc.pc_pages));
-                        continue;
+                        goto end_loop;
                 }
 
                 CFS_MMSPACE_OPEN;
@@ -1042,16 +1043,21 @@ static int tracefiled(void *arg)
                         printk(KERN_ERR "There are %d pages unwritten\n", i);
                 }
                 __LASSERT(list_empty(&pc.pc_pages));
-
+end_loop:
+                if (atomic_read(&tctl->tctl_shutdown)) {
+                        if (last_loop == 0) {
+                                last_loop = 1;
+                                continue;
+                        } else {
+                                break;
+                        }
+                }
                 cfs_waitlink_init(&__wait);
                 cfs_waitq_add(&tctl->tctl_waitq, &__wait);
                 set_current_state(TASK_INTERRUPTIBLE);
                 cfs_waitq_timedwait(&__wait, CFS_TASK_INTERRUPTIBLE,
                                     cfs_time_seconds(1));
                 cfs_waitq_del(&tctl->tctl_waitq, &__wait);
-
-                if (atomic_read(&tctl->tctl_shutdown))
-                        break;
         }
         complete(&tctl->tctl_stop);
         return 0;