Whamcloud - gitweb
Introduce .gitignore files.
[fs/lustre-release.git] / libcfs / libcfs / tracefile.c
index ff61359..4da6f81 100644 (file)
@@ -785,6 +785,7 @@ int trace_copyout_string(char *usr_buffer, int usr_buffer_nob,
 
         return nob;
 }
+EXPORT_SYMBOL(trace_copyout_string);
 
 int trace_allocate_string_buffer(char **str, int nob)
 {
@@ -953,6 +954,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 +972,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 +988,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 +1044,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;