Whamcloud - gitweb
file configurable-x86-stack-2.4.22-rh.patch was initially added on branch b_devel.
[fs/lustre-release.git] / lustre / llite / commit_callback.c
index ee6ae03..99fc285 100644 (file)
@@ -1,10 +1,10 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
- *  The daemon that causes completed but not committed transactions 
+ *  The daemon that causes completed but not committed transactions
  *   on the MDS to be flushed periodically when they are committed.
- *   A gratuitous getattr RPC is made to the MDS to discover the 
- *   last committed record. 
+ *   A gratuitous getattr RPC is made to the MDS to discover the
+ *   last committed record.
  *
  *  Lustre High Availability Daemon
  *
 
 #include <linux/lustre_lite.h>
 #include <linux/lustre_lib.h>
+#include <linux/lustre_compat25.h>
 
 static int ll_commitcbd_check_event(struct ll_sb_info *sbi)
 {
-        int rc = 0; 
+        int rc = 0;
         ENTRY;
 
-        spin_lock(&sbi->ll_commitcbd_lock); 
-        if (sbi->ll_commitcbd_flags & LL_COMMITCBD_STOPPING) { 
+        spin_lock(&sbi->ll_commitcbd_lock);
+        if (sbi->ll_commitcbd_flags & LL_COMMITCBD_STOPPING)
                 GOTO(out, rc = 1);
-        }
 
+        EXIT;
  out:
         spin_unlock(&sbi->ll_commitcbd_lock);
-        RETURN(rc);
+        return rc;
 }
 
 static int ll_commitcbd_main(void *arg)
 {
         struct ll_sb_info *sbi = (struct ll_sb_info *)arg;
-
+        unsigned long flags;
         ENTRY;
 
         lock_kernel();
-        daemonize();
-        spin_lock_irq(&current->sigmask_lock);
+        kportal_daemonize("lustre_commitcbd");
+
+        SIGNAL_MASK_LOCK(current, flags);
         sigfillset(&current->blocked);
-        recalc_sigpending(current);
-        spin_unlock_irq(&current->sigmask_lock);
+        RECALC_SIGPENDING;
+        SIGNAL_MASK_UNLOCK(current, flags);
 
-        sprintf(current->comm, "lustre_commitcbd");
         unlock_kernel();
 
         /* Record that the  thread is running */
-        sbi->ll_commitcbd_waketime = CURRENT_TIME;
+        sbi->ll_commitcbd_waketime = LTIME_S(CURRENT_TIME);
         sbi->ll_commitcbd_timeout = 10 * HZ;
         sbi->ll_commitcbd_thread = current;
         sbi->ll_commitcbd_flags =  LL_COMMITCBD_RUNNING;
@@ -75,19 +76,19 @@ static int ll_commitcbd_main(void *arg)
 
         /* And now, loop forever on requests */
         while (1) {
-                wait_event(sbi->ll_commitcbd_waitq, 
-                           ll_commitcbd_check_event(sbi));
+                struct l_wait_info lwi = { 0 };
+                l_wait_event(sbi->ll_commitcbd_waitq,
+                             ll_commitcbd_check_event(sbi), &lwi);
 
                 spin_lock(&sbi->ll_commitcbd_lock);
                 if (sbi->ll_commitcbd_flags & LL_COMMITCBD_STOPPING) {
                         spin_unlock(&sbi->ll_commitcbd_lock);
-                        CERROR("lustre_commitd quitting\n"); 
                         EXIT;
                         break;
                 }
 
                 schedule_timeout(sbi->ll_commitcbd_timeout);
-                CERROR("commit callback daemon woken up - FIXME\n"); 
+                CERROR("commit callback daemon woken up - FIXME\n");
                 spin_unlock(&sbi->ll_commitcbd_lock);
         }
 
@@ -103,6 +104,7 @@ static int ll_commitcbd_main(void *arg)
 int ll_commitcbd_setup(struct ll_sb_info *sbi)
 {
         int rc;
+        struct l_wait_info lwi = { 0 };
         ENTRY;
 
         rc = kernel_thread(ll_commitcbd_main, (void *) sbi,
@@ -111,18 +113,19 @@ int ll_commitcbd_setup(struct ll_sb_info *sbi)
                 CERROR("cannot start thread\n");
                 RETURN(rc);
         }
-        wait_event(sbi->ll_commitcbd_ctl_waitq, 
-                   sbi->ll_commitcbd_flags & LL_COMMITCBD_RUNNING);
+        l_wait_event(sbi->ll_commitcbd_ctl_waitq,
+                     sbi->ll_commitcbd_flags & LL_COMMITCBD_RUNNING, &lwi);
         RETURN(0);
 }
 
 
 int ll_commitcbd_cleanup(struct ll_sb_info *sbi)
 {
+        struct l_wait_info lwi = { 0 };
         sbi->ll_commitcbd_flags = LL_COMMITCBD_STOPPING;
 
         wake_up(&sbi->ll_commitcbd_waitq);
-        wait_event(sbi->ll_commitcbd_ctl_waitq,
-                   sbi->ll_commitcbd_flags & LL_COMMITCBD_STOPPED);
+        l_wait_event(sbi->ll_commitcbd_ctl_waitq,
+                     sbi->ll_commitcbd_flags & LL_COMMITCBD_STOPPED, &lwi);
         RETURN(0);
 }