diff --git a/libcfs/include/libcfs/linux/kp30.h b/libcfs/include/libcfs/linux/kp30.h
index ff19b55..3c50da4 100644
--- a/libcfs/include/libcfs/linux/kp30.h
+++ b/libcfs/include/libcfs/linux/kp30.h
@@ -111,7 +111,9 @@ do {                                                                          \
 #define LASSERT_SPIN_LOCKED(lock) do {(void)sizeof(lock);} while(0)
 #define LINVRNT_SPIN_LOCKED(lock) do {(void)sizeof(lock);} while(0)
 #endif
+
 #define LASSERT_SEM_LOCKED(sem) LASSERT(down_trylock(sem) != 0)
+#define LASSERT_MUTEX_LOCKED(x) LASSERT(mutex_is_locked(x))
 
 #ifdef HAVE_SEM_COUNT_ATOMIC
 #define SEM_COUNT(sem)          (atomic_read(&(sem)->count))
diff --git a/libcfs/include/libcfs/linux/linux-lock.h b/libcfs/include/libcfs/linux/linux-lock.h
index e3a8e66..84f4253 100644
--- a/libcfs/include/libcfs/linux/linux-lock.h
+++ b/libcfs/include/libcfs/linux/linux-lock.h
@@ -119,7 +119,6 @@ typedef spinlock_t cfs_spinlock_t;
  */
 typedef struct rw_semaphore cfs_rw_semaphore_t;
 
-#define cfs_sema_init(s, val)     sema_init(s, val)
 #define cfs_init_rwsem(s)         init_rwsem(s)
 #define cfs_down_read(s)          down_read(s)
 #define cfs_down_read_trylock(s)  down_read_trylock(s)
@@ -133,11 +132,6 @@ typedef struct rw_semaphore cfs_rw_semaphore_t;
 #define CFS_DECLARE_RWSEM(name)   DECLARE_RWSEM(name)
 
 /*
- * semaphore "implementation" (use Linux kernel's primitives)
- */
-typedef struct semaphore      cfs_semaphore_t;
-
-/*
  * rwlock_t "implementation" (use Linux kernel's primitives)
  *
  * - rwlock_init(x)
@@ -190,69 +184,50 @@ typedef struct completion cfs_completion_t;
 #define cfs_fini_completion(c)                   do { } while (0)
 
 /*
+ * semaphore "implementation" (use Linux kernel's primitives)
+ * - DEFINE_SEMAPHORE(name)
+ * - sema_init(sem, val)
+ * - up(sem)
+ * - down(sem)
+ * - down_interruptible(sem)
+ * - down_trylock(sem)
+ */
+typedef struct semaphore      cfs_semaphore_t;
+
+#ifdef DEFINE_SEMAPHORE
+#define CFS_DEFINE_SEMAPHORE(name)          DEFINE_SEMAPHORE(name)
+#else
+#define CFS_DEFINE_SEMAPHORE(name)          DECLARE_MUTEX(name)
+#endif
+
+#define cfs_sema_init(sem, val)             sema_init(sem, val)
+#define cfs_up(x)                           up(x)
+#define cfs_down(x)                         down(x)
+#define cfs_down_interruptible(x)           down_interruptible(x)
+#define cfs_down_trylock(x)                 down_trylock(x)
+
+/*
  * mutex "implementation" (use Linux kernel's primitives)
  *
- * - DECLARE_MUTEX(name)
+ * - DEFINE_MUTEX(name)
  * - mutex_init(x)
- * - init_mutex(x)
- * - init_mutex_locked(x)
- * - init_MUTEX_LOCKED(x)
- * - mutex_up(x)
- * - mutex_down(x)
- * - up(x)
- * - down(x)
- * - mutex_down_trylock(x)
  * - mutex_lock(x)
  * - mutex_unlock(x)
+ * - mutex_trylock(x)
+ * - mutex_is_locked(x)
+ * - mutex_destroy(x)
  */
 typedef struct mutex cfs_mutex_t;
 
 #define CFS_DEFINE_MUTEX(name)             DEFINE_MUTEX(name)
-#define CFS_DECLARE_MUTEX(name)            DECLARE_MUTEX(name)
 
 #define cfs_mutex_init(x)                   mutex_init(x)
-#define cfs_init_mutex(x)                   init_MUTEX(x)
-#define cfs_init_mutex_locked(x)            init_MUTEX_LOCKED(x)
-#define cfs_mutex_up(x)                     up(x)
-#define cfs_mutex_down(x)                   down(x)
-#define cfs_up(x)                           up(x)
-#define cfs_down(x)                         down(x)
-#define cfs_down_interruptible(x)           down_interruptible(x)
-#define cfs_mutex_down_trylock(x)           down_trylock(x)
 #define cfs_mutex_lock(x)                   mutex_lock(x)
 #define cfs_mutex_unlock(x)                 mutex_unlock(x)
+#define cfs_mutex_lock_interruptible(x)     mutex_lock_interruptible(x)
 #define cfs_mutex_trylock(x)                mutex_trylock(x)
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
-
-/**************************************************************************
- *
- * Mutex interface from newer Linux kernels.
- *
- * this augments compatibility interface from include/linux/mutex.h
- *
- **************************************************************************/
-
-static inline void cfs_mutex_destroy(cfs_mutex_t *lock)
-{
-}
-
-/*
- * This is for use in assertions _only_, i.e., this function should always
- * return 1.
- *
- * \retval 1 mutex is locked.
- *
- * \retval 0 mutex is not locked. This should never happen.
- */
-static inline int cfs_mutex_is_locked(cfs_mutex_t *lock)
-{
-        return 1;
-}
-#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) */
-#define cfs_mutex_destroy(x)    mutex_destroy(x)
-#define cfs_mutex_is_locked(x)  mutex_is_locked(x)
-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16) */
+#define cfs_mutex_is_locked(x)              mutex_is_locked(x)
+#define cfs_mutex_destroy(x)                mutex_destroy(x)
 
 /*
  * Kernel locking primitives
diff --git a/libcfs/include/libcfs/user-lock.h b/libcfs/include/libcfs/user-lock.h
index 8c70f05..7228d83 100644
--- a/libcfs/include/libcfs/user-lock.h
+++ b/libcfs/include/libcfs/user-lock.h
@@ -92,6 +92,7 @@ typedef struct cfs_spin_lock cfs_spinlock_t;
 #define LASSERT_SPIN_LOCKED(lock) do {(void)sizeof(lock);} while(0)
 #define LINVRNT_SPIN_LOCKED(lock) do {(void)sizeof(lock);} while(0)
 #define LASSERT_SEM_LOCKED(sem) do {(void)sizeof(sem);} while(0)
+#define LASSERT_MUTEX_LOCKED(x) do {(void)sizeof(x);} while(0)
 
 void cfs_spin_lock_init(cfs_spinlock_t *lock);
 void cfs_spin_lock(cfs_spinlock_t *lock);
@@ -118,8 +119,20 @@ typedef struct cfs_semaphore {
 } cfs_semaphore_t;
 
 void cfs_sema_init(cfs_semaphore_t *s, int val);
-void __down(cfs_semaphore_t *s);
 void __up(cfs_semaphore_t *s);
+void __down(cfs_semaphore_t *s);
+int __down_interruptible(cfs_semaphore_t *s);
+
+#define CFS_DEFINE_SEMAPHORE(name)      cfs_semaphore_t name = { 1 }
+
+#define cfs_up(s)                       __up(s)
+#define cfs_down(s)                     __down(s)
+#define cfs_down_interruptible(s)       __down_interruptible(s)
+
+static inline int cfs_down_trylock(cfs_semaphore_t *sem)
+{
+        return 0;
+}
 
 /*
  * Completion:
@@ -275,50 +288,28 @@ void cfs_mt_atomic_sub(int b, cfs_mt_atomic_t *a);
  * Mutex interface.
  *
  **************************************************************************/
-#define CFS_DECLARE_MUTEX(name)     \
-        cfs_semaphore_t name = { 1 }
-
-#define cfs_mutex_up(s)                     __up(s)
-#define cfs_up(s)                           cfs_mutex_up(s)
-#define cfs_mutex_down(s)                   __down(s)
-#define cfs_down(s)                         cfs_mutex_down(s)
-#define cfs_mutex_down_interruptible(s)     __down_interruptible(s)
-#define cfs_down_interruptible(s)           cfs_mutex_down_interruptible(s)
+typedef struct cfs_semaphore cfs_mutex_t;
 
-#define cfs_init_mutex(x)                   cfs_sema_init(x, 1)
-#define cfs_init_mutex_locked(x)            cfs_sema_init(x, 0)
-
-typedef struct cfs_mutex {
-        cfs_semaphore_t m_sem;
-} cfs_mutex_t;
-
-#define CFS_DEFINE_MUTEX(m) cfs_mutex_t m
+#define CFS_DEFINE_MUTEX(m) CFS_DEFINE_SEMAPHORE(m)
 
 static inline void cfs_mutex_init(cfs_mutex_t *mutex)
 {
-        cfs_init_mutex(&mutex->m_sem);
+        cfs_sema_init(mutex, 1);
 }
 
 static inline void cfs_mutex_lock(cfs_mutex_t *mutex)
 {
-        cfs_mutex_down(&mutex->m_sem);
+        cfs_down(mutex);
 }
 
 static inline void cfs_mutex_unlock(cfs_mutex_t *mutex)
 {
-        cfs_mutex_up(&mutex->m_sem);
+        cfs_up(mutex);
 }
 
-/**
- * Try-lock this mutex.
- *
- *
- * \retval 0 try-lock succeeded (lock acquired).
- * \retval errno indicates lock contention.
- */
-static inline int cfs_mutex_down_trylock(cfs_mutex_t *mutex)
+static inline int cfs_mutex_lock_interruptible(cfs_mutex_t *mutex)
 {
-        return 0;
+        return cfs_down_interruptible(mutex);
 }
 
 /**
@@ -332,7 +323,7 @@ static inline int cfs_mutex_down_trylock(cfs_mutex_t *mutex)
  */
 static inline int cfs_mutex_trylock(cfs_mutex_t *mutex)
 {
-        return !cfs_mutex_down_trylock(mutex);
+        return !cfs_down_trylock(mutex);
 }
 
 static inline void cfs_mutex_destroy(cfs_mutex_t *lock)
diff --git a/libcfs/libcfs/module.c b/libcfs/libcfs/module.c
index 8278b4c..d66950f 100644
--- a/libcfs/libcfs/module.c
+++ b/libcfs/libcfs/module.c
@@ -370,7 +370,7 @@ MODULE_LICENSE("GPL");
 
 extern cfs_psdev_t libcfs_dev;
 extern cfs_rw_semaphore_t cfs_tracefile_sem;
-extern cfs_semaphore_t cfs_trace_thread_sem;
+extern cfs_mutex_t cfs_trace_thread_mutex;
 
 extern void libcfs_init_nidstrings(void);
 extern int libcfs_arch_init(void);
@@ -383,7 +383,7 @@ static int init_libcfs_module(void)
         libcfs_arch_init();
         libcfs_init_nidstrings();
         cfs_init_rwsem(&cfs_tracefile_sem);
-        cfs_init_mutex(&cfs_trace_thread_sem);
+        cfs_mutex_init(&cfs_trace_thread_mutex);
         cfs_init_rwsem(&ioctl_list_sem);
         CFS_INIT_LIST_HEAD(&ioctl_list);
         cfs_waitq_init(&cfs_race_waitq);
diff --git a/libcfs/libcfs/tracefile.c b/libcfs/libcfs/tracefile.c
index d681fc3..cb14b0c 100644
--- a/libcfs/libcfs/tracefile.c
+++ b/libcfs/libcfs/tracefile.c
@@ -52,7 +52,7 @@ union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[CFS_NR_CPUS] __cache
 char cfs_tracefile[TRACEFILE_NAME_SIZE];
 long long cfs_tracefile_size = CFS_TRACEFILE_SIZE;
 static struct tracefiled_ctl trace_tctl;
-cfs_semaphore_t cfs_trace_thread_sem;
+cfs_mutex_t cfs_trace_thread_mutex;
 static int thread_running = 0;
 
 cfs_atomic_t cfs_tage_allocated = CFS_ATOMIC_INIT(0);
@@ -1087,7 +1087,7 @@ int cfs_trace_start_thread(void)
         struct tracefiled_ctl *tctl = &trace_tctl;
         int rc = 0;
 
-        cfs_mutex_down(&cfs_trace_thread_sem);
+        cfs_mutex_lock(&cfs_trace_thread_mutex);
         if (thread_running)
                 goto out;
 
@@ -1104,7 +1104,7 @@ int cfs_trace_start_thread(void)
         cfs_wait_for_completion(&tctl->tctl_start);
         thread_running = 1;
 out:
-        cfs_mutex_up(&cfs_trace_thread_sem);
+        cfs_mutex_unlock(&cfs_trace_thread_mutex);
         return rc;
 }
 
@@ -1112,7 +1112,7 @@ void cfs_trace_stop_thread(void)
 {
         struct tracefiled_ctl *tctl = &trace_tctl;
 
-        cfs_mutex_down(&cfs_trace_thread_sem);
+        cfs_mutex_lock(&cfs_trace_thread_mutex);
         if (thread_running) {
                 printk(CFS_KERN_INFO
                        "Lustre: shutting down debug daemon thread...\n");
@@ -1120,7 +1120,7 @@ void cfs_trace_stop_thread(void)
                 cfs_wait_for_completion(&tctl->tctl_stop);
                 thread_running = 0;
         }
-        cfs_mutex_up(&cfs_trace_thread_sem);
+        cfs_mutex_unlock(&cfs_trace_thread_mutex);
 }
 
 int cfs_tracefile_init(int max_pages)
diff --git a/libcfs/libcfs/watchdog.c b/libcfs/libcfs/watchdog.c
index b9f488f..58a3043 100644
--- a/libcfs/libcfs/watchdog.c
+++ b/libcfs/libcfs/watchdog.c
@@ -86,7 +86,7 @@ static unsigned long lcw_flags = 0;
  * When it hits 0, we stop the dispatcher.
  */
 static __u32         lcw_refcount = 0;
-static CFS_DECLARE_MUTEX(lcw_refcount_sem);
+static CFS_DEFINE_MUTEX(lcw_refcount_mutex);
 
 /*
  * List of timers that have fired that need their callbacks run by the
@@ -379,10 +379,10 @@ struct lc_watchdog *lc_watchdog_add(int timeout,
         CFS_INIT_LIST_HEAD(&lcw->lcw_list);
         cfs_timer_init(&lcw->lcw_timer, lcw_cb, lcw);
 
-        cfs_down(&lcw_refcount_sem);
+        cfs_mutex_lock(&lcw_refcount_mutex);
         if (++lcw_refcount == 1)
                 lcw_dispatch_start();
-        cfs_up(&lcw_refcount_sem);
+        cfs_mutex_unlock(&lcw_refcount_mutex);
 
         /* Keep this working in case we enable them by default */
         if (lcw->lcw_state == LC_WATCHDOG_ENABLED) {
@@ -487,10 +487,10 @@ void lc_watchdog_delete(struct lc_watchdog *lcw)
         if (dead)
                 LIBCFS_FREE(lcw, sizeof(*lcw));
 
-        cfs_down(&lcw_refcount_sem);
+        cfs_mutex_lock(&lcw_refcount_mutex);
         if (--lcw_refcount == 0)
                 lcw_dispatch_stop();
-        cfs_up(&lcw_refcount_sem);
+        cfs_mutex_unlock(&lcw_refcount_mutex);
 
         EXIT;
 }
diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h
index 33f780d..271d84b 100644
--- a/lnet/include/lnet/lib-lnet.h
+++ b/lnet/include/lnet/lib-lnet.h
@@ -98,8 +98,8 @@ lnet_match_to_hash(lnet_process_id_t id, __u64 mbits)
 #ifdef __KERNEL__
 #define LNET_LOCK()        cfs_spin_lock(&the_lnet.ln_lock)
 #define LNET_UNLOCK()      cfs_spin_unlock(&the_lnet.ln_lock)
-#define LNET_MUTEX_DOWN(m) cfs_mutex_down(m)
-#define LNET_MUTEX_UP(m)   cfs_mutex_up(m)
+#define LNET_MUTEX_LOCK(m)   cfs_mutex_lock(m)
+#define LNET_MUTEX_UNLOCK(m) cfs_mutex_unlock(m)
 #else
 # ifndef HAVE_LIBPTHREAD
 #define LNET_SINGLE_THREADED_LOCK(l)            \
@@ -116,13 +116,13 @@ do {                                            \
 
 #define LNET_LOCK()        LNET_SINGLE_THREADED_LOCK(the_lnet.ln_lock)
 #define LNET_UNLOCK()      LNET_SINGLE_THREADED_UNLOCK(the_lnet.ln_lock)
-#define LNET_MUTEX_DOWN(m) LNET_SINGLE_THREADED_LOCK(*(m))
-#define LNET_MUTEX_UP(m)   LNET_SINGLE_THREADED_UNLOCK(*(m))
+#define LNET_MUTEX_LOCK(m)     LNET_SINGLE_THREADED_LOCK(*(m))
+#define LNET_MUTEX_UNLOCK(m)   LNET_SINGLE_THREADED_UNLOCK(*(m))
 # else
 #define LNET_LOCK()        pthread_mutex_lock(&the_lnet.ln_lock)
 #define LNET_UNLOCK()      pthread_mutex_unlock(&the_lnet.ln_lock)
-#define LNET_MUTEX_DOWN(m) pthread_mutex_lock(m)
-#define LNET_MUTEX_UP(m)   pthread_mutex_unlock(m)
+#define LNET_MUTEX_LOCK(m)     pthread_mutex_lock(m)
+#define LNET_MUTEX_UNLOCK(m)   pthread_mutex_unlock(m)
 # endif
 #endif
 
diff --git a/lnet/include/lnet/lib-types.h b/lnet/include/lnet/lib-types.h
index 73aa5db..946f669 100644
--- a/lnet/include/lnet/lib-types.h
+++ b/lnet/include/lnet/lib-types.h
@@ -542,8 +542,8 @@ typedef struct
 #ifdef __KERNEL__
         cfs_spinlock_t         ln_lock;
         cfs_waitq_t            ln_waitq;
-        cfs_semaphore_t   ln_api_mutex;
-        cfs_semaphore_t   ln_lnd_mutex;
+        cfs_mutex_t            ln_api_mutex;
+        cfs_mutex_t            ln_lnd_mutex;
 #else
 # ifndef HAVE_LIBPTHREAD
         int                    ln_lock;
@@ -608,12 +608,12 @@ typedef struct
         lnet_ping_info_t      *ln_ping_info;
 
 #ifdef __KERNEL__
-        cfs_semaphore_t   ln_rc_signal;        /* serialise startup/shutdown */
+        cfs_semaphore_t        ln_rc_signal;        /* serialise startup/shutdown */
 #endif
-        int                ln_rc_state;         /* router checker startup/shutdown state */
-        lnet_handle_eq_t   ln_rc_eqh;           /* router checker's event queue */
-        lnet_handle_md_t   ln_rc_mdh;
-        cfs_list_t         ln_zombie_rcd;
+        int                    ln_rc_state;         /* router checker startup/shutdown state */
+        lnet_handle_eq_t       ln_rc_eqh;           /* router checker's event queue */
+        lnet_handle_md_t       ln_rc_mdh;
+        cfs_list_t             ln_zombie_rcd;
 
 #ifdef LNET_USE_LIB_FREELIST
         lnet_freelist_t        ln_free_mes;
diff --git a/lnet/klnds/mxlnd/mxlnd_cb.c b/lnet/klnds/mxlnd/mxlnd_cb.c
index 057a34d..3ce4c6e 100644
--- a/lnet/klnds/mxlnd/mxlnd_cb.c
+++ b/lnet/klnds/mxlnd/mxlnd_cb.c
@@ -2557,7 +2557,7 @@ mxlnd_tx_queued(void *arg)
         cfs_daemonize("mxlnd_tx_queued");
 
         while (!(cfs_atomic_read(&kmxlnd_data.kmx_shutdown))) {
-                ret = down_interruptible(&kmxlnd_data.kmx_tx_queue_sem);
+                ret = cfs_down_interruptible(&kmxlnd_data.kmx_tx_queue_sem);
                 if (cfs_atomic_read(&kmxlnd_data.kmx_shutdown))
                         break;
                 if (ret != 0) // Should we check for -EINTR?
@@ -3972,7 +3972,7 @@ mxlnd_connd(void *arg)
                 cfs_spinlock_t    *g_conn_lock     = &kmxlnd_data.kmx_conn_lock;
                 cfs_list_t        *conn_reqs       = &kmxlnd_data.kmx_conn_reqs;
 
-                ret = down_interruptible(&kmxlnd_data.kmx_conn_sem);
+                ret = cfs_down_interruptible(&kmxlnd_data.kmx_conn_sem);
 
                 if (cfs_atomic_read(&kmxlnd_data.kmx_shutdown))
                         break;
diff --git a/lnet/klnds/ptllnd/ptllnd_ptltrace.c b/lnet/klnds/ptllnd/ptllnd_ptltrace.c
index a94bebb..20fdc96 100644
--- a/lnet/klnds/ptllnd/ptllnd_ptltrace.c
+++ b/lnet/klnds/ptllnd/ptllnd_ptltrace.c
@@ -37,7 +37,7 @@
 #include "ptllnd.h"
 
 #ifdef CRAY_XT3
-static cfs_semaphore_t    ptltrace_mutex;
+static cfs_mutex_t        ptltrace_mutex;
 static cfs_waitq_t        ptltrace_debug_ctlwq;
 
 void
@@ -139,7 +139,7 @@ kptllnd_dump_ptltrace_thread(void *arg)
         libcfs_daemonize("kpt_ptltrace_dump");
 
         /* serialise with other instances of me */
-        cfs_mutex_down(&ptltrace_mutex);
+        cfs_mutex_lock(&ptltrace_mutex);
 
         snprintf(fname, sizeof(fname), "%s.%ld.%ld",
                  *kptllnd_tunables.kptl_ptltrace_basename,
@@ -147,7 +147,7 @@ kptllnd_dump_ptltrace_thread(void *arg)
 
         kptllnd_ptltrace_to_file(fname);
 
-        cfs_mutex_up(&ptltrace_mutex);
+        cfs_mutex_unlock(&ptltrace_mutex);
 
         /* unblock my creator */
         cfs_waitq_signal(&ptltrace_debug_ctlwq);
@@ -185,6 +185,6 @@ void
 kptllnd_init_ptltrace(void)
 {
         cfs_waitq_init(&ptltrace_debug_ctlwq);
-        cfs_init_mutex(&ptltrace_mutex);
+        cfs_mutex_init(&ptltrace_mutex);
 }
 #endif
diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c
index fc25673..c5cb3f4 100644
--- a/lnet/lnet/api-ni.c
+++ b/lnet/lnet/api-ni.c
@@ -93,8 +93,8 @@ lnet_init_locks(void)
 {
         cfs_spin_lock_init (&the_lnet.ln_lock);
         cfs_waitq_init (&the_lnet.ln_waitq);
-        cfs_init_mutex(&the_lnet.ln_lnd_mutex);
-        cfs_init_mutex(&the_lnet.ln_api_mutex);
+        cfs_mutex_init(&the_lnet.ln_lnd_mutex);
+        cfs_mutex_init(&the_lnet.ln_api_mutex);
 }
 
 void
@@ -319,7 +319,7 @@ lnet_find_lnd_by_type (int type)
 void
 lnet_register_lnd (lnd_t *lnd)
 {
-        LNET_MUTEX_DOWN(&the_lnet.ln_lnd_mutex);
+        LNET_MUTEX_LOCK(&the_lnet.ln_lnd_mutex);
 
         LASSERT (the_lnet.ln_init);
         LASSERT (libcfs_isknown_lnd(lnd->lnd_type));
@@ -330,13 +330,13 @@ lnet_register_lnd (lnd_t *lnd)
 
         CDEBUG(D_NET, "%s LND registered\n", libcfs_lnd2str(lnd->lnd_type));
 
-        LNET_MUTEX_UP(&the_lnet.ln_lnd_mutex);
+        LNET_MUTEX_UNLOCK(&the_lnet.ln_lnd_mutex);
 }
 
 void
 lnet_unregister_lnd (lnd_t *lnd)
 {
-        LNET_MUTEX_DOWN(&the_lnet.ln_lnd_mutex);
+        LNET_MUTEX_LOCK(&the_lnet.ln_lnd_mutex);
 
         LASSERT (the_lnet.ln_init);
         LASSERT (lnet_find_lnd_by_type(lnd->lnd_type) == lnd);
@@ -345,7 +345,7 @@ lnet_unregister_lnd (lnd_t *lnd)
         cfs_list_del (&lnd->lnd_list);
         CDEBUG(D_NET, "%s LND unregistered\n", libcfs_lnd2str(lnd->lnd_type));
 
-        LNET_MUTEX_UP(&the_lnet.ln_lnd_mutex);
+        LNET_MUTEX_UNLOCK(&the_lnet.ln_lnd_mutex);
 }
 
 #ifndef LNET_USE_LIB_FREELIST
@@ -1037,19 +1037,19 @@ lnet_startup_lndnis (void)
                         goto failed;
                 }
 
-                LNET_MUTEX_DOWN(&the_lnet.ln_lnd_mutex);
+                LNET_MUTEX_LOCK(&the_lnet.ln_lnd_mutex);
                 lnd = lnet_find_lnd_by_type(lnd_type);
 
 #ifdef __KERNEL__
                 if (lnd == NULL) {
-                        LNET_MUTEX_UP(&the_lnet.ln_lnd_mutex);
+                        LNET_MUTEX_UNLOCK(&the_lnet.ln_lnd_mutex);
                         rc = cfs_request_module("%s",
                                                 libcfs_lnd2modname(lnd_type));
-                        LNET_MUTEX_DOWN(&the_lnet.ln_lnd_mutex);
+                        LNET_MUTEX_LOCK(&the_lnet.ln_lnd_mutex);
 
                         lnd = lnet_find_lnd_by_type(lnd_type);
                         if (lnd == NULL) {
-                                LNET_MUTEX_UP(&the_lnet.ln_lnd_mutex);
+                                LNET_MUTEX_UNLOCK(&the_lnet.ln_lnd_mutex);
                                 CERROR("Can't load LND %s, module %s, rc=%d\n",
                                        libcfs_lnd2str(lnd_type),
                                        libcfs_lnd2modname(lnd_type), rc);
@@ -1063,7 +1063,7 @@ lnet_startup_lndnis (void)
                 }
 #else
                 if (lnd == NULL) {
-                        LNET_MUTEX_UP(&the_lnet.ln_lnd_mutex);
+                        LNET_MUTEX_UNLOCK(&the_lnet.ln_lnd_mutex);
                         CERROR("LND %s not supported\n",
                                libcfs_lnd2str(lnd_type));
                         goto failed;
@@ -1080,7 +1080,7 @@ lnet_startup_lndnis (void)
 
                 rc = (lnd->lnd_startup)(ni);
 
-                LNET_MUTEX_UP(&the_lnet.ln_lnd_mutex);
+                LNET_MUTEX_UNLOCK(&the_lnet.ln_lnd_mutex);
 
                 if (rc != 0) {
                         LCONSOLE_ERROR_MSG(0x105, "Error %d starting up LNI %s"
@@ -1251,7 +1251,7 @@ LNetNIInit(lnet_pid_t requested_pid)
         int         im_a_router = 0;
         int         rc;
 
-        LNET_MUTEX_DOWN(&the_lnet.ln_api_mutex);
+        LNET_MUTEX_LOCK(&the_lnet.ln_api_mutex);
 
         LASSERT (the_lnet.ln_init);
         CDEBUG(D_OTHER, "refs %d\n", the_lnet.ln_refcount);
@@ -1322,7 +1322,7 @@ LNetNIInit(lnet_pid_t requested_pid)
  failed0:
         LASSERT (rc < 0);
  out:
-        LNET_MUTEX_UP(&the_lnet.ln_api_mutex);
+        LNET_MUTEX_UNLOCK(&the_lnet.ln_api_mutex);
         return rc;
 }
 
@@ -1338,7 +1338,7 @@ LNetNIInit(lnet_pid_t requested_pid)
 int
 LNetNIFini()
 {
-        LNET_MUTEX_DOWN(&the_lnet.ln_api_mutex);
+        LNET_MUTEX_LOCK(&the_lnet.ln_api_mutex);
 
         LASSERT (the_lnet.ln_init);
         LASSERT (the_lnet.ln_refcount > 0);
@@ -1361,7 +1361,7 @@ LNetNIFini()
                 lnet_unprepare();
         }
 
-        LNET_MUTEX_UP(&the_lnet.ln_api_mutex);
+        LNET_MUTEX_UNLOCK(&the_lnet.ln_api_mutex);
         return 0;
 }
 
diff --git a/lnet/lnet/module.c b/lnet/lnet/module.c
index 7b7ffa5..4795a99 100644
--- a/lnet/lnet/module.c
+++ b/lnet/lnet/module.c
@@ -44,7 +44,7 @@ static int config_on_load = 0;
 CFS_MODULE_PARM(config_on_load, "i", int, 0444,
                 "configure network at module load");
 
-static cfs_semaphore_t lnet_config_mutex;
+static cfs_mutex_t lnet_config_mutex;
 
 int
 lnet_configure (void *arg)
@@ -52,7 +52,7 @@ lnet_configure (void *arg)
         /* 'arg' only there so I can be passed to cfs_create_thread() */
         int    rc = 0;
 
-        LNET_MUTEX_DOWN(&lnet_config_mutex);
+        LNET_MUTEX_LOCK(&lnet_config_mutex);
 
         if (!the_lnet.ln_niinit_self) {
                 rc = LNetNIInit(LUSTRE_SRV_LNET_PID);
@@ -62,7 +62,7 @@ lnet_configure (void *arg)
                 }
         }
 
-        LNET_MUTEX_UP(&lnet_config_mutex);
+        LNET_MUTEX_UNLOCK(&lnet_config_mutex);
         return rc;
 }
 
@@ -71,18 +71,18 @@ lnet_unconfigure (void)
 {
         int   refcount;
         
-        LNET_MUTEX_DOWN(&lnet_config_mutex);
+        LNET_MUTEX_LOCK(&lnet_config_mutex);
 
         if (the_lnet.ln_niinit_self) {
                 the_lnet.ln_niinit_self = 0;
                 LNetNIFini();
         }
 
-        LNET_MUTEX_DOWN(&the_lnet.ln_api_mutex);
+        LNET_MUTEX_LOCK(&the_lnet.ln_api_mutex);
         refcount = the_lnet.ln_refcount;
-        LNET_MUTEX_UP(&the_lnet.ln_api_mutex);
+        LNET_MUTEX_UNLOCK(&the_lnet.ln_api_mutex);
 
-        LNET_MUTEX_UP(&lnet_config_mutex);
+        LNET_MUTEX_UNLOCK(&lnet_config_mutex);
         return (refcount == 0) ? 0 : -EBUSY;
 }
 
@@ -119,7 +119,7 @@ init_lnet(void)
         int                  rc;
         ENTRY;
 
-        cfs_init_mutex(&lnet_config_mutex);
+        cfs_mutex_init(&lnet_config_mutex);
 
         rc = LNetInit();
         if (rc != 0) {
diff --git a/lnet/lnet/router.c b/lnet/lnet/router.c
index b7d6c85..68757be 100644
--- a/lnet/lnet/router.c
+++ b/lnet/lnet/router.c
@@ -654,7 +654,7 @@ lnet_router_checker_event (lnet_event_t *event)
                 LASSERT (the_lnet.ln_rc_state == LNET_RC_STATE_UNLINKING);
                 the_lnet.ln_rc_state = LNET_RC_STATE_UNLINKED;
 #ifdef __KERNEL__
-                cfs_mutex_up(&the_lnet.ln_rc_signal);
+                cfs_up(&the_lnet.ln_rc_signal);
 #endif
                 return;
         }
@@ -970,7 +970,7 @@ lnet_router_checker_start(void)
                 return 0;
 
 #ifdef __KERNEL__
-        cfs_init_mutex_locked(&the_lnet.ln_rc_signal);
+        cfs_sema_init(&the_lnet.ln_rc_signal, 0);
         /* EQ size doesn't matter; the callback is guaranteed to get every
          * event */
         eqsz = 1;
@@ -1010,7 +1010,7 @@ lnet_router_checker_start(void)
                 rc = LNetMDUnlink(the_lnet.ln_rc_mdh);
                 LASSERT (rc == 0);
                 /* block until event callback signals exit */
-                cfs_mutex_down(&the_lnet.ln_rc_signal);
+                cfs_down(&the_lnet.ln_rc_signal);
                 rc = LNetEQFree(the_lnet.ln_rc_eqh);
                 LASSERT (rc == 0);
                 the_lnet.ln_rc_state = LNET_RC_STATE_SHUTDOWN;
@@ -1041,7 +1041,7 @@ lnet_router_checker_stop (void)
 
 #ifdef __KERNEL__
         /* block until event callback signals exit */
-        cfs_mutex_down(&the_lnet.ln_rc_signal);
+        cfs_down(&the_lnet.ln_rc_signal);
 #else
         while (the_lnet.ln_rc_state != LNET_RC_STATE_UNLINKED) {
                 lnet_router_checker();
diff --git a/lnet/selftest/conctl.c b/lnet/selftest/conctl.c
index 6602961..9ab1242 100644
--- a/lnet/selftest/conctl.c
+++ b/lnet/selftest/conctl.c
@@ -824,7 +824,7 @@ lstcon_ioctl_entry(unsigned int cmd, struct libcfs_ioctl_data *data)
                 return -EFAULT;
         }
 
-        cfs_mutex_down(&console_session.ses_mutex);
+        cfs_mutex_lock(&console_session.ses_mutex);
 
         console_session.ses_laststamp = cfs_time_current_sec();
 
@@ -908,7 +908,7 @@ lstcon_ioctl_entry(unsigned int cmd, struct libcfs_ioctl_data *data)
                              sizeof(lstcon_trans_stat_t)))
                 rc = -EFAULT;
 out:
-        cfs_mutex_up(&console_session.ses_mutex);
+        cfs_mutex_unlock(&console_session.ses_mutex);
 
         LIBCFS_FREE(buf, data->ioc_plen1);
 
diff --git a/lnet/selftest/conrpc.c b/lnet/selftest/conrpc.c
index 94074ae..65901d1 100644
--- a/lnet/selftest/conrpc.c
+++ b/lnet/selftest/conrpc.c
@@ -357,7 +357,7 @@ lstcon_rpc_trans_postwait(lstcon_rpc_trans_t *trans, int timeout)
                 lstcon_rpc_post(crpc);
         }
 
-        cfs_mutex_up(&console_session.ses_mutex);
+        cfs_mutex_unlock(&console_session.ses_mutex);
 
         cfs_waitq_wait_event_interruptible_timeout(trans->tas_waitq,
                                               lstcon_rpc_trans_check(trans),
@@ -365,7 +365,7 @@ lstcon_rpc_trans_postwait(lstcon_rpc_trans_t *trans, int timeout)
 
         rc = (rc > 0)? 0: ((rc < 0)? -EINTR: -ETIMEDOUT);
 
-        cfs_mutex_down(&console_session.ses_mutex);
+        cfs_mutex_lock(&console_session.ses_mutex);
 
         if (console_session.ses_shutdown)
                 rc = -ESHUTDOWN;
@@ -1117,10 +1117,10 @@ lstcon_rpc_pinger(void *arg)
         /* RPC pinger is a special case of transaction,
          * it's called by timer at 8 seconds interval.
          */
-        cfs_mutex_down(&console_session.ses_mutex);
+        cfs_mutex_lock(&console_session.ses_mutex);
 
         if (console_session.ses_shutdown || console_session.ses_expired) {
-                cfs_mutex_up(&console_session.ses_mutex);
+                cfs_mutex_unlock(&console_session.ses_mutex);
                 return;
         }
 
@@ -1205,7 +1205,7 @@ lstcon_rpc_pinger(void *arg)
         }
 
         if (console_session.ses_expired) {
-                cfs_mutex_up(&console_session.ses_mutex);
+                cfs_mutex_unlock(&console_session.ses_mutex);
                 return;
         }
 
@@ -1214,7 +1214,7 @@ lstcon_rpc_pinger(void *arg)
         ptimer->stt_expires = (cfs_time_t)(cfs_time_current_sec() + LST_PING_INTERVAL);
         stt_add_timer(ptimer);
 
-        cfs_mutex_up(&console_session.ses_mutex);
+        cfs_mutex_unlock(&console_session.ses_mutex);
 }
 
 int
@@ -1280,13 +1280,13 @@ lstcon_rpc_cleanup_wait(void)
                         cfs_waitq_signal(&trans->tas_waitq);
                 }
 
-                cfs_mutex_up(&console_session.ses_mutex);
+                cfs_mutex_unlock(&console_session.ses_mutex);
 
                 CWARN("Session is shutting down, "
                       "waiting for termination of transactions\n");
                 cfs_pause(cfs_time_seconds(1));
 
-                cfs_mutex_down(&console_session.ses_mutex);
+                cfs_mutex_lock(&console_session.ses_mutex);
         }
 
         cfs_spin_lock(&console_session.ses_rpc_lock);
diff --git a/lnet/selftest/console.c b/lnet/selftest/console.c
index 4eaf731..fab464b 100644
--- a/lnet/selftest/console.c
+++ b/lnet/selftest/console.c
@@ -1846,7 +1846,7 @@ lstcon_acceptor_handle (srpc_server_rpc_t *rpc)
 
         sfw_unpack_message(req);
 
-        cfs_mutex_down(&console_session.ses_mutex);
+        cfs_mutex_lock(&console_session.ses_mutex);
 
         jrep->join_sid = console_session.ses_id;
 
@@ -1905,7 +1905,7 @@ out:
         if (grp != NULL)
                 lstcon_group_put(grp);
 
-        cfs_mutex_up(&console_session.ses_mutex);
+        cfs_mutex_unlock(&console_session.ses_mutex);
 
         return rc;
 }
@@ -1941,7 +1941,7 @@ lstcon_console_init(void)
         console_session.ses_expired = 0;
         console_session.ses_laststamp = cfs_time_current_sec();   
 
-        cfs_init_mutex(&console_session.ses_mutex);
+        cfs_mutex_init(&console_session.ses_mutex);
 
         CFS_INIT_LIST_HEAD(&console_session.ses_ndl_list);
         CFS_INIT_LIST_HEAD(&console_session.ses_grp_list);
@@ -2000,7 +2000,7 @@ lstcon_console_fini(void)
 
         libcfs_deregister_ioctl(&lstcon_ioctl_handler);
 
-        cfs_mutex_down(&console_session.ses_mutex);
+        cfs_mutex_lock(&console_session.ses_mutex);
 
         srpc_shutdown_service(&lstcon_acceptor_service);
         srpc_remove_service(&lstcon_acceptor_service);
@@ -2010,7 +2010,7 @@ lstcon_console_fini(void)
 
         lstcon_rpc_module_fini();
 
-        cfs_mutex_up(&console_session.ses_mutex);
+        cfs_mutex_unlock(&console_session.ses_mutex);
 
         LASSERT (cfs_list_empty(&console_session.ses_ndl_list));
         LASSERT (cfs_list_empty(&console_session.ses_grp_list));
diff --git a/lnet/selftest/console.h b/lnet/selftest/console.h
index 48a4061..676f5d9 100644
--- a/lnet/selftest/console.h
+++ b/lnet/selftest/console.h
@@ -134,7 +134,7 @@ typedef struct lstcon_test {
 #define LST_CONSOLE_TIMEOUT     300             /* default console timeout */
 
 typedef struct {
-        cfs_semaphore_t         ses_mutex;      /* lock for session, only one thread can enter session */
+        cfs_mutex_t             ses_mutex;      /* lock for session, only one thread can enter session */
         lst_sid_t               ses_id;         /* global session id */
         int                     ses_key;        /* local session key */
         int                     ses_state;      /* state of session */
diff --git a/lustre/fid/fid_handler.c b/lustre/fid/fid_handler.c
index a762edb..b523ebc 100644
--- a/lustre/fid/fid_handler.c
+++ b/lustre/fid/fid_handler.c
@@ -75,7 +75,7 @@ int seq_server_set_cli(struct lu_server_seq *seq,
          * Ask client for new range, assign that range to ->seq_space and write
          * seq state to backing store should be atomic.
          */
-        cfs_down(&seq->lss_sem);
+        cfs_mutex_lock(&seq->lss_mutex);
 
         if (cli == NULL) {
                 CDEBUG(D_INFO, "%s: Detached sequence client %s\n",
@@ -97,7 +97,7 @@ int seq_server_set_cli(struct lu_server_seq *seq,
         cli->lcs_space.lsr_index = seq->lss_site->ms_node_id;
         EXIT;
 out_up:
-        cfs_up(&seq->lss_sem);
+        cfs_mutex_unlock(&seq->lss_mutex);
         return rc;
 }
 EXPORT_SYMBOL(seq_server_set_cli);
@@ -154,9 +154,9 @@ int seq_server_alloc_super(struct lu_server_seq *seq,
         int rc;
         ENTRY;
 
-        cfs_down(&seq->lss_sem);
+        cfs_mutex_lock(&seq->lss_mutex);
         rc = __seq_server_alloc_super(seq, out, env);
-        cfs_up(&seq->lss_sem);
+        cfs_mutex_unlock(&seq->lss_mutex);
 
         RETURN(rc);
 }
@@ -281,9 +281,9 @@ int seq_server_alloc_meta(struct lu_server_seq *seq,
         int rc;
         ENTRY;
 
-        cfs_down(&seq->lss_sem);
+        cfs_mutex_lock(&seq->lss_mutex);
         rc = __seq_server_alloc_meta(seq, out, env);
-        cfs_up(&seq->lss_sem);
+        cfs_mutex_unlock(&seq->lss_mutex);
 
         RETURN(rc);
 }
@@ -488,7 +488,7 @@ int seq_server_init(struct lu_server_seq *seq,
         range_init(&seq->lss_hiwater_set);
         seq->lss_set_width = LUSTRE_SEQ_BATCH_WIDTH;
 
-        cfs_sema_init(&seq->lss_sem, 1);
+        cfs_mutex_init(&seq->lss_mutex);
 
         seq->lss_width = is_srv ?
                 LUSTRE_SEQ_META_WIDTH : LUSTRE_SEQ_SUPER_WIDTH;
diff --git a/lustre/fid/fid_request.c b/lustre/fid/fid_request.c
index 214f542..627a324 100644
--- a/lustre/fid/fid_request.c
+++ b/lustre/fid/fid_request.c
@@ -149,7 +149,7 @@ int seq_client_alloc_super(struct lu_client_seq *seq,
         int rc;
         ENTRY;
 
-        cfs_down(&seq->lcs_sem);
+        cfs_mutex_lock(&seq->lcs_mutex);
 
 #ifdef __KERNEL__
         if (seq->lcs_srv) {
@@ -163,7 +163,7 @@ int seq_client_alloc_super(struct lu_client_seq *seq,
 #ifdef __KERNEL__
         }
 #endif
-        cfs_up(&seq->lcs_sem);
+        cfs_mutex_unlock(&seq->lcs_mutex);
         RETURN(rc);
 }
 
@@ -226,24 +226,24 @@ static int seq_fid_alloc_prep(struct lu_client_seq *seq,
         if (seq->lcs_update) {
                 cfs_waitq_add(&seq->lcs_waitq, link);
                 cfs_set_current_state(CFS_TASK_UNINT);
-                cfs_up(&seq->lcs_sem);
+                cfs_mutex_unlock(&seq->lcs_mutex);
 
                 cfs_waitq_wait(link, CFS_TASK_UNINT);
 
-                cfs_down(&seq->lcs_sem);
+                cfs_mutex_lock(&seq->lcs_mutex);
                 cfs_waitq_del(&seq->lcs_waitq, link);
                 cfs_set_current_state(CFS_TASK_RUNNING);
                 return -EAGAIN;
         }
         ++seq->lcs_update;
-        cfs_up(&seq->lcs_sem);
+        cfs_mutex_unlock(&seq->lcs_mutex);
         return 0;
 }
 
 static void seq_fid_alloc_fini(struct lu_client_seq *seq)
 {
         LASSERT(seq->lcs_update == 1);
-        cfs_down(&seq->lcs_sem);
+        cfs_mutex_lock(&seq->lcs_mutex);
         --seq->lcs_update;
         cfs_waitq_signal(&seq->lcs_waitq);
 }
@@ -259,7 +259,7 @@ int seq_client_alloc_fid(struct lu_client_seq *seq, struct lu_fid *fid)
         LASSERT(fid != NULL);
 
         cfs_waitlink_init(&link);
-        cfs_down(&seq->lcs_sem);
+        cfs_mutex_lock(&seq->lcs_mutex);
 
         while (1) {
                 seqno_t seqnr;
@@ -281,7 +281,7 @@ int seq_client_alloc_fid(struct lu_client_seq *seq, struct lu_fid *fid)
                         CERROR("%s: Can't allocate new sequence, "
                                "rc %d\n", seq->lcs_name, rc);
                         seq_fid_alloc_fini(seq);
-                        cfs_up(&seq->lcs_sem);
+                        cfs_mutex_unlock(&seq->lcs_mutex);
                         RETURN(rc);
                 }
 
@@ -303,7 +303,7 @@ int seq_client_alloc_fid(struct lu_client_seq *seq, struct lu_fid *fid)
         }
 
         *fid = seq->lcs_fid;
-        cfs_up(&seq->lcs_sem);
+        cfs_mutex_unlock(&seq->lcs_mutex);
 
         CDEBUG(D_INFO, "%s: Allocated FID "DFID"\n", seq->lcs_name,  PFID(fid));
         RETURN(rc);
@@ -320,16 +320,16 @@ void seq_client_flush(struct lu_client_seq *seq)
 
         LASSERT(seq != NULL);
         cfs_waitlink_init(&link);
-        cfs_down(&seq->lcs_sem);
+        cfs_mutex_lock(&seq->lcs_mutex);
 
         while (seq->lcs_update) {
                 cfs_waitq_add(&seq->lcs_waitq, &link);
                 cfs_set_current_state(CFS_TASK_UNINT);
-                cfs_up(&seq->lcs_sem);
+                cfs_mutex_unlock(&seq->lcs_mutex);
 
                 cfs_waitq_wait(&link, CFS_TASK_UNINT);
 
-                cfs_down(&seq->lcs_sem);
+                cfs_mutex_lock(&seq->lcs_mutex);
                 cfs_waitq_del(&seq->lcs_waitq, &link);
                 cfs_set_current_state(CFS_TASK_RUNNING);
         }
@@ -343,7 +343,7 @@ void seq_client_flush(struct lu_client_seq *seq)
         seq->lcs_space.lsr_index = -1;
 
         range_init(&seq->lcs_space);
-        cfs_up(&seq->lcs_sem);
+        cfs_mutex_unlock(&seq->lcs_mutex);
 }
 EXPORT_SYMBOL(seq_client_flush);
 
@@ -418,7 +418,7 @@ int seq_client_init(struct lu_client_seq *seq,
         seq->lcs_exp = exp;
         seq->lcs_srv = srv;
         seq->lcs_type = type;
-        cfs_sema_init(&seq->lcs_sem, 1);
+        cfs_mutex_init(&seq->lcs_mutex);
         seq->lcs_width = LUSTRE_SEQ_MAX_WIDTH;
         cfs_waitq_init(&seq->lcs_waitq);
 
diff --git a/lustre/fid/lproc_fid.c b/lustre/fid/lproc_fid.c
index 633607d..a8aa570 100644
--- a/lustre/fid/lproc_fid.c
+++ b/lustre/fid/lproc_fid.c
@@ -112,7 +112,7 @@ seq_server_proc_write_space(struct file *file, const char *buffer,
 
         LASSERT(seq != NULL);
 
-        cfs_down(&seq->lss_sem);
+        cfs_mutex_lock(&seq->lss_mutex);
 	rc = seq_proc_write_common(file, buffer, count,
                                    data, &seq->lss_space);
 	if (rc == 0) {
@@ -120,7 +120,7 @@ seq_server_proc_write_space(struct file *file, const char *buffer,
                        seq->lss_name, PRANGE(&seq->lss_space));
 	}
 
-        cfs_up(&seq->lss_sem);
+        cfs_mutex_unlock(&seq->lss_mutex);
 
         RETURN(count);
 }
@@ -135,10 +135,10 @@ seq_server_proc_read_space(char *page, char **start, off_t off,
 
         LASSERT(seq != NULL);
 
-        cfs_down(&seq->lss_sem);
+        cfs_mutex_lock(&seq->lss_mutex);
 	rc = seq_proc_read_common(page, start, off, count, eof,
                                   data, &seq->lss_space);
-        cfs_up(&seq->lss_sem);
+        cfs_mutex_unlock(&seq->lss_mutex);
 
 	RETURN(rc);
 }
@@ -181,7 +181,7 @@ seq_server_proc_write_width(struct file *file, const char *buffer,
 
         LASSERT(seq != NULL);
 
-        cfs_down(&seq->lss_sem);
+        cfs_mutex_lock(&seq->lss_mutex);
 
         rc = lprocfs_write_helper(buffer, count, &val);
         if (rc)
@@ -194,7 +194,7 @@ seq_server_proc_write_width(struct file *file, const char *buffer,
                        seq->lss_name, seq->lss_width);
 	}
 
-        cfs_up(&seq->lss_sem);
+        cfs_mutex_unlock(&seq->lss_mutex);
 
         RETURN(count);
 }
@@ -209,9 +209,9 @@ seq_server_proc_read_width(char *page, char **start, off_t off,
 
         LASSERT(seq != NULL);
 
-        cfs_down(&seq->lss_sem);
+        cfs_mutex_lock(&seq->lss_mutex);
         rc = snprintf(page, count, LPU64"\n", seq->lss_width);
-        cfs_up(&seq->lss_sem);
+        cfs_mutex_unlock(&seq->lss_mutex);
 
 	RETURN(rc);
 }
@@ -227,7 +227,7 @@ seq_client_proc_write_space(struct file *file, const char *buffer,
 
         LASSERT(seq != NULL);
 
-        cfs_down(&seq->lcs_sem);
+        cfs_mutex_lock(&seq->lcs_mutex);
 	rc = seq_proc_write_common(file, buffer, count,
                                    data, &seq->lcs_space);
 
@@ -236,7 +236,7 @@ seq_client_proc_write_space(struct file *file, const char *buffer,
                        seq->lcs_name, PRANGE(&seq->lcs_space));
 	}
 
-        cfs_up(&seq->lcs_sem);
+        cfs_mutex_unlock(&seq->lcs_mutex);
 
         RETURN(count);
 }
@@ -251,10 +251,10 @@ seq_client_proc_read_space(char *page, char **start, off_t off,
 
         LASSERT(seq != NULL);
 
-        cfs_down(&seq->lcs_sem);
+        cfs_mutex_lock(&seq->lcs_mutex);
 	rc = seq_proc_read_common(page, start, off, count, eof,
                                   data, &seq->lcs_space);
-        cfs_up(&seq->lcs_sem);
+        cfs_mutex_unlock(&seq->lcs_mutex);
 
 	RETURN(rc);
 }
@@ -269,11 +269,11 @@ seq_client_proc_write_width(struct file *file, const char *buffer,
 
         LASSERT(seq != NULL);
 
-        cfs_down(&seq->lcs_sem);
+        cfs_mutex_lock(&seq->lcs_mutex);
 
         rc = lprocfs_write_helper(buffer, count, &val);
         if (rc) {
-                cfs_up(&seq->lcs_sem);
+                cfs_mutex_unlock(&seq->lcs_mutex);
                 RETURN(rc);
         }
 
@@ -286,7 +286,7 @@ seq_client_proc_write_width(struct file *file, const char *buffer,
                 }
         }
 
-        cfs_up(&seq->lcs_sem);
+        cfs_mutex_unlock(&seq->lcs_mutex);
 
         RETURN(count);
 }
@@ -301,9 +301,9 @@ seq_client_proc_read_width(char *page, char **start, off_t off,
 
         LASSERT(seq != NULL);
 
-        cfs_down(&seq->lcs_sem);
+        cfs_mutex_lock(&seq->lcs_mutex);
         rc = snprintf(page, count, LPU64"\n", seq->lcs_width);
-        cfs_up(&seq->lcs_sem);
+        cfs_mutex_unlock(&seq->lcs_mutex);
 
 	RETURN(rc);
 }
@@ -318,9 +318,9 @@ seq_client_proc_read_fid(char *page, char **start, off_t off,
 
         LASSERT(seq != NULL);
 
-        cfs_down(&seq->lcs_sem);
+        cfs_mutex_lock(&seq->lcs_mutex);
         rc = snprintf(page, count, DFID"\n", PFID(&seq->lcs_fid));
-        cfs_up(&seq->lcs_sem);
+        cfs_mutex_unlock(&seq->lcs_mutex);
 
 	RETURN(rc);
 }
diff --git a/lustre/include/linux/lustre_fsfilt.h b/lustre/include/linux/lustre_fsfilt.h
index b62f219..77fe69a 100644
--- a/lustre/include/linux/lustre_fsfilt.h
+++ b/lustre/include/linux/lustre_fsfilt.h
@@ -110,7 +110,7 @@ struct fsfilt_operations {
         int     (* fs_map_inode_pages)(struct inode *inode, struct page **page,
                                        int pages, unsigned long *blocks,
                                        int *created, int create,
-                                       cfs_semaphore_t *sem);
+                                       cfs_mutex_t *sem);
         int     (* fs_write_record)(struct file *, void *, int size, loff_t *,
                                     int force_sync);
         int     (* fs_read_record)(struct file *, void *, int size, loff_t *);
@@ -472,10 +472,10 @@ static inline int fsfilt_map_inode_pages(struct obd_device *obd,
                                          struct inode *inode,
                                          struct page **page, int pages,
                                          unsigned long *blocks, int *created,
-                                         int create, cfs_semaphore_t *sem)
+                                         int create, cfs_mutex_t *mutex)
 {
         return obd->obd_fsops->fs_map_inode_pages(inode, page, pages, blocks,
-                                                  created, create, sem);
+                                                  created, create, mutex);
 }
 
 static inline int fsfilt_read_record(struct obd_device *obd, struct file *file,
diff --git a/lustre/include/lustre_dlm.h b/lustre/include/lustre_dlm.h
index 91c715c..be7a3dd 100644
--- a/lustre/include/lustre_dlm.h
+++ b/lustre/include/lustre_dlm.h
@@ -270,7 +270,7 @@ static inline int lockmode_compat(ldlm_mode_t exist_mode, ldlm_mode_t new_mode)
  * lr_lock
  *     ns_lock
  *
- * lr_lvb_sem
+ * lr_lvb_mutex
  *     lr_lock
  *
  */
@@ -816,7 +816,7 @@ struct ldlm_resource {
 
         /* Server-side-only lock value block elements */
         /** to serialize lvbo_init */
-        cfs_semaphore_t        lr_lvb_sem;
+        cfs_mutex_t            lr_lvb_mutex;
         __u32                  lr_lvb_len;
         /** protect by lr_lock */
         void                  *lr_lvb_data;
diff --git a/lustre/include/lustre_export.h b/lustre/include/lustre_export.h
index 2e0d95e..db97a7c 100644
--- a/lustre/include/lustre_export.h
+++ b/lustre/include/lustre_export.h
@@ -60,7 +60,7 @@ struct mdt_idmap_table;
  */
 struct tg_export_data {
         /** Protects led_lcd below */
-        cfs_semaphore_t         ted_lcd_lock;
+        cfs_mutex_t             ted_lcd_lock;
         /** Per-client data for each export */
         struct lsd_client_data *ted_lcd;
         /** Offset of record in last_rcvd file */
@@ -79,7 +79,7 @@ struct mdt_export_data {
         cfs_spinlock_t          med_open_lock; /* lock med_open_head, mfd_list*/
         /** Bitmask of all ibit locks this MDT understands */
         __u64                   med_ibits_known;
-        cfs_semaphore_t         med_idmap_sem;
+        cfs_mutex_t             med_idmap_mutex;
         struct lustre_idmap_table *med_idmap;
 };
 
diff --git a/lustre/include/lustre_fid.h b/lustre/include/lustre_fid.h
index adb2671..d07ed92 100644
--- a/lustre/include/lustre_fid.h
+++ b/lustre/include/lustre_fid.h
@@ -132,7 +132,7 @@ struct lu_server_seq;
 struct lu_client_seq {
         /* Sequence-controller export. */
         struct obd_export      *lcs_exp;
-        cfs_semaphore_t         lcs_sem;
+        cfs_mutex_t             lcs_mutex;
 
         /*
          * Range of allowed for allocation sequeces. When using lu_client_seq on
@@ -197,8 +197,8 @@ struct lu_server_seq {
         /* Client interafce to request controller */
         struct lu_client_seq   *lss_cli;
 
-        /* Semaphore for protecting allocation */
-        cfs_semaphore_t         lss_sem;
+        /* Mutex for protecting allocation */
+        cfs_mutex_t             lss_mutex;
 
         /*
          * Service uuid, passed from MDT + seq name to form unique seq name to
diff --git a/lustre/include/lustre_import.h b/lustre/include/lustre_import.h
index 17c36dd..2760433 100644
--- a/lustre/include/lustre_import.h
+++ b/lustre/include/lustre_import.h
@@ -188,7 +188,7 @@ struct obd_import {
          * @{
          */
         struct ptlrpc_sec        *imp_sec;
-        cfs_semaphore_t           imp_sec_mutex;
+        cfs_mutex_t               imp_sec_mutex;
         cfs_time_t                imp_sec_expire;
         /** @} */
 
diff --git a/lustre/include/lustre_lite.h b/lustre/include/lustre_lite.h
index 7fa9937..7d9c3d0 100644
--- a/lustre/include/lustre_lite.h
+++ b/lustre/include/lustre_lite.h
@@ -130,7 +130,7 @@ struct lustre_client_ocd {
          * under ->lco_lock.
          */
         __u64              lco_flags;
-        cfs_semaphore_t    lco_lock;
+        cfs_mutex_t        lco_lock;
         struct obd_export *lco_md_exp;
         struct obd_export *lco_dt_exp;
 };
diff --git a/lustre/include/lustre_log.h b/lustre/include/lustre_log.h
index 54f3f04..f8ee5b9 100644
--- a/lustre/include/lustre_log.h
+++ b/lustre/include/lustre_log.h
@@ -287,7 +287,7 @@ struct llog_ctxt {
         struct llog_handle      *loc_handle;
         struct llog_commit_master *loc_lcm;
         struct llog_canceld_ctxt *loc_llcd;
-        cfs_semaphore_t          loc_sem; /* protects loc_llcd and loc_imp */
+        cfs_mutex_t              loc_mutex; /* protects loc_llcd and loc_imp */
         cfs_atomic_t             loc_refcount;
         void                    *llog_proc_cb;
         long                     loc_flags; /* flags, see above defines */
@@ -455,7 +455,7 @@ static inline void llog_group_init(struct obd_llog_group *olg, int group)
 {
         cfs_waitq_init(&olg->olg_waitq);
         cfs_spin_lock_init(&olg->olg_lock);
-        cfs_sema_init(&olg->olg_cat_processing, 1);
+        cfs_mutex_init(&olg->olg_cat_processing);
         olg->olg_seq = group;
 }
 
diff --git a/lustre/include/lustre_mdc.h b/lustre/include/lustre_mdc.h
index e8883b4..a67756f 100644
--- a/lustre/include/lustre_mdc.h
+++ b/lustre/include/lustre_mdc.h
@@ -74,13 +74,13 @@ struct ptlrpc_request;
 struct obd_device;
 
 struct mdc_rpc_lock {
-        cfs_semaphore_t  rpcl_sem;
+        cfs_mutex_t           rpcl_mutex;
         struct lookup_intent *rpcl_it;
 };
 
 static inline void mdc_init_rpc_lock(struct mdc_rpc_lock *lck)
 {
-        cfs_sema_init(&lck->rpcl_sem, 1);
+        cfs_mutex_init(&lck->rpcl_mutex);
         lck->rpcl_it = NULL;
 }
 
@@ -89,7 +89,7 @@ static inline void mdc_get_rpc_lock(struct mdc_rpc_lock *lck,
 {
         ENTRY;
         if (!it || (it->it_op != IT_GETATTR && it->it_op != IT_LOOKUP)) {
-                cfs_down(&lck->rpcl_sem);
+                cfs_mutex_lock(&lck->rpcl_mutex);
                 LASSERT(lck->rpcl_it == NULL);
                 lck->rpcl_it = it;
         }
@@ -101,7 +101,7 @@ static inline void mdc_put_rpc_lock(struct mdc_rpc_lock *lck,
         if (!it || (it->it_op != IT_GETATTR && it->it_op != IT_LOOKUP)) {
                 LASSERT(it == lck->rpcl_it);
                 lck->rpcl_it = NULL;
-                cfs_up(&lck->rpcl_sem);
+                cfs_mutex_unlock(&lck->rpcl_mutex);
         }
         EXIT;
 }
diff --git a/lustre/include/lustre_quota.h b/lustre/include/lustre_quota.h
index c1941d7..1bef929 100644
--- a/lustre/include/lustre_quota.h
+++ b/lustre/include/lustre_quota.h
@@ -177,7 +177,7 @@ struct lustre_dquot {
         /** Hash list in memory, protect by dquot_hash_lock */
         cfs_list_t dq_hash;
         /** Protect the data in lustre_dquot */
-        cfs_semaphore_t dq_sem;
+        cfs_mutex_t dq_mutex;
         /** Use count */
         cfs_atomic_t dq_refcnt;
         /** Pointer of quota info it belongs to */
diff --git a/lustre/include/obd.h b/lustre/include/obd.h
index f32d5ca..8e3eb1d 100644
--- a/lustre/include/obd.h
+++ b/lustre/include/obd.h
@@ -289,13 +289,13 @@ struct filter_obd {
         cfs_dentry_t        *fo_dentry_O;
         cfs_dentry_t       **fo_dentry_O_groups;
         struct filter_subdirs   *fo_dentry_O_sub;
-        cfs_semaphore_t      fo_init_lock;      /* group initialization lock */
+        cfs_mutex_t          fo_init_lock;      /* group initialization lock */
         int                  fo_committed_group;
 
         cfs_spinlock_t       fo_objidlock;      /* protect fo_lastobjid */
 
         unsigned long        fo_destroys_in_progress;
-        cfs_semaphore_t      fo_create_locks[FILTER_SUBDIR_COUNT];
+        cfs_mutex_t          fo_create_locks[FILTER_SUBDIR_COUNT];
 
         cfs_list_t fo_export_list;
         int                  fo_subdir_count;
@@ -319,7 +319,7 @@ struct filter_obd {
         __u64               *fo_last_objids; /* last created objid for groups,
                                               * protected by fo_objidlock */
 
-        cfs_semaphore_t      fo_alloc_lock;
+        cfs_mutex_t          fo_alloc_lock;
 
         cfs_atomic_t         fo_r_in_flight;
         cfs_atomic_t         fo_w_in_flight;
@@ -420,7 +420,6 @@ struct client_obd {
         cfs_list_t               cl_cache_waiters; /* waiting for cache/grant */
         cfs_time_t               cl_next_shrink_grant;   /* jiffies */
         cfs_list_t               cl_grant_shrink_list;  /* Timeout event list */
-        cfs_semaphore_t          cl_grant_sem;   /*grant shrink list cfs_semaphore*/
         int                      cl_grant_shrink_interval; /* seconds */
 
         /* keep track of objects that have lois that contain pages which
@@ -505,7 +504,7 @@ struct mgs_obd {
         struct super_block              *mgs_sb;
         struct dentry                   *mgs_configs_dir;
         cfs_list_t                       mgs_fs_db_list;
-        cfs_semaphore_t                  mgs_sem;
+        cfs_mutex_t                      mgs_mutex;
         cfs_proc_dir_entry_t            *mgs_proc_live;
         cfs_time_t                       mgs_start_time;
 };
@@ -520,7 +519,6 @@ struct mds_obd {
         int                              mds_max_cookiesize;
         __u64                            mds_io_epoch;
         unsigned long                    mds_atime_diff;
-        cfs_semaphore_t                  mds_epoch_sem;
         struct ll_fid                    mds_rootfid;
         cfs_dentry_t                    *mds_pending_dir;
         cfs_dentry_t                    *mds_logs_dir;
@@ -547,7 +545,6 @@ struct mds_obd {
 
         struct lustre_quota_info         mds_quota_info;
         cfs_rw_semaphore_t               mds_qonoff_sem;
-        cfs_semaphore_t                  mds_health_sem;
         unsigned long                    mds_fl_user_xattr:1,
                                          mds_fl_acl:1,
                                          mds_evict_ost_nids:1,
@@ -595,7 +592,7 @@ struct ost_obd {
         struct ptlrpc_service *ost_service;
         struct ptlrpc_service *ost_create_service;
         struct ptlrpc_service *ost_io_service;
-        cfs_semaphore_t        ost_health_sem;
+        cfs_mutex_t            ost_health_mutex;
 };
 
 struct echo_client_obd {
@@ -708,7 +705,7 @@ struct lov_obd {
         struct lov_tgt_desc   **lov_tgts;              /* sparse array */
         struct ost_pool         lov_packed;            /* all OSTs in a packed
                                                           array */
-        cfs_semaphore_t         lov_lock;
+        cfs_mutex_t             lov_lock;
         struct obd_connect_data lov_ocd;
         struct lov_qos          lov_qos;               /* qos info per lov */
         cfs_atomic_t            lov_refcount;
@@ -729,7 +726,7 @@ struct lmv_tgt_desc {
         struct obd_export      *ltd_exp;
         int                     ltd_active; /* is this target up for requests */
         int                     ltd_idx;
-        cfs_semaphore_t         ltd_fid_sem;
+        cfs_mutex_t             ltd_fid_mutex;
 };
 
 enum placement_policy {
@@ -755,7 +752,7 @@ struct lmv_obd {
         int                     max_def_easize;
         int                     max_cookiesize;
         int                     server_timeout;
-        cfs_semaphore_t         init_sem;
+        cfs_mutex_t             init_mutex;
 
         struct lmv_tgt_desc     *tgts;
         int                     tgts_size;
@@ -981,7 +978,7 @@ struct obd_llog_group {
         cfs_spinlock_t     olg_lock;
         struct obd_export *olg_exp;
         int                olg_initializing;
-        cfs_semaphore_t    olg_cat_processing;
+        cfs_mutex_t        olg_cat_processing;
 };
 
 /* corresponds to one of the obd's */
@@ -1040,7 +1037,7 @@ struct obd_device {
         struct ptlrpc_client    obd_ldlm_client; /* XXX OST/MDS only */
         /* a spinlock is OK for what we do now, may need a semaphore later */
         cfs_spinlock_t          obd_dev_lock; /* protects obd bitfield above */
-        cfs_semaphore_t         obd_dev_sem;
+        cfs_mutex_t             obd_dev_mutex;
         __u64                   obd_last_committed;
         struct fsfilt_operations *obd_fsops;
         cfs_spinlock_t          obd_osfs_lock;
diff --git a/lustre/lclient/lcommon_misc.c b/lustre/lclient/lcommon_misc.c
index 33847b3..16c301d 100644
--- a/lustre/lclient/lcommon_misc.c
+++ b/lustre/lclient/lcommon_misc.c
@@ -105,13 +105,13 @@ int cl_ocd_update(struct obd_device *host,
                 flags = cli->cl_import->imp_connect_data.ocd_connect_flags;
                 CDEBUG(D_SUPER, "Changing connect_flags: "LPX64" -> "LPX64"\n",
                        lco->lco_flags, flags);
-                cfs_mutex_down(&lco->lco_lock);
+                cfs_mutex_lock(&lco->lco_lock);
                 lco->lco_flags &= flags;
                 /* for each osc event update ea size */
                 if (lco->lco_dt_exp)
                         cl_init_ea_size(lco->lco_md_exp, lco->lco_dt_exp);
 
-                cfs_mutex_up(&lco->lco_lock);
+                cfs_mutex_unlock(&lco->lco_lock);
                 result = 0;
         } else {
                 CERROR("unexpected notification from %s %s!\n",
diff --git a/lustre/ldlm/ldlm_internal.h b/lustre/ldlm/ldlm_internal.h
index 12ff5ce..5d3bd37 100644
--- a/lustre/ldlm/ldlm_internal.h
+++ b/lustre/ldlm/ldlm_internal.h
@@ -41,9 +41,9 @@
 
 extern cfs_atomic_t ldlm_srv_namespace_nr;
 extern cfs_atomic_t ldlm_cli_namespace_nr;
-extern cfs_semaphore_t ldlm_srv_namespace_lock;
+extern cfs_mutex_t ldlm_srv_namespace_lock;
 extern cfs_list_t ldlm_srv_namespace_list;
-extern cfs_semaphore_t ldlm_cli_namespace_lock;
+extern cfs_mutex_t ldlm_cli_namespace_lock;
 extern cfs_list_t ldlm_cli_namespace_list;
 
 static inline int ldlm_res_eq(const struct ldlm_res_id *res0,
@@ -64,7 +64,7 @@ static inline cfs_list_t *ldlm_namespace_list(ldlm_side_t client)
                 &ldlm_srv_namespace_list : &ldlm_cli_namespace_list;
 }
 
-static inline cfs_semaphore_t *ldlm_namespace_lock(ldlm_side_t client)
+static inline cfs_mutex_t *ldlm_namespace_lock(ldlm_side_t client)
 {
         return client == LDLM_NAMESPACE_SERVER ?
                 &ldlm_srv_namespace_lock : &ldlm_cli_namespace_lock;
diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c
index 1b80090..5ddd751 100644
--- a/lustre/ldlm/ldlm_lockd.c
+++ b/lustre/ldlm/ldlm_lockd.c
@@ -66,7 +66,7 @@ CFS_MODULE_PARM(ldlm_num_threads, "i", int, 0444,
 
 extern cfs_mem_cache_t *ldlm_resource_slab;
 extern cfs_mem_cache_t *ldlm_lock_slab;
-static cfs_semaphore_t  ldlm_ref_sem;
+static cfs_mutex_t      ldlm_ref_mutex;
 static int ldlm_refcount;
 
 struct ldlm_cb_async_args {
@@ -2300,13 +2300,13 @@ int ldlm_get_ref(void)
 {
         int rc = 0;
         ENTRY;
-        cfs_mutex_down(&ldlm_ref_sem);
+        cfs_mutex_lock(&ldlm_ref_mutex);
         if (++ldlm_refcount == 1) {
                 rc = ldlm_setup();
                 if (rc)
                         ldlm_refcount--;
         }
-        cfs_mutex_up(&ldlm_ref_sem);
+        cfs_mutex_unlock(&ldlm_ref_mutex);
 
         RETURN(rc);
 }
@@ -2314,7 +2314,7 @@ int ldlm_get_ref(void)
 void ldlm_put_ref(void)
 {
         ENTRY;
-        cfs_mutex_down(&ldlm_ref_sem);
+        cfs_mutex_lock(&ldlm_ref_mutex);
         if (ldlm_refcount == 1) {
                 int rc = ldlm_cleanup();
                 if (rc)
@@ -2324,7 +2324,7 @@ void ldlm_put_ref(void)
         } else {
                 ldlm_refcount--;
         }
-        cfs_mutex_up(&ldlm_ref_sem);
+        cfs_mutex_unlock(&ldlm_ref_mutex);
 
         EXIT;
 }
@@ -2618,9 +2618,9 @@ static int ldlm_cleanup(void)
 
 int __init ldlm_init(void)
 {
-        cfs_init_mutex(&ldlm_ref_sem);
-        cfs_init_mutex(ldlm_namespace_lock(LDLM_NAMESPACE_SERVER));
-        cfs_init_mutex(ldlm_namespace_lock(LDLM_NAMESPACE_CLIENT));
+        cfs_mutex_init(&ldlm_ref_mutex);
+        cfs_mutex_init(ldlm_namespace_lock(LDLM_NAMESPACE_SERVER));
+        cfs_mutex_init(ldlm_namespace_lock(LDLM_NAMESPACE_CLIENT));
         ldlm_resource_slab = cfs_mem_cache_create("ldlm_resources",
                                                sizeof(struct ldlm_resource), 0,
                                                CFS_SLAB_HWCACHE_ALIGN);
diff --git a/lustre/ldlm/ldlm_pool.c b/lustre/ldlm/ldlm_pool.c
index 4f5b42d..3fa9678 100644
--- a/lustre/ldlm/ldlm_pool.c
+++ b/lustre/ldlm/ldlm_pool.c
@@ -1098,16 +1098,16 @@ static int ldlm_pools_shrink(ldlm_side_t client, int nr,
         for (nr_ns = cfs_atomic_read(ldlm_namespace_nr(client));
              nr_ns > 0; nr_ns--)
         {
-                cfs_mutex_down(ldlm_namespace_lock(client));
+                cfs_mutex_lock(ldlm_namespace_lock(client));
                 if (cfs_list_empty(ldlm_namespace_list(client))) {
-                        cfs_mutex_up(ldlm_namespace_lock(client));
+                        cfs_mutex_unlock(ldlm_namespace_lock(client));
                         cl_env_reexit(cookie);
                         return 0;
                 }
                 ns = ldlm_namespace_first_locked(client);
                 ldlm_namespace_get(ns);
                 ldlm_namespace_move_locked(ns, client);
-                cfs_mutex_up(ldlm_namespace_lock(client));
+                cfs_mutex_unlock(ldlm_namespace_lock(client));
                 total += ldlm_pool_shrink(&ns->ns_pool, 0, gfp_mask);
                 ldlm_namespace_put(ns);
         }
@@ -1128,9 +1128,9 @@ static int ldlm_pools_shrink(ldlm_side_t client, int nr,
                 /*
                  * Do not call shrink under ldlm_namespace_lock(client)
                  */
-                cfs_mutex_down(ldlm_namespace_lock(client));
+                cfs_mutex_lock(ldlm_namespace_lock(client));
                 if (cfs_list_empty(ldlm_namespace_list(client))) {
-                        cfs_mutex_up(ldlm_namespace_lock(client));
+                        cfs_mutex_unlock(ldlm_namespace_lock(client));
                         /*
                          * If list is empty, we can't return any @cached > 0,
                          * that probably would cause needless shrinker
@@ -1142,7 +1142,7 @@ static int ldlm_pools_shrink(ldlm_side_t client, int nr,
                 ns = ldlm_namespace_first_locked(client);
                 ldlm_namespace_get(ns);
                 ldlm_namespace_move_locked(ns, client);
-                cfs_mutex_up(ldlm_namespace_lock(client));
+                cfs_mutex_unlock(ldlm_namespace_lock(client));
 
                 nr_locks = ldlm_pool_granted(&ns->ns_pool);
                 cancel = 1 + nr_locks * nr / total;
@@ -1181,7 +1181,7 @@ void ldlm_pools_recalc(ldlm_side_t client)
                 /*
                  * Check all modest namespaces first.
                  */
-                cfs_mutex_down(ldlm_namespace_lock(client));
+                cfs_mutex_lock(ldlm_namespace_lock(client));
                 cfs_list_for_each_entry(ns, ldlm_namespace_list(client),
                                         ns_list_chain)
                 {
@@ -1244,7 +1244,7 @@ void ldlm_pools_recalc(ldlm_side_t client)
                         }
                         ldlm_pool_setup(&ns->ns_pool, l);
                 }
-                cfs_mutex_up(ldlm_namespace_lock(client));
+                cfs_mutex_unlock(ldlm_namespace_lock(client));
         }
 
         /*
@@ -1259,9 +1259,9 @@ void ldlm_pools_recalc(ldlm_side_t client)
                  * rid of potential deadlock on client nodes when canceling
                  * locks synchronously.
                  */
-                cfs_mutex_down(ldlm_namespace_lock(client));
+                cfs_mutex_lock(ldlm_namespace_lock(client));
                 if (cfs_list_empty(ldlm_namespace_list(client))) {
-                        cfs_mutex_up(ldlm_namespace_lock(client));
+                        cfs_mutex_unlock(ldlm_namespace_lock(client));
                         break;
                 }
                 ns = ldlm_namespace_first_locked(client);
@@ -1280,7 +1280,7 @@ void ldlm_pools_recalc(ldlm_side_t client)
                 cfs_spin_unlock(&ns->ns_lock);
 
                 ldlm_namespace_move_locked(ns, client);
-                cfs_mutex_up(ldlm_namespace_lock(client));
+                cfs_mutex_unlock(ldlm_namespace_lock(client));
 
                 /*
                  * After setup is done - recalc the pool.
diff --git a/lustre/ldlm/ldlm_resource.c b/lustre/ldlm/ldlm_resource.c
index 99e77dd..818d2c7 100644
--- a/lustre/ldlm/ldlm_resource.c
+++ b/lustre/ldlm/ldlm_resource.c
@@ -55,10 +55,10 @@ cfs_mem_cache_t *ldlm_resource_slab, *ldlm_lock_slab;
 cfs_atomic_t ldlm_srv_namespace_nr = CFS_ATOMIC_INIT(0);
 cfs_atomic_t ldlm_cli_namespace_nr = CFS_ATOMIC_INIT(0);
 
-cfs_semaphore_t ldlm_srv_namespace_lock;
+cfs_mutex_t ldlm_srv_namespace_lock;
 CFS_LIST_HEAD(ldlm_srv_namespace_list);
 
-cfs_semaphore_t ldlm_cli_namespace_lock;
+cfs_mutex_t ldlm_cli_namespace_lock;
 CFS_LIST_HEAD(ldlm_cli_namespace_list);
 
 cfs_proc_dir_entry_t *ldlm_type_proc_dir = NULL;
@@ -937,17 +937,17 @@ void ldlm_namespace_put(struct ldlm_namespace *ns)
 /* Register @ns in the list of namespaces */
 void ldlm_namespace_register(struct ldlm_namespace *ns, ldlm_side_t client)
 {
-        cfs_mutex_down(ldlm_namespace_lock(client));
+        cfs_mutex_lock(ldlm_namespace_lock(client));
         LASSERT(cfs_list_empty(&ns->ns_list_chain));
         cfs_list_add(&ns->ns_list_chain, ldlm_namespace_list(client));
         cfs_atomic_inc(ldlm_namespace_nr(client));
-        cfs_mutex_up(ldlm_namespace_lock(client));
+        cfs_mutex_unlock(ldlm_namespace_lock(client));
 }
 
 /* Unregister @ns from the list of namespaces */
 void ldlm_namespace_unregister(struct ldlm_namespace *ns, ldlm_side_t client)
 {
-        cfs_mutex_down(ldlm_namespace_lock(client));
+        cfs_mutex_lock(ldlm_namespace_lock(client));
         LASSERT(!cfs_list_empty(&ns->ns_list_chain));
         /*
          * Some asserts and possibly other parts of code still using
@@ -956,21 +956,21 @@ void ldlm_namespace_unregister(struct ldlm_namespace *ns, ldlm_side_t client)
          */
         cfs_list_del_init(&ns->ns_list_chain);
         cfs_atomic_dec(ldlm_namespace_nr(client));
-        cfs_mutex_up(ldlm_namespace_lock(client));
+        cfs_mutex_unlock(ldlm_namespace_lock(client));
 }
 
 /* Should be called under ldlm_namespace_lock(client) taken */
 void ldlm_namespace_move_locked(struct ldlm_namespace *ns, ldlm_side_t client)
 {
         LASSERT(!cfs_list_empty(&ns->ns_list_chain));
-        LASSERT_SEM_LOCKED(ldlm_namespace_lock(client));
+        LASSERT_MUTEX_LOCKED(ldlm_namespace_lock(client));
         cfs_list_move_tail(&ns->ns_list_chain, ldlm_namespace_list(client));
 }
 
 /* Should be called under ldlm_namespace_lock(client) taken */
 struct ldlm_namespace *ldlm_namespace_first_locked(ldlm_side_t client)
 {
-        LASSERT_SEM_LOCKED(ldlm_namespace_lock(client));
+        LASSERT_MUTEX_LOCKED(ldlm_namespace_lock(client));
         LASSERT(!cfs_list_empty(ldlm_namespace_list(client)));
         return container_of(ldlm_namespace_list(client)->next,
                 struct ldlm_namespace, ns_list_chain);
@@ -1001,8 +1001,9 @@ static struct ldlm_resource *ldlm_resource_new(void)
         lu_ref_init(&res->lr_reference);
 
         /* one who creates the resource must unlock
-         * the semaphore after lvb initialization */
-        cfs_init_mutex_locked(&res->lr_lvb_sem);
+         * the mutex after lvb initialization */
+        cfs_mutex_init(&res->lr_lvb_mutex);
+        cfs_mutex_lock(&res->lr_lvb_mutex);
 
         return res;
 }
@@ -1031,8 +1032,8 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,
                 res = cfs_hlist_entry(hnode, struct ldlm_resource, lr_hash);
                 /* synchronize WRT resource creation */
                 if (ns->ns_lvbo && ns->ns_lvbo->lvbo_init) {
-                        cfs_down(&res->lr_lvb_sem);
-                        cfs_up(&res->lr_lvb_sem);
+                        cfs_mutex_lock(&res->lr_lvb_mutex);
+                        cfs_mutex_unlock(&res->lr_lvb_mutex);
                 }
                 return res;
         }
@@ -1068,8 +1069,8 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,
                 res = cfs_hlist_entry(hnode, struct ldlm_resource, lr_hash);
                 /* synchronize WRT resource creation */
                 if (ns->ns_lvbo && ns->ns_lvbo->lvbo_init) {
-                        cfs_down(&res->lr_lvb_sem);
-                        cfs_up(&res->lr_lvb_sem);
+                        cfs_mutex_lock(&res->lr_lvb_mutex);
+                        cfs_mutex_unlock(&res->lr_lvb_mutex);
                 }
                 return res;
         }
@@ -1087,8 +1088,8 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,
                 if (rc)
                         CERROR("lvbo_init failed for resource "
                                LPU64": rc %d\n", name->name[0], rc);
-                /* we create resource with locked lr_lvb_sem */
-                cfs_up(&res->lr_lvb_sem);
+                /* we create resource with locked lr_lvb_mutex */
+                cfs_mutex_unlock(&res->lr_lvb_mutex);
         }
 
         return res;
@@ -1250,7 +1251,7 @@ void ldlm_dump_all_namespaces(ldlm_side_t client, int level)
         if (!((libcfs_debug | D_ERROR) & level))
                 return;
 
-        cfs_mutex_down(ldlm_namespace_lock(client));
+        cfs_mutex_lock(ldlm_namespace_lock(client));
 
         cfs_list_for_each(tmp, ldlm_namespace_list(client)) {
                 struct ldlm_namespace *ns;
@@ -1258,7 +1259,7 @@ void ldlm_dump_all_namespaces(ldlm_side_t client, int level)
                 ldlm_namespace_dump(level, ns);
         }
 
-        cfs_mutex_up(ldlm_namespace_lock(client));
+        cfs_mutex_unlock(ldlm_namespace_lock(client));
 }
 
 static int ldlm_res_hash_dump(cfs_hash_t *hs, cfs_hash_bd_t *bd,
diff --git a/lustre/liblustre/llite_lib.h b/lustre/liblustre/llite_lib.h
index ea15572..8a48eb1 100644
--- a/lustre/liblustre/llite_lib.h
+++ b/lustre/liblustre/llite_lib.h
@@ -101,7 +101,6 @@ struct llu_inode_info {
 
         struct lov_stripe_md   *lli_smd;
         char                   *lli_symlink_name;
-        cfs_semaphore_t         lli_open_sem;
         __u64                   lli_maxbytes;
         unsigned long           lli_flags;
         __u64                   lli_ioepoch;
diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c
index 42c1bd4..9044822 100644
--- a/lustre/llite/dcache.c
+++ b/lustre/llite/dcache.c
@@ -482,7 +482,7 @@ int ll_revalidate_it(struct dentry *de, int lookup_flags,
                 ibits = MDS_INODELOCK_LOOKUP;
                 if (!ll_have_md_lock(inode, &ibits, LCK_MINMODE))
                         goto do_lock;
-                cfs_down(&lli->lli_och_sem);
+                cfs_mutex_lock(&lli->lli_och_mutex);
                 if (*och_p) { /* Everything is open already, do nothing */
                         /*(*och_usecount)++;  Do not let them steal our open
                           handle from under us */
@@ -493,10 +493,10 @@ int ll_revalidate_it(struct dentry *de, int lookup_flags,
                            hope the lock won't be invalidated in between. But
                            if it would be, we'll reopen the open request to
                            MDS later during file open path */
-                        cfs_up(&lli->lli_och_sem);
+                        cfs_mutex_unlock(&lli->lli_och_mutex);
                         RETURN(1);
                 } else {
-                        cfs_up(&lli->lli_och_sem);
+                        cfs_mutex_unlock(&lli->lli_och_mutex);
                 }
         }
 
diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c
index 4a8fc75..c61906b 100644
--- a/lustre/llite/dir.c
+++ b/lustre/llite/dir.c
@@ -418,7 +418,7 @@ struct page *ll_get_dir_page(struct file *filp, struct inode *dir, __u64 hash,
         }
         ldlm_lock_dump_handle(D_OTHER, &lockh);
 
-        cfs_down(&lli->lli_readdir_sem);
+        cfs_mutex_lock(&lli->lli_readdir_mutex);
         page = ll_dir_page_locate(dir, &lhash, &start, &end);
         if (IS_ERR(page)) {
                 CERROR("dir page locate: "DFID" at "LPU64": rc %ld\n",
@@ -491,7 +491,7 @@ hash_collision:
                 goto fail;
         }
 out_unlock:
-        cfs_up(&lli->lli_readdir_sem);
+        cfs_mutex_unlock(&lli->lli_readdir_mutex);
         ldlm_lock_decref(&lockh, mode);
         return page;
 
diff --git a/lustre/llite/file.c b/lustre/llite/file.c
index e5a417a..ed445fd 100644
--- a/lustre/llite/file.c
+++ b/lustre/llite/file.c
@@ -203,15 +203,15 @@ int ll_md_real_close(struct inode *inode, int flags)
                 och_usecount = &lli->lli_open_fd_read_count;
         }
 
-        cfs_down(&lli->lli_och_sem);
+        cfs_mutex_lock(&lli->lli_och_mutex);
         if (*och_usecount) { /* There are still users of this handle, so
                                 skip freeing it. */
-                cfs_up(&lli->lli_och_sem);
+                cfs_mutex_unlock(&lli->lli_och_mutex);
                 RETURN(0);
         }
         och=*och_p;
         *och_p = NULL;
-        cfs_up(&lli->lli_och_sem);
+        cfs_mutex_unlock(&lli->lli_och_mutex);
 
         if (och) { /* There might be a race and somebody have freed this och
                       already */
@@ -243,7 +243,7 @@ int ll_md_close(struct obd_export *md_exp, struct inode *inode,
                 struct inode *inode = file->f_dentry->d_inode;
                 ldlm_policy_data_t policy = {.l_inodebits={MDS_INODELOCK_OPEN}};
 
-                cfs_down(&lli->lli_och_sem);
+                cfs_mutex_lock(&lli->lli_och_mutex);
                 if (fd->fd_omode & FMODE_WRITE) {
                         lockmode = LCK_CW;
                         LASSERT(lli->lli_open_fd_write_count);
@@ -257,7 +257,7 @@ int ll_md_close(struct obd_export *md_exp, struct inode *inode,
                         LASSERT(lli->lli_open_fd_read_count);
                         lli->lli_open_fd_read_count--;
                 }
-                cfs_up(&lli->lli_och_sem);
+                cfs_mutex_unlock(&lli->lli_och_mutex);
 
                 if (!md_lock_match(md_exp, flags, ll_inode2fid(inode),
                                    LDLM_IBITS, &policy, lockmode,
@@ -481,9 +481,7 @@ int ll_local_open(struct file *file, struct lookup_intent *it,
 
 /* Open a file, and (for the very first open) create objects on the OSTs at
  * this time.  If opened with O_LOV_DELAY_CREATE, then we don't do the object
- * creation or open until ll_lov_setstripe() ioctl is called.  We grab
- * lli_open_sem to ensure no other process will create objects, send the
- * stripe MD to the MDS, or try to destroy the objects if that fails.
+ * creation or open until ll_lov_setstripe() ioctl is called. 
  *
  * If we already have the stripe MD locally then we don't request it in
  * md_open(), by passing a lmm_size = 0.
@@ -575,14 +573,14 @@ restart:
                 och_usecount = &lli->lli_open_fd_read_count;
         }
 
-        cfs_down(&lli->lli_och_sem);
+        cfs_mutex_lock(&lli->lli_och_mutex);
         if (*och_p) { /* Open handle is present */
                 if (it_disposition(it, DISP_OPEN_OPEN)) {
                         /* Well, there's extra open request that we do not need,
                            let's close it somehow. This will decref request. */
                         rc = it_open_error(DISP_OPEN_OPEN, it);
                         if (rc) {
-                                cfs_up(&lli->lli_och_sem);
+                                cfs_mutex_unlock(&lli->lli_och_mutex);
                                 GOTO(out_openerr, rc);
                         }
 
@@ -595,7 +593,7 @@ restart:
                 rc = ll_local_open(file, it, fd, NULL);
                 if (rc) {
                         (*och_usecount)--;
-                        cfs_up(&lli->lli_och_sem);
+                        cfs_mutex_unlock(&lli->lli_och_mutex);
                         GOTO(out_openerr, rc);
                 }
         } else {
@@ -606,7 +604,7 @@ restart:
                            could be cancelled, and since blocking ast handler
                            would attempt to grab och_sem as well, that would
                            result in a deadlock */
-                        cfs_up(&lli->lli_och_sem);
+                        cfs_mutex_unlock(&lli->lli_och_mutex);
                         it->it_create_mode |= M_CHECK_STALE;
                         rc = ll_intent_file_open(file, NULL, 0, it);
                         it->it_create_mode &= ~M_CHECK_STALE;
@@ -637,10 +635,10 @@ restart:
                 if (rc)
                         GOTO(out_och_free, rc);
         }
-        cfs_up(&lli->lli_och_sem);
+        cfs_mutex_unlock(&lli->lli_och_mutex);
         fd = NULL;
 
-        /* Must do this outside lli_och_sem lock to prevent deadlock where
+        /* Must do this outside lli_och_mutex lock to prevent deadlock where
            different kind of OPEN lock for this same inode gets cancelled
            by ldlm_cancel_lru */
         if (!S_ISREG(inode->i_mode))
@@ -671,7 +669,7 @@ out_och_free:
                         *och_p = NULL; /* OBD_FREE writes some magic there */
                         (*och_usecount)--;
                 }
-                cfs_up(&lli->lli_och_sem);
+                cfs_mutex_unlock(&lli->lli_och_mutex);
 
 out_openerr:
                 if (opendir_set != 0)
@@ -837,7 +835,7 @@ static ssize_t ll_file_io_generic(const struct lu_env *env,
         if (cl_io_rw_init(env, io, iot, *ppos, count) == 0) {
                 struct vvp_io *vio = vvp_env_io(env);
                 struct ccc_io *cio = ccc_env_io(env);
-                int write_sem_locked = 0;
+                int write_mutex_locked = 0;
 
                 cio->cui_fd  = LUSTRE_FPRIVATE(file);
                 vio->cui_io_subtype = args->via_io_subtype;
@@ -852,9 +850,10 @@ static ssize_t ll_file_io_generic(const struct lu_env *env,
 #endif
                         if ((iot == CIT_WRITE) &&
                             !(cio->cui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) {
-                                if(cfs_down_interruptible(&lli->lli_write_sem))
+                                if (cfs_mutex_lock_interruptible(&lli->
+                                                               lli_write_mutex))
                                         GOTO(out, result = -ERESTARTSYS);
-                                write_sem_locked = 1;
+                                write_mutex_locked = 1;
                         } else if (iot == CIT_READ) {
                                 cfs_down_read(&lli->lli_trunc_sem);
                         }
@@ -872,8 +871,8 @@ static ssize_t ll_file_io_generic(const struct lu_env *env,
                         LBUG();
                 }
                 result = cl_io_loop(env, io);
-                if (write_sem_locked)
-                        cfs_up(&lli->lli_write_sem);
+                if (write_mutex_locked)
+                        cfs_mutex_unlock(&lli->lli_write_mutex);
                 else if (args->via_io_subtype == IO_NORMAL && iot == CIT_READ)
                         cfs_up_read(&lli->lli_trunc_sem);
         } else {
diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h
index a7b314b..6611703 100644
--- a/lustre/llite/llite_internal.h
+++ b/lustre/llite/llite_internal.h
@@ -130,7 +130,7 @@ struct ll_inode_info {
         int                     lli_inode_magic;
         cfs_semaphore_t         lli_size_sem;           /* protect open and change size */
         void                   *lli_size_sem_owner;
-        cfs_semaphore_t         lli_write_sem;
+        cfs_mutex_t             lli_write_mutex;
         cfs_rw_semaphore_t      lli_trunc_sem;
         char                   *lli_symlink_name;
         __u64                   lli_maxbytes;
@@ -154,11 +154,11 @@ struct ll_inode_info {
         /* remote permission hash */
         cfs_hlist_head_t       *lli_remote_perms;
         unsigned long           lli_rmtperm_utime;
-        cfs_semaphore_t         lli_rmtperm_sem;
+        cfs_mutex_t             lli_rmtperm_mutex;
 
         cfs_list_t              lli_dead_list;
 
-        cfs_semaphore_t         lli_och_sem; /* Protects access to och pointers
+        cfs_mutex_t             lli_och_mutex; /* Protects access to och pointers
                                                 and their usage counters, also
                                                 atomicity of check-update of
                                                 lli_smd */
@@ -209,7 +209,7 @@ struct ll_inode_info {
         /**
          * serialize normal readdir and statahead-readdir
          */
-        cfs_semaphore_t         lli_readdir_sem;
+        cfs_mutex_t             lli_readdir_mutex;
 };
 
 /*
diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c
index 883f181..038d9f9 100644
--- a/lustre/llite/llite_lib.c
+++ b/lustre/llite/llite_lib.c
@@ -90,7 +90,7 @@ static struct ll_sb_info *ll_init_sbi(void)
                 RETURN(NULL);
 
         cfs_spin_lock_init(&sbi->ll_lock);
-        cfs_init_mutex(&sbi->ll_lco.lco_lock);
+        cfs_mutex_init(&sbi->ll_lco.lco_lock);
         cfs_spin_lock_init(&sbi->ll_pp_extent_lock);
         cfs_spin_lock_init(&sbi->ll_process_lock);
         sbi->ll_rw_stats_on = 0;
@@ -448,11 +448,11 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
                 GOTO(out_dt, err);
         }
 
-        cfs_mutex_down(&sbi->ll_lco.lco_lock);
+        cfs_mutex_lock(&sbi->ll_lco.lco_lock);
         sbi->ll_lco.lco_flags = data->ocd_connect_flags;
         sbi->ll_lco.lco_md_exp = sbi->ll_md_exp;
         sbi->ll_lco.lco_dt_exp = sbi->ll_dt_exp;
-        cfs_mutex_up(&sbi->ll_lco.lco_lock);
+        cfs_mutex_unlock(&sbi->ll_lco.lco_lock);
 
         fid_zero(&sbi->ll_root_fid);
         err = md_getstatus(sbi->ll_md_exp, &sbi->ll_root_fid, &oc);
@@ -855,14 +855,14 @@ void ll_lli_init(struct ll_inode_info *lli)
 {
         lli->lli_inode_magic = LLI_INODE_MAGIC;
         cfs_sema_init(&lli->lli_size_sem, 1);
-        cfs_sema_init(&lli->lli_write_sem, 1);
+        cfs_mutex_init(&lli->lli_write_mutex);
         cfs_init_rwsem(&lli->lli_trunc_sem);
         lli->lli_flags = 0;
         lli->lli_maxbytes = PAGE_CACHE_MAXBYTES;
         cfs_spin_lock_init(&lli->lli_lock);
         CFS_INIT_LIST_HEAD(&lli->lli_close_list);
         lli->lli_inode_magic = LLI_INODE_MAGIC;
-        cfs_sema_init(&lli->lli_och_sem, 1);
+        cfs_mutex_init(&lli->lli_och_mutex);
         lli->lli_mds_read_och = lli->lli_mds_write_och = NULL;
         lli->lli_mds_exec_och = NULL;
         lli->lli_open_fd_read_count = lli->lli_open_fd_write_count = 0;
@@ -870,11 +870,11 @@ void ll_lli_init(struct ll_inode_info *lli)
         CFS_INIT_LIST_HEAD(&lli->lli_dead_list);
         lli->lli_remote_perms = NULL;
         lli->lli_rmtperm_utime = 0;
-        cfs_sema_init(&lli->lli_rmtperm_sem, 1);
+        cfs_mutex_init(&lli->lli_rmtperm_mutex);
         CFS_INIT_LIST_HEAD(&lli->lli_oss_capas);
         cfs_spin_lock_init(&lli->lli_sa_lock);
         lli->lli_clob = NULL;
-        cfs_sema_init(&lli->lli_readdir_sem, 1);
+        cfs_mutex_init(&lli->lli_readdir_mutex);
         fid_zero(&lli->lli_pfid);
 }
 
@@ -1554,7 +1554,7 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
 
         LASSERT ((lsm != NULL) == ((body->valid & OBD_MD_FLEASIZE) != 0));
         if (lsm != NULL) {
-                cfs_down(&lli->lli_och_sem);
+                cfs_mutex_lock(&lli->lli_och_mutex);
                 if (lli->lli_smd == NULL) {
                         if (lsm->lsm_magic != LOV_MAGIC_V1 &&
                             lsm->lsm_magic != LOV_MAGIC_V3) {
@@ -1571,12 +1571,12 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
                         cfs_spin_lock(&lli->lli_lock);
                         lli->lli_smd = lsm;
                         cfs_spin_unlock(&lli->lli_lock);
-                        cfs_up(&lli->lli_och_sem);
+                        cfs_mutex_unlock(&lli->lli_och_mutex);
                         lli->lli_maxbytes = lsm->lsm_maxbytes;
                         if (lli->lli_maxbytes > PAGE_CACHE_MAXBYTES)
                                 lli->lli_maxbytes = PAGE_CACHE_MAXBYTES;
                 } else {
-                        cfs_up(&lli->lli_och_sem);
+                        cfs_mutex_unlock(&lli->lli_och_mutex);
                         LASSERT(lli->lli_smd->lsm_magic == lsm->lsm_magic &&
                                 lli->lli_smd->lsm_stripe_count ==
                                 lsm->lsm_stripe_count);
diff --git a/lustre/llite/lloop.c b/lustre/llite/lloop.c
index 952d144..987339a 100644
--- a/lustre/llite/lloop.c
+++ b/lustre/llite/lloop.c
@@ -144,7 +144,7 @@ struct lloop_device {
         struct bio          *lo_biotail;
         int                  lo_state;
         cfs_semaphore_t      lo_sem;
-        cfs_semaphore_t      lo_ctl_mutex;
+        cfs_mutex_t          lo_ctl_mutex;
         cfs_atomic_t         lo_pending;
         cfs_waitq_t          lo_bh_wait;
 
@@ -173,7 +173,7 @@ static int lloop_major;
 static int max_loop = MAX_LOOP_DEFAULT;
 static struct lloop_device *loop_dev;
 static struct gendisk **disks;
-static cfs_semaphore_t lloop_mutex;
+static cfs_mutex_t lloop_mutex;
 static void *ll_iocontrol_magic = NULL;
 
 static loff_t get_loop_size(struct lloop_device *lo, struct file *file)
@@ -618,9 +618,9 @@ static int lo_open(struct inode *inode, struct file *file)
         struct lloop_device *lo = inode->i_bdev->bd_disk->private_data;
 #endif
 
-        cfs_down(&lo->lo_ctl_mutex);
+        cfs_mutex_lock(&lo->lo_ctl_mutex);
         lo->lo_refcnt++;
-        cfs_up(&lo->lo_ctl_mutex);
+        cfs_mutex_unlock(&lo->lo_ctl_mutex);
 
         return 0;
 }
@@ -635,9 +635,9 @@ static int lo_release(struct inode *inode, struct file *file)
         struct lloop_device *lo = inode->i_bdev->bd_disk->private_data;
 #endif
 
-        cfs_down(&lo->lo_ctl_mutex);
+        cfs_mutex_lock(&lo->lo_ctl_mutex);
         --lo->lo_refcnt;
-        cfs_up(&lo->lo_ctl_mutex);
+        cfs_mutex_unlock(&lo->lo_ctl_mutex);
 
         return 0;
 }
@@ -658,7 +658,7 @@ static int lo_ioctl(struct inode *inode, struct file *unused,
 #endif
         int err = 0;
 
-        cfs_down(&lloop_mutex);
+        cfs_mutex_lock(&lloop_mutex);
         switch (cmd) {
         case LL_IOC_LLOOP_DETACH: {
                 err = loop_clr_fd(lo, bdev, 2);
@@ -684,7 +684,7 @@ static int lo_ioctl(struct inode *inode, struct file *unused,
                 err = -EINVAL;
                 break;
         }
-        cfs_up(&lloop_mutex);
+        cfs_mutex_unlock(&lloop_mutex);
 
         return err;
 }
@@ -720,7 +720,7 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file,
 
         CWARN("Enter llop_ioctl\n");
 
-        cfs_down(&lloop_mutex);
+        cfs_mutex_lock(&lloop_mutex);
         switch (cmd) {
         case LL_IOC_LLOOP_ATTACH: {
                 struct lloop_device *lo_free = NULL;
@@ -790,7 +790,7 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file,
         }
 
 out:
-        cfs_up(&lloop_mutex);
+        cfs_mutex_unlock(&lloop_mutex);
 out1:
         if (rcp)
                 *rcp = err;
@@ -836,7 +836,7 @@ static int __init lloop_init(void)
                         goto out_mem3;
         }
 
-        cfs_init_mutex(&lloop_mutex);
+        cfs_mutex_init(&lloop_mutex);
 
         for (i = 0; i < max_loop; i++) {
                 struct lloop_device *lo = &loop_dev[i];
@@ -846,8 +846,8 @@ static int __init lloop_init(void)
                 if (!lo->lo_queue)
                         goto out_mem4;
 
-                cfs_init_mutex(&lo->lo_ctl_mutex);
-                cfs_init_mutex_locked(&lo->lo_sem);
+                cfs_mutex_init(&lo->lo_ctl_mutex);
+                cfs_sema_init(&lo->lo_sem, 0);
                 cfs_waitq_init(&lo->lo_bh_wait);
                 lo->lo_number = i;
                 cfs_spin_lock_init(&lo->lo_lock);
diff --git a/lustre/llite/remote_perm.c b/lustre/llite/remote_perm.c
index f90de1f..7ce2bfe 100644
--- a/lustre/llite/remote_perm.c
+++ b/lustre/llite/remote_perm.c
@@ -265,12 +265,12 @@ int lustre_check_remote_perm(struct inode *inode, int mask)
 
                 cfs_might_sleep();
 
-                cfs_down(&lli->lli_rmtperm_sem);
+                cfs_mutex_lock(&lli->lli_rmtperm_mutex);
                 /* check again */
                 if (utime != lli->lli_rmtperm_utime) {
                         rc = do_check_remote_perm(lli, mask);
                         if (!rc || (rc != -ENOENT && i)) {
-                                cfs_up(&lli->lli_rmtperm_sem);
+                                cfs_mutex_unlock(&lli->lli_rmtperm_mutex);
                                 break;
                         }
                 }
@@ -285,20 +285,20 @@ int lustre_check_remote_perm(struct inode *inode, int mask)
                                         ll_i2suppgid(inode), &req);
                 capa_put(oc);
                 if (rc) {
-                        cfs_up(&lli->lli_rmtperm_sem);
+                        cfs_mutex_unlock(&lli->lli_rmtperm_mutex);
                         break;
                 }
 
                 perm = req_capsule_server_swab_get(&req->rq_pill, &RMF_ACL,
                                                    lustre_swab_mdt_remote_perm);
                 if (unlikely(perm == NULL)) {
-                        cfs_up(&lli->lli_rmtperm_sem);
+                        cfs_mutex_unlock(&lli->lli_rmtperm_mutex);
                         rc = -EPROTO;
                         break;
                 }
 
                 rc = ll_update_remote_perm(inode, perm);
-                cfs_up(&lli->lli_rmtperm_sem);
+                cfs_mutex_unlock(&lli->lli_rmtperm_mutex);
                 if (rc == -ENOMEM)
                         break;
 
diff --git a/lustre/llite/symlink.c b/lustre/llite/symlink.c
index af46369..9529273 100644
--- a/lustre/llite/symlink.c
+++ b/lustre/llite/symlink.c
@@ -117,7 +117,7 @@ static int ll_readlink(struct dentry *dentry, char *buffer, int buflen)
         ENTRY;
 
         CDEBUG(D_VFSTRACE, "VFS Op\n");
-        /* on symlinks lli_open_sem protects lli_symlink_name allocation/data */
+
         ll_inode_size_lock(inode, 0);
         rc = ll_readlink_internal(inode, &request, &symname);
         if (rc)
diff --git a/lustre/lmv/lmv_internal.h b/lustre/lmv/lmv_internal.h
index a2c67ad..bb8f1a5 100644
--- a/lustre/lmv/lmv_internal.h
+++ b/lustre/lmv/lmv_internal.h
@@ -45,8 +45,8 @@
 
 #define LMV_MAX_TGT_COUNT 128
 
-#define lmv_init_lock(lmv)   cfs_down(&lmv->init_sem);
-#define lmv_init_unlock(lmv) cfs_up(&lmv->init_sem);
+#define lmv_init_lock(lmv)   cfs_mutex_lock(&lmv->init_mutex);
+#define lmv_init_unlock(lmv) cfs_mutex_unlock(&lmv->init_mutex);
 
 #define LL_IT2STR(it)				        \
 	((it) ? ldlm_it2str((it)->it_op) : "0")
@@ -80,7 +80,7 @@ struct lmv_object {
         /**
          * Sema for protecting fields.
          */
-        cfs_semaphore_t         lo_guard;
+        cfs_mutex_t             lo_guard;
         /**
          * Object state like O_FREEING.
          */
@@ -118,14 +118,14 @@ static inline void
 lmv_object_lock(struct lmv_object *obj)
 {
         LASSERT(obj);
-        cfs_down(&obj->lo_guard);
+        cfs_mutex_lock(&obj->lo_guard);
 }
 
 static inline void
 lmv_object_unlock(struct lmv_object *obj)
 {
         LASSERT(obj);
-        cfs_up(&obj->lo_guard);
+        cfs_mutex_unlock(&obj->lo_guard);
 }
 
 void lmv_object_add(struct lmv_object *obj);
diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c
index 4aef69a..2673563 100644
--- a/lustre/lmv/lmv_obd.c
+++ b/lustre/lmv/lmv_obd.c
@@ -570,6 +570,7 @@ int lmv_check_connect(struct obd_device *obd)
         }
 
         if (lmv->desc.ld_tgt_count == 0) {
+                lmv_init_unlock(lmv);
                 CERROR("%s: no targets configured.\n", obd->obd_name);
                 RETURN(-EINVAL);
         }
@@ -992,7 +993,7 @@ int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid,
          * New seq alloc and FLD setup should be atomic. Otherwise we may find
          * on server that seq in new allocated fid is not yet known.
          */
-        cfs_down(&tgt->ltd_fid_sem);
+        cfs_mutex_lock(&tgt->ltd_fid_mutex);
 
         if (!tgt->ltd_active)
                 GOTO(out, rc = -ENODEV);
@@ -1008,7 +1009,7 @@ int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid,
 
         EXIT;
 out:
-        cfs_up(&tgt->ltd_fid_sem);
+        cfs_mutex_unlock(&tgt->ltd_fid_mutex);
         return rc;
 }
 
@@ -1079,7 +1080,7 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                 RETURN(-ENOMEM);
 
         for (i = 0; i < LMV_MAX_TGT_COUNT; i++) {
-                cfs_sema_init(&lmv->tgts[i].ltd_fid_sem, 1);
+                cfs_mutex_init(&lmv->tgts[i].ltd_fid_mutex);
                 lmv->tgts[i].ltd_idx = i;
         }
 
@@ -1098,7 +1099,7 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
         lmv->lmv_placement = PLACEMENT_CHAR_POLICY;
 
         cfs_spin_lock_init(&lmv->lmv_lock);
-        cfs_sema_init(&lmv->init_sem, 1);
+        cfs_mutex_init(&lmv->init_mutex);
 
         rc = lmv_object_setup(obd);
         if (rc) {
diff --git a/lustre/lmv/lmv_object.c b/lustre/lmv/lmv_object.c
index 60631c8..c263132 100644
--- a/lustre/lmv/lmv_object.c
+++ b/lustre/lmv/lmv_object.c
@@ -92,7 +92,7 @@ struct lmv_object *lmv_object_alloc(struct obd_device *obd,
         obj->lo_state = 0;
         obj->lo_hashtype = mea->mea_magic;
 
-        cfs_init_mutex(&obj->lo_guard);
+        cfs_mutex_init(&obj->lo_guard);
         cfs_atomic_set(&obj->lo_count, 0);
         obj->lo_objcount = mea->mea_count;
 
diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c
index 0497cb2..29eca68 100644
--- a/lustre/lov/lov_obd.c
+++ b/lustre/lov/lov_obd.c
@@ -78,9 +78,9 @@ static void lov_getref(struct obd_device *obd)
         struct lov_obd *lov = &obd->u.lov;
 
         /* nobody gets through here until lov_putref is done */
-        cfs_mutex_down(&lov->lov_lock);
+        cfs_mutex_lock(&lov->lov_lock);
         cfs_atomic_inc(&lov->lov_refcount);
-        cfs_mutex_up(&lov->lov_lock);
+        cfs_mutex_unlock(&lov->lov_lock);
         return;
 }
 
@@ -90,7 +90,7 @@ static void lov_putref(struct obd_device *obd)
 {
         struct lov_obd *lov = &obd->u.lov;
 
-        cfs_mutex_down(&lov->lov_lock);
+        cfs_mutex_lock(&lov->lov_lock);
         /* ok to dec to 0 more than once -- ltd_exp's will be null */
         if (cfs_atomic_dec_and_test(&lov->lov_refcount) && lov->lov_death_row) {
                 CFS_LIST_HEAD(kill);
@@ -111,7 +111,7 @@ static void lov_putref(struct obd_device *obd)
                         lov->lov_tgts[i] = NULL;
                         lov->lov_death_row--;
                 }
-                cfs_mutex_up(&lov->lov_lock);
+                cfs_mutex_unlock(&lov->lov_lock);
 
                 cfs_list_for_each_entry_safe(tgt, n, &kill, ltd_kill) {
                         cfs_list_del(&tgt->ltd_kill);
@@ -119,7 +119,7 @@ static void lov_putref(struct obd_device *obd)
                         __lov_del_obd(obd, tgt);
                 }
         } else {
-                cfs_mutex_up(&lov->lov_lock);
+                cfs_mutex_unlock(&lov->lov_lock);
         }
 }
 
@@ -551,13 +551,13 @@ static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
         if (tgt_obd == NULL)
                 RETURN(-EINVAL);
 
-        cfs_mutex_down(&lov->lov_lock);
+        cfs_mutex_lock(&lov->lov_lock);
 
         if ((index < lov->lov_tgt_size) && (lov->lov_tgts[index] != NULL)) {
                 tgt = lov->lov_tgts[index];
                 CERROR("UUID %s already assigned at LOV target index %d\n",
                        obd_uuid2str(&tgt->ltd_uuid), index);
-                cfs_mutex_up(&lov->lov_lock);
+                cfs_mutex_unlock(&lov->lov_lock);
                 RETURN(-EEXIST);
         }
 
@@ -571,7 +571,7 @@ static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
                         newsize = newsize << 1;
                 OBD_ALLOC(newtgts, sizeof(*newtgts) * newsize);
                 if (newtgts == NULL) {
-                        cfs_mutex_up(&lov->lov_lock);
+                        cfs_mutex_unlock(&lov->lov_lock);
                         RETURN(-ENOMEM);
                 }
 
@@ -596,13 +596,13 @@ static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
 
         OBD_ALLOC_PTR(tgt);
         if (!tgt) {
-                cfs_mutex_up(&lov->lov_lock);
+                cfs_mutex_unlock(&lov->lov_lock);
                 RETURN(-ENOMEM);
         }
 
         rc = lov_ost_pool_add(&lov->lov_packed, index, lov->lov_tgt_size);
         if (rc) {
-                cfs_mutex_up(&lov->lov_lock);
+                cfs_mutex_unlock(&lov->lov_lock);
                 OBD_FREE_PTR(tgt);
                 RETURN(rc);
         }
@@ -617,7 +617,7 @@ static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
         if (index >= lov->desc.ld_tgt_count)
                 lov->desc.ld_tgt_count = index + 1;
 
-        cfs_mutex_up(&lov->lov_lock);
+        cfs_mutex_unlock(&lov->lov_lock);
 
         CDEBUG(D_CONFIG, "idx=%d ltd_gen=%d ld_tgt_count=%d\n",
                 index, tgt->ltd_gen, lov->desc.ld_tgt_count);
@@ -806,7 +806,7 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
         lov->desc = *desc;
         lov->lov_tgt_size = 0;
 
-        cfs_sema_init(&lov->lov_lock, 1);
+        cfs_mutex_init(&lov->lov_lock);
         cfs_atomic_set(&lov->lov_refcount, 0);
         CFS_INIT_LIST_HEAD(&lov->lov_qos.lq_oss_list);
         cfs_init_rwsem(&lov->lov_qos.lq_rw_sem);
diff --git a/lustre/lov/lov_qos.c b/lustre/lov/lov_qos.c
index 9180373..23f6188 100644
--- a/lustre/lov/lov_qos.c
+++ b/lustre/lov/lov_qos.c
@@ -73,7 +73,7 @@ int qos_add_tgt(struct obd_device *obd, __u32 index)
         }
 
         cfs_down_write(&lov->lov_qos.lq_rw_sem);
-        cfs_mutex_down(&lov->lov_lock);
+        cfs_mutex_lock(&lov->lov_lock);
         cfs_list_for_each_entry(oss, &lov->lov_qos.lq_oss_list, lqo_oss_list) {
                 if (obd_uuid_equals(&oss->lqo_uuid,
                                     &exp->exp_connection->c_remote_uuid)) {
@@ -117,7 +117,7 @@ int qos_add_tgt(struct obd_device *obd, __u32 index)
                oss->lqo_ost_count);
 
 out:
-        cfs_mutex_up(&lov->lov_lock);
+        cfs_mutex_unlock(&lov->lov_lock);
         cfs_up_write(&lov->lov_qos.lq_rw_sem);
         RETURN(rc);
 }
diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c
index 54b16ae..3b88c88 100644
--- a/lustre/lvfs/fsfilt_ext3.c
+++ b/lustre/lvfs/fsfilt_ext3.c
@@ -1240,7 +1240,7 @@ int fsfilt_ext3_map_bm_inode_pages(struct inode *inode, struct page **page,
 int fsfilt_ext3_map_inode_pages(struct inode *inode, struct page **page,
                                 int pages, unsigned long *blocks,
                                 int *created, int create,
-                                cfs_semaphore_t *optional_sem)
+                                cfs_mutex_t *optional_mutex)
 {
         int rc;
 
@@ -1249,12 +1249,12 @@ int fsfilt_ext3_map_inode_pages(struct inode *inode, struct page **page,
                                                      blocks, created, create);
                 return rc;
         }
-        if (optional_sem != NULL)
-                cfs_down(optional_sem);
+        if (optional_mutex != NULL)
+                cfs_mutex_lock(optional_mutex);
         rc = fsfilt_ext3_map_bm_inode_pages(inode, page, pages, blocks,
                                             created, create);
-        if (optional_sem != NULL)
-                cfs_up(optional_sem);
+        if (optional_mutex != NULL)
+                cfs_mutex_unlock(optional_mutex);
 
         return rc;
 }
diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c
index 70ab89c..94ec111 100644
--- a/lustre/mds/mds_lov.c
+++ b/lustre/mds/mds_lov.c
@@ -255,7 +255,7 @@ int mds_lov_prepare_objids(struct obd_device *obd, struct lov_mds_md *lmm)
         }
 
 
-        cfs_mutex_down(&obd->obd_dev_sem);
+        cfs_mutex_lock(&obd->obd_dev_mutex);
         for (j = 0; j < count; j++) {
                 __u32 i = le32_to_cpu(data[j].l_ost_idx);
                 if (mds_lov_update_max_ost(&obd->u.mds, i)) {
@@ -263,7 +263,7 @@ int mds_lov_prepare_objids(struct obd_device *obd, struct lov_mds_md *lmm)
                         break;
                 }
         }
-        cfs_mutex_up(&obd->obd_dev_sem);
+        cfs_mutex_unlock(&obd->obd_dev_mutex);
 
         RETURN(rc);
 }
@@ -597,9 +597,9 @@ static int mds_lov_update_desc(struct obd_device *obd, int idx,
         CDEBUG(D_CONFIG, "updated lov_desc, tgt_count: %d - idx %d / uuid %s\n",
                mds->mds_lov_desc.ld_tgt_count, idx, uuid->uuid);
 
-        cfs_mutex_down(&obd->obd_dev_sem);
+        cfs_mutex_lock(&obd->obd_dev_mutex);
         rc = mds_lov_update_max_ost(mds, idx);
-        cfs_mutex_up(&obd->obd_dev_sem);
+        cfs_mutex_unlock(&obd->obd_dev_mutex);
         if (rc != 0)
                 GOTO(out, rc );
 
@@ -687,9 +687,9 @@ int mds_lov_connect(struct obd_device *obd, char * lov_name)
                 RETURN(-ENOTCONN);
         }
 
-        cfs_mutex_down(&obd->obd_dev_sem);
+        cfs_mutex_lock(&obd->obd_dev_mutex);
         rc = mds_lov_read_objids(obd);
-        cfs_mutex_up(&obd->obd_dev_sem);
+        cfs_mutex_unlock(&obd->obd_dev_mutex);
         if (rc) {
                 CERROR("cannot read %s: rc = %d\n", "lov_objids", rc);
                 GOTO(err_exit, rc);
diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c
index 1398f1e..59e1d44 100644
--- a/lustre/mdt/mdt_handler.c
+++ b/lustre/mdt/mdt_handler.c
@@ -4753,8 +4753,8 @@ static struct lu_object *mdt_object_alloc(const struct lu_env *env,
                 lu_object_init(o, h, d);
                 lu_object_add_top(h, o);
                 o->lo_ops = &mdt_obj_ops;
-                cfs_sema_init(&mo->mot_ioepoch_sem, 1);
-                cfs_sema_init(&mo->mot_lov_sem, 1);
+                cfs_mutex_init(&mo->mot_ioepoch_mutex);
+                cfs_mutex_init(&mo->mot_lov_mutex);
                 RETURN(o);
         } else
                 RETURN(NULL);
@@ -5159,7 +5159,7 @@ static int mdt_init_export(struct obd_export *exp)
 
         CFS_INIT_LIST_HEAD(&med->med_open_head);
         cfs_spin_lock_init(&med->med_open_lock);
-        cfs_sema_init(&med->med_idmap_sem, 1);
+        cfs_mutex_init(&med->med_idmap_mutex);
         med->med_idmap = NULL;
         cfs_spin_lock(&exp->exp_lock);
         exp->exp_connecting = 1;
diff --git a/lustre/mdt/mdt_idmap.c b/lustre/mdt/mdt_idmap.c
index 1d1005c..32d2e77 100644
--- a/lustre/mdt/mdt_idmap.c
+++ b/lustre/mdt/mdt_idmap.c
@@ -213,10 +213,10 @@ int mdt_init_idmap(struct mdt_thread_info *info)
         ENTRY;
 
         if (exp_connect_rmtclient(exp)) {
-                cfs_down(&med->med_idmap_sem);
+                cfs_mutex_lock(&med->med_idmap_mutex);
                 if (!med->med_idmap)
                         med->med_idmap = lustre_idmap_init();
-                cfs_up(&med->med_idmap_sem);
+                cfs_mutex_unlock(&med->med_idmap_mutex);
 
                 if (IS_ERR(med->med_idmap)) {
                         long err = PTR_ERR(med->med_idmap);
@@ -243,12 +243,12 @@ int mdt_init_idmap(struct mdt_thread_info *info)
 
 void mdt_cleanup_idmap(struct mdt_export_data *med)
 {
-        cfs_down(&med->med_idmap_sem);
+        cfs_mutex_lock(&med->med_idmap_mutex);
         if (med->med_idmap != NULL) {
                 lustre_idmap_fini(med->med_idmap);
                 med->med_idmap = NULL;
         }
-        cfs_up(&med->med_idmap_sem);
+        cfs_mutex_unlock(&med->med_idmap_mutex);
 }
 
 static inline void mdt_revoke_export_locks(struct obd_export *exp)
diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h
index 1317643..66f43b8 100644
--- a/lustre/mdt/mdt_internal.h
+++ b/lustre/mdt/mdt_internal.h
@@ -188,9 +188,9 @@ struct mdt_object {
         int                     mot_ioepoch_count;
         int                     mot_writecount;
         /* Lock to protect object's IO epoch. */
-        cfs_semaphore_t         mot_ioepoch_sem;
+        cfs_mutex_t             mot_ioepoch_mutex;
         /* Lock to protect create_data */
-        cfs_semaphore_t         mot_lov_sem;
+        cfs_mutex_t             mot_lov_mutex;
 };
 
 enum mdt_object_flags {
diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c
index 20281b8..4fd14e8 100644
--- a/lustre/mdt/mdt_open.c
+++ b/lustre/mdt/mdt_open.c
@@ -119,7 +119,7 @@ static int mdt_create_data(struct mdt_thread_info *info,
 
         ma->ma_need = MA_INODE | MA_LOV;
         ma->ma_valid = 0;
-        cfs_down(&o->mot_lov_sem);
+        cfs_mutex_lock(&o->mot_lov_mutex);
         if (!(o->mot_flags & MOF_LOV_CREATED)) {
                 rc = mdo_create_data(info->mti_env,
                                      p ? mdt_object_child(p) : NULL,
@@ -127,7 +127,7 @@ static int mdt_create_data(struct mdt_thread_info *info,
                 if (rc == 0 && ma->ma_valid & MA_LOV)
                         o->mot_flags |= MOF_LOV_CREATED;
         }
-        cfs_up(&o->mot_lov_sem);
+        cfs_mutex_unlock(&o->mot_lov_mutex);
         RETURN(rc);
 }
 
@@ -143,7 +143,7 @@ int mdt_object_is_som_enabled(struct mdt_object *mo)
 
 /**
  * Re-enable Size-on-MDS.
- * Call under ->mot_ioepoch_sem.
+ * Call under ->mot_ioepoch_mutex.
  */
 static void mdt_object_som_enable(struct mdt_object *mo, __u64 ioepoch)
 {
@@ -156,7 +156,7 @@ static void mdt_object_som_enable(struct mdt_object *mo, __u64 ioepoch)
 
 /**
  * Open the IOEpoch. It is allowed if @writecount is not negative.
- * The epoch and writecount handling is performed under the mot_ioepoch_sem.
+ * The epoch and writecount handling is performed under the mot_ioepoch_mutex.
  */
 int mdt_ioepoch_open(struct mdt_thread_info *info, struct mdt_object *o,
                      int created)
@@ -170,7 +170,7 @@ int mdt_ioepoch_open(struct mdt_thread_info *info, struct mdt_object *o,
             !S_ISREG(lu_object_attr(&o->mot_obj.mo_lu)))
                 RETURN(0);
 
-        cfs_down(&o->mot_ioepoch_sem);
+        cfs_mutex_lock(&o->mot_ioepoch_mutex);
         if (mdt_ioepoch_opened(o)) {
                 /* Epoch continues even if there is no writers yet. */
                 CDEBUG(D_INODE, "continue epoch "LPU64" for "DFID"\n",
@@ -197,7 +197,7 @@ int mdt_ioepoch_open(struct mdt_thread_info *info, struct mdt_object *o,
                 cancel = 1;
         }
         o->mot_ioepoch_count++;
-        cfs_up(&o->mot_ioepoch_sem);
+        cfs_mutex_unlock(&o->mot_ioepoch_mutex);
 
         /* Cancel Size-on-MDS attributes cached on clients for the open case.
          * In the truncate case, see mdt_reint_setattr(). */
@@ -216,7 +216,7 @@ int mdt_ioepoch_open(struct mdt_thread_info *info, struct mdt_object *o,
  * Update SOM on-disk attributes.
  * If enabling, write update inodes and lustre-ea with the proper IOEpoch,
  * mountid and attributes. If disabling, zero IOEpoch id in lustre-ea.
- * Call under ->mot_ioepoch_sem.
+ * Call under ->mot_ioepoch_mutex.
  */
 static int mdt_som_attr_set(struct mdt_thread_info *info,
                             struct mdt_object *obj, __u64 ioepoch, int enable)
@@ -263,7 +263,7 @@ static inline int mdt_ioepoch_close_on_eviction(struct mdt_thread_info *info,
 {
         int rc = 0;
 
-        cfs_down(&o->mot_ioepoch_sem);
+        cfs_mutex_lock(&o->mot_ioepoch_mutex);
         CDEBUG(D_INODE, "Eviction. Closing IOepoch "LPU64" on "DFID". "
                "Count %d\n", o->mot_ioepoch, PFID(mdt_object_fid(o)),
                o->mot_ioepoch_count);
@@ -276,7 +276,7 @@ static inline int mdt_ioepoch_close_on_eviction(struct mdt_thread_info *info,
                 rc = mdt_som_attr_set(info, o, o->mot_ioepoch, MDT_SOM_DISABLE);
                 mdt_object_som_enable(o, o->mot_ioepoch);
         }
-        cfs_up(&o->mot_ioepoch_sem);
+        cfs_mutex_unlock(&o->mot_ioepoch_mutex);
         RETURN(rc);
 }
 
@@ -291,7 +291,7 @@ static inline int mdt_ioepoch_close_on_replay(struct mdt_thread_info *info,
         int rc = MDT_IOEPOCH_CLOSED;
         ENTRY;
 
-        cfs_down(&o->mot_ioepoch_sem);
+        cfs_mutex_lock(&o->mot_ioepoch_mutex);
         CDEBUG(D_INODE, "Replay. Closing epoch "LPU64" on "DFID". Count %d\n",
                o->mot_ioepoch, PFID(mdt_object_fid(o)), o->mot_ioepoch_count);
         o->mot_ioepoch_count--;
@@ -303,7 +303,7 @@ static inline int mdt_ioepoch_close_on_replay(struct mdt_thread_info *info,
 
         if (!mdt_ioepoch_opened(o))
                 mdt_object_som_enable(o, info->mti_ioepoch->ioepoch);
-        cfs_up(&o->mot_ioepoch_sem);
+        cfs_mutex_unlock(&o->mot_ioepoch_mutex);
 
         RETURN(rc);
 }
@@ -332,7 +332,7 @@ static inline int mdt_ioepoch_close_reg(struct mdt_thread_info *info,
         la = &info->mti_attr.ma_attr;
         achange = (info->mti_ioepoch->flags & MF_SOM_CHANGE);
 
-        cfs_down(&o->mot_ioepoch_sem);
+        cfs_mutex_lock(&o->mot_ioepoch_mutex);
         o->mot_ioepoch_count--;
 
         tmp_ma = &info->mti_u.som.attr;
@@ -399,7 +399,7 @@ static inline int mdt_ioepoch_close_reg(struct mdt_thread_info *info,
                 mdt_object_som_enable(o, o->mot_ioepoch);
         }
 
-        cfs_up(&o->mot_ioepoch_sem);
+        cfs_mutex_unlock(&o->mot_ioepoch_mutex);
         /* If recovery is needed, tell the client to perform GETATTR under
          * the lock. */
         if (ret == MDT_IOEPOCH_GETATTR && recovery) {
@@ -411,7 +411,7 @@ static inline int mdt_ioepoch_close_reg(struct mdt_thread_info *info,
         RETURN(rc ? : ret);
 
 error_up:
-        cfs_up(&o->mot_ioepoch_sem);
+        cfs_mutex_unlock(&o->mot_ioepoch_mutex);
         return rc;
 }
 
@@ -480,7 +480,7 @@ int mdt_som_au_close(struct mdt_thread_info *info, struct mdt_object *o)
              !(info->mti_attr.ma_attr.la_valid & LA_SIZE)))
                 act = MDT_SOM_DISABLE;
 
-        cfs_down(&o->mot_ioepoch_sem);
+        cfs_mutex_lock(&o->mot_ioepoch_mutex);
         /* Mark the object it is the recovery state if we failed to obtain
          * SOM attributes. */
         if (act == MDT_SOM_DISABLE)
@@ -494,7 +494,7 @@ int mdt_som_au_close(struct mdt_thread_info *info, struct mdt_object *o)
                         rc = mdt_som_attr_set(info, o, ioepoch, act);
                 mdt_object_som_enable(o, ioepoch);
         }
-        cfs_up(&o->mot_ioepoch_sem);
+        cfs_mutex_unlock(&o->mot_ioepoch_mutex);
         RETURN(rc);
 }
 
@@ -502,9 +502,9 @@ int mdt_write_read(struct mdt_object *o)
 {
         int rc = 0;
         ENTRY;
-        cfs_down(&o->mot_ioepoch_sem);
+        cfs_mutex_lock(&o->mot_ioepoch_mutex);
         rc = o->mot_writecount;
-        cfs_up(&o->mot_ioepoch_sem);
+        cfs_mutex_unlock(&o->mot_ioepoch_mutex);
         RETURN(rc);
 }
 
@@ -512,21 +512,21 @@ int mdt_write_get(struct mdt_object *o)
 {
         int rc = 0;
         ENTRY;
-        cfs_down(&o->mot_ioepoch_sem);
+        cfs_mutex_lock(&o->mot_ioepoch_mutex);
         if (o->mot_writecount < 0)
                 rc = -ETXTBSY;
         else
                 o->mot_writecount++;
-        cfs_up(&o->mot_ioepoch_sem);
+        cfs_mutex_unlock(&o->mot_ioepoch_mutex);
         RETURN(rc);
 }
 
 void mdt_write_put(struct mdt_object *o)
 {
         ENTRY;
-        cfs_down(&o->mot_ioepoch_sem);
+        cfs_mutex_lock(&o->mot_ioepoch_mutex);
         o->mot_writecount--;
-        cfs_up(&o->mot_ioepoch_sem);
+        cfs_mutex_unlock(&o->mot_ioepoch_mutex);
         EXIT;
 }
 
@@ -534,21 +534,21 @@ static int mdt_write_deny(struct mdt_object *o)
 {
         int rc = 0;
         ENTRY;
-        cfs_down(&o->mot_ioepoch_sem);
+        cfs_mutex_lock(&o->mot_ioepoch_mutex);
         if (o->mot_writecount > 0)
                 rc = -ETXTBSY;
         else
                 o->mot_writecount--;
-        cfs_up(&o->mot_ioepoch_sem);
+        cfs_mutex_unlock(&o->mot_ioepoch_mutex);
         RETURN(rc);
 }
 
 static void mdt_write_allow(struct mdt_object *o)
 {
         ENTRY;
-        cfs_down(&o->mot_ioepoch_sem);
+        cfs_mutex_lock(&o->mot_ioepoch_mutex);
         o->mot_writecount++;
-        cfs_up(&o->mot_ioepoch_sem);
+        cfs_mutex_unlock(&o->mot_ioepoch_mutex);
         EXIT;
 }
 
diff --git a/lustre/mdt/mdt_recovery.c b/lustre/mdt/mdt_recovery.c
index 8ae3631..405eb26 100644
--- a/lustre/mdt/mdt_recovery.c
+++ b/lustre/mdt/mdt_recovery.c
@@ -565,7 +565,7 @@ int mdt_client_new(const struct lu_env *env, struct mdt_device *mdt)
         ted->ted_lr_idx = cl_idx;
         ted->ted_lr_off = lsd->lsd_client_start +
                           (cl_idx * lsd->lsd_client_size);
-        cfs_init_mutex(&ted->ted_lcd_lock);
+        cfs_mutex_init(&ted->ted_lcd_lock);
 
         LASSERTF(ted->ted_lr_off > 0, "ted_lr_off = %llu\n", ted->ted_lr_off);
 
@@ -649,7 +649,7 @@ int mdt_client_add(const struct lu_env *env,
         ted->ted_lr_idx = cl_idx;
         ted->ted_lr_off = lsd->lsd_client_start +
                           (cl_idx * lsd->lsd_client_size);
-        cfs_init_mutex(&ted->ted_lcd_lock);
+        cfs_mutex_init(&ted->ted_lcd_lock);
 
         LASSERTF(ted->ted_lr_off > 0, "ted_lr_off = %llu\n", ted->ted_lr_off);
 
@@ -714,10 +714,10 @@ int mdt_client_del(const struct lu_env *env, struct mdt_device *mdt)
         if (IS_ERR(th))
                 GOTO(free, rc = PTR_ERR(th));
 
-        cfs_mutex_down(&ted->ted_lcd_lock);
+        cfs_mutex_lock(&ted->ted_lcd_lock);
         memset(ted->ted_lcd->lcd_uuid, 0, sizeof ted->ted_lcd->lcd_uuid);
         rc = mdt_last_rcvd_write(env, mdt, ted->ted_lcd, &off, th);
-        cfs_mutex_up(&ted->ted_lcd_lock);
+        cfs_mutex_unlock(&ted->ted_lcd_lock);
         mdt_trans_stop(env, mdt, th);
 
         CDEBUG(rc == 0 ? D_INFO : D_ERROR, "Zeroing out client idx %u in "
@@ -748,12 +748,12 @@ static int mdt_last_rcvd_update(struct mdt_thread_info *mti,
         ted = &req->rq_export->exp_target_data;
         LASSERT(ted);
 
-        cfs_mutex_down(&ted->ted_lcd_lock);
+        cfs_mutex_lock(&ted->ted_lcd_lock);
         lcd = ted->ted_lcd;
         /* if the export has already been disconnected, we have no last_rcvd slot,
          * update server data with latest transno then */
         if (lcd == NULL) {
-                cfs_mutex_up(&ted->ted_lcd_lock);
+                cfs_mutex_unlock(&ted->ted_lcd_lock);
                 CWARN("commit transaction for disconnected client %s: rc %d\n",
                       req->rq_export->exp_client_uuid.uuid, rc);
                 err = mdt_last_rcvd_header_write(mti->mti_env, mdt, th);
@@ -776,7 +776,7 @@ static int mdt_last_rcvd_update(struct mdt_thread_info *mti,
                                         req->rq_export->exp_vbr_failed = 1;
                                         cfs_spin_unlock(&req->rq_export->exp_lock);
                                 }
-                                cfs_mutex_up(&ted->ted_lcd_lock);
+                                cfs_mutex_unlock(&ted->ted_lcd_lock);
                                 RETURN(req_is_replay(req) ? -EOVERFLOW : 0);
                         }
                         lcd->lcd_last_close_transno = mti->mti_transno;
@@ -804,7 +804,7 @@ static int mdt_last_rcvd_update(struct mdt_thread_info *mti,
                                         req->rq_export->exp_vbr_failed = 1;
                                         cfs_spin_unlock(&req->rq_export->exp_lock);
                                 }
-                                cfs_mutex_up(&ted->ted_lcd_lock);
+                                cfs_mutex_unlock(&ted->ted_lcd_lock);
                                 RETURN(req_is_replay(req) ? -EOVERFLOW : 0);
                         }
                         lcd->lcd_last_transno = mti->mti_transno;
@@ -823,7 +823,7 @@ static int mdt_last_rcvd_update(struct mdt_thread_info *mti,
         } else {
                 err = mdt_last_rcvd_write(mti->mti_env, mdt, lcd, &off, th);
         }
-        cfs_mutex_up(&ted->ted_lcd_lock);
+        cfs_mutex_unlock(&ted->ted_lcd_lock);
         RETURN(err);
 }
 
diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c
index a628354..173c760 100644
--- a/lustre/mgc/mgc_request.c
+++ b/lustre/mgc/mgc_request.c
@@ -351,7 +351,7 @@ static int config_log_add(struct obd_device *obd, char *logname,
         RETURN(0);
 }
 
-CFS_DECLARE_MUTEX(llog_process_lock);
+CFS_DEFINE_MUTEX(llog_process_lock);
 
 /** Stop watching for updates on this log.
  */
diff --git a/lustre/mgs/lproc_mgs.c b/lustre/mgs/lproc_mgs.c
index 673ab77..d0819ab 100644
--- a/lustre/mgs/lproc_mgs.c
+++ b/lustre/mgs/lproc_mgs.c
@@ -128,9 +128,9 @@ static int mgsself_srpc_seq_show(struct seq_file *seq, void *v)
         if (rc)
                 return rc;
 
-        cfs_down(&fsdb->fsdb_sem);
+        cfs_mutex_lock(&fsdb->fsdb_mutex);
         seq_show_srpc_rules(seq, fsdb->fsdb_name, &fsdb->fsdb_srpc_gen);
-        cfs_up(&fsdb->fsdb_sem);
+        cfs_mutex_unlock(&fsdb->fsdb_mutex);
         return 0;
 }
 
@@ -193,7 +193,7 @@ static int mgs_live_seq_show(struct seq_file *seq, void *v)
         struct mgs_tgt_srpc_conf *srpc_tgt;
         int i;
 
-        cfs_down(&fsdb->fsdb_sem);
+        cfs_mutex_lock(&fsdb->fsdb_mutex);
 
         seq_printf(seq, "fsname: %s\n", fsdb->fsdb_name);
         seq_printf(seq, "flags: %#lx     gen: %d\n",
@@ -219,7 +219,7 @@ static int mgs_live_seq_show(struct seq_file *seq, void *v)
 
         lprocfs_rd_ir_state(seq, fsdb);
 
-        cfs_up(&fsdb->fsdb_sem);
+        cfs_mutex_unlock(&fsdb->fsdb_mutex);
         return 0;
 }
 
diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c
index bb2705e..9075b01 100644
--- a/lustre/mgs/mgs_handler.c
+++ b/lustre/mgs/mgs_handler.c
@@ -228,7 +228,7 @@ static int mgs_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
 
         /* Internal mgs setup */
         mgs_init_fsdb_list(obd);
-        cfs_sema_init(&mgs->mgs_sem, 1);
+        cfs_mutex_init(&mgs->mgs_mutex);
         mgs->mgs_start_time = cfs_time_current_sec();
 
         /* Setup proc */
@@ -551,7 +551,7 @@ static int mgs_handle_target_reg(struct ptlrpc_request *req)
         }
 
         /*
-         * Log writing contention is handled by the fsdb_sem.
+         * Log writing contention is handled by the fsdb_mutex.
          *
          * It should be alright if someone was reading while we were
          * updating the logs - if we revoke at the end they will just update
@@ -692,7 +692,7 @@ static int mgs_connect_check_sptlrpc(struct ptlrpc_request *req)
                 if (rc)
                         return rc;
 
-                cfs_down(&fsdb->fsdb_sem);
+                cfs_mutex_lock(&fsdb->fsdb_mutex);
                 if (sptlrpc_rule_set_choose(&fsdb->fsdb_srpc_gen,
                                             LUSTRE_SP_MGC, LUSTRE_SP_MGS,
                                             req->rq_peer.nid,
@@ -700,7 +700,7 @@ static int mgs_connect_check_sptlrpc(struct ptlrpc_request *req)
                         /* by defualt allow any flavors */
                         flvr.sf_rpc = SPTLRPC_FLVR_ANY;
                 }
-                cfs_up(&fsdb->fsdb_sem);
+                cfs_mutex_unlock(&fsdb->fsdb_mutex);
 
                 cfs_spin_lock(&exp->exp_lock);
 
diff --git a/lustre/mgs/mgs_internal.h b/lustre/mgs/mgs_internal.h
index 6312f79..1595351 100644
--- a/lustre/mgs/mgs_internal.h
+++ b/lustre/mgs/mgs_internal.h
@@ -91,7 +91,7 @@ struct mgs_fsc {
          */
         cfs_list_t         mfc_export_list;
         /**
-         * list of fs clients in the same fsdb, protected by fsdb->fsdb_sem
+         * list of fs clients in the same fsdb, protected by fsdb->fsdb_mutex
          */
         cfs_list_t        mfc_fsdb_list;
         unsigned          mfc_ir_capable:1;
@@ -124,7 +124,7 @@ struct mgs_tgt_srpc_conf {
 struct fs_db {
         char              fsdb_name[9];
         cfs_list_t        fsdb_list;           /* list of databases */
-        cfs_semaphore_t   fsdb_sem;
+        cfs_mutex_t       fsdb_mutex;
         void             *fsdb_ost_index_map;  /* bitmap of used indicies */
         void             *fsdb_mdt_index_map;  /* bitmap of used indicies */
         int               fsdb_mdt_count;
@@ -142,7 +142,7 @@ struct fs_db {
         struct sptlrpc_rule_set   fsdb_srpc_gen;
         struct mgs_tgt_srpc_conf *fsdb_srpc_tgt;
 
-        /* list of fs clients, mgs_fsc. protected by mgs_sem */
+        /* list of fs clients, mgs_fsc. protected by mgs_mutex */
         cfs_list_t           fsdb_clients;
         int                  fsdb_nonir_clients;
         int                  fsdb_ir_state;
diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c
index 887341e..00ffd60 100644
--- a/lustre/mgs/mgs_llog.c
+++ b/lustre/mgs/mgs_llog.c
@@ -262,7 +262,7 @@ static int mgs_fsdb_handler(struct llog_handle *llh, struct llog_rec_hdr *rec,
         RETURN(rc);
 }
 
-/* fsdb->fsdb_sem is already held  in mgs_find_or_make_fsdb*/
+/* fsdb->fsdb_mutex is already held  in mgs_find_or_make_fsdb*/
 static int mgs_get_fsdb_from_llog(struct obd_device *obd, struct fs_db *fsdb)
 {
         char *logname;
@@ -276,7 +276,7 @@ static int mgs_get_fsdb_from_llog(struct obd_device *obd, struct fs_db *fsdb)
         ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
         LASSERT(ctxt != NULL);
         name_create(&logname, fsdb->fsdb_name, "-client");
-        cfs_down(&fsdb->fsdb_sem);
+        cfs_mutex_lock(&fsdb->fsdb_mutex);
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         rc = llog_create(ctxt, &loghandle, NULL, logname);
         if (rc)
@@ -297,7 +297,7 @@ out_close:
                 rc = rc2;
 out_pop:
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-        cfs_up(&fsdb->fsdb_sem);
+        cfs_mutex_unlock(&fsdb->fsdb_mutex);
         name_destroy(&logname);
         llog_ctxt_put(ctxt);
 
@@ -356,7 +356,7 @@ static struct fs_db *mgs_new_fsdb(struct obd_device *obd, char *fsname)
                 RETURN(NULL);
 
         strcpy(fsdb->fsdb_name, fsname);
-        cfs_sema_init(&fsdb->fsdb_sem, 1);
+        cfs_mutex_init(&fsdb->fsdb_mutex);
         cfs_set_bit(FSDB_UDESC, &fsdb->fsdb_flags);
 
         if (strcmp(fsname, MGSSELF_NAME) == 0) {
@@ -407,7 +407,7 @@ err:
 static void mgs_free_fsdb(struct obd_device *obd, struct fs_db *fsdb)
 {
         /* wait for anyone with the sem */
-        cfs_down(&fsdb->fsdb_sem);
+        cfs_mutex_lock(&fsdb->fsdb_mutex);
         lproc_mgs_del_live(obd, fsdb);
         cfs_list_del(&fsdb->fsdb_list);
 
@@ -424,6 +424,7 @@ static void mgs_free_fsdb(struct obd_device *obd, struct fs_db *fsdb)
         name_destroy(&fsdb->fsdb_mdtlmv);
         name_destroy(&fsdb->fsdb_mdc);
         mgs_free_fsdb_srpc(fsdb);
+        cfs_mutex_unlock(&fsdb->fsdb_mutex);
         OBD_FREE_PTR(fsdb);
 }
 
@@ -439,12 +440,12 @@ int mgs_cleanup_fsdb_list(struct obd_device *obd)
         struct mgs_obd *mgs = &obd->u.mgs;
         struct fs_db *fsdb;
         cfs_list_t *tmp, *tmp2;
-        cfs_down(&mgs->mgs_sem);
+        cfs_mutex_lock(&mgs->mgs_mutex);
         cfs_list_for_each_safe(tmp, tmp2, &mgs->mgs_fs_db_list) {
                 fsdb = cfs_list_entry(tmp, struct fs_db, fsdb_list);
                 mgs_free_fsdb(obd, fsdb);
         }
-        cfs_up(&mgs->mgs_sem);
+        cfs_mutex_unlock(&mgs->mgs_mutex);
         return 0;
 }
 
@@ -455,17 +456,17 @@ int mgs_find_or_make_fsdb(struct obd_device *obd, char *name,
         struct fs_db *fsdb;
         int rc = 0;
 
-        cfs_down(&mgs->mgs_sem);
+        cfs_mutex_lock(&mgs->mgs_mutex);
         fsdb = mgs_find_fsdb(obd, name);
         if (fsdb) {
-                cfs_up(&mgs->mgs_sem);
+                cfs_mutex_unlock(&mgs->mgs_mutex);
                 *dbh = fsdb;
                 return 0;
         }
 
         CDEBUG(D_MGS, "Creating new db\n");
         fsdb = mgs_new_fsdb(obd, name);
-        cfs_up(&mgs->mgs_sem);
+        cfs_mutex_unlock(&mgs->mgs_mutex);
         if (!fsdb)
                 return -ENOMEM;
 
@@ -1236,7 +1237,7 @@ static int mgs_steal_llog_handler(struct llog_handle *llh,
         RETURN(rc);
 }
 
-/* fsdb->fsdb_sem is already held  in mgs_write_log_target*/
+/* fsdb->fsdb_mutex is already held  in mgs_write_log_target*/
 /* stealed from mgs_get_fsdb_from_llog*/
 static int mgs_steal_llog_for_mdt_from_client(struct obd_device *obd,
                                               char *client_name,
@@ -2694,9 +2695,9 @@ int mgs_check_failnid(struct obd_device *obd, struct mgs_target_info *mti)
            the failover list.  Modify mti->params for rewriting back at
            server_register_target(). */
 
-        cfs_down(&fsdb->fsdb_sem);
+        cfs_mutex_lock(&fsdb->fsdb_mutex);
         rc = mgs_write_log_add_failnid(obd, fsdb, mti);
-        cfs_up(&fsdb->fsdb_sem);
+        cfs_mutex_unlock(&fsdb->fsdb_mutex);
 
         RETURN(rc);
 #endif
@@ -2751,7 +2752,7 @@ int mgs_write_log_target(struct obd_device *obd,
                 }
         }
 
-        cfs_down(&fsdb->fsdb_sem);
+        cfs_mutex_lock(&fsdb->fsdb_mutex);
 
         if (mti->mti_flags &
             (LDD_F_VIRGIN | LDD_F_UPGRADE14 | LDD_F_WRITECONF)) {
@@ -2800,7 +2801,7 @@ int mgs_write_log_target(struct obd_device *obd,
         OBD_FREE(buf, strlen(mti->mti_params) + 1);
 
 out_up:
-        cfs_up(&fsdb->fsdb_sem);
+        cfs_mutex_unlock(&fsdb->fsdb_mutex);
         RETURN(rc);
 }
 
@@ -2916,7 +2917,7 @@ int mgs_erase_logs(struct obd_device *obd, char *fsname)
                 RETURN(rc);
         }
 
-        cfs_down(&mgs->mgs_sem);
+        cfs_mutex_lock(&mgs->mgs_mutex);
 
         /* Delete the fs db */
         fsdb = mgs_find_fsdb(obd, fsname);
@@ -2937,7 +2938,7 @@ int mgs_erase_logs(struct obd_device *obd, char *fsname)
                 OBD_FREE(dirent, sizeof(*dirent));
         }
 
-        cfs_up(&mgs->mgs_sem);
+        cfs_mutex_unlock(&mgs->mgs_mutex);
 
         RETURN(rc);
 }
@@ -3046,9 +3047,9 @@ int mgs_setparam(struct obd_device *obd, struct lustre_cfg *lcfg, char *fsname)
 
         mti->mti_flags = rc | LDD_F_PARAM;
 
-        cfs_down(&fsdb->fsdb_sem);
+        cfs_mutex_lock(&fsdb->fsdb_mutex);
         rc = mgs_write_log_param(obd, fsdb, mti, mti->mti_params);
-        cfs_up(&fsdb->fsdb_sem);
+        cfs_mutex_unlock(&fsdb->fsdb_mutex);
 
         /*
          * Revoke lock so everyone updates.  Should be alright if
@@ -3158,7 +3159,7 @@ int mgs_pool_cmd(struct obd_device *obd, enum lcfg_command_type cmd,
         }
         }
 
-        cfs_down(&fsdb->fsdb_sem);
+        cfs_mutex_lock(&fsdb->fsdb_mutex);
 
         if (canceled_label != NULL) {
                 OBD_ALLOC_PTR(mti);
@@ -3194,7 +3195,7 @@ int mgs_pool_cmd(struct obd_device *obd, enum lcfg_command_type cmd,
                            cmd, fsname, poolname, ostname, label);
         name_destroy(&logname);
 
-        cfs_up(&fsdb->fsdb_sem);
+        cfs_mutex_unlock(&fsdb->fsdb_mutex);
         /* request for update */
         mgs_revoke_lock(obd, fsdb, CONFIG_T_CONFIG);
 
diff --git a/lustre/mgs/mgs_nids.c b/lustre/mgs/mgs_nids.c
index b49789e..91ecabf 100644
--- a/lustre/mgs/mgs_nids.c
+++ b/lustre/mgs/mgs_nids.c
@@ -487,7 +487,7 @@ void mgs_ir_fini_fs(struct obd_device *obd, struct fs_db *fsdb)
         cfs_wait_for_completion(&fsdb->fsdb_notify_comp);
 }
 
-/* caller must have held fsdb_sem */
+/* caller must have held fsdb_mutex */
 static inline void ir_state_graduate(struct fs_db *fsdb)
 {
         struct mgs_obd *mgs = &fsdb->fsdb_obd->u.mgs;
@@ -520,7 +520,7 @@ int mgs_ir_update(struct obd_device *obd, struct mgs_target_info *mti)
                 return rc;
 
         /* check ir state */
-        cfs_down(&fsdb->fsdb_sem);
+        cfs_mutex_lock(&fsdb->fsdb_mutex);
         ir_state_graduate(fsdb);
         switch (fsdb->fsdb_ir_state) {
         case IR_FULL:
@@ -534,7 +534,7 @@ int mgs_ir_update(struct obd_device *obd, struct mgs_target_info *mti)
         default:
                 LBUG();
         }
-        cfs_up(&fsdb->fsdb_sem);
+        cfs_mutex_unlock(&fsdb->fsdb_mutex);
 
         LASSERT(ergo(mti->mti_flags & LDD_F_IR_CAPABLE, notify));
         if (notify) {
@@ -692,11 +692,11 @@ static int lprocfs_ir_set_state(struct fs_db *fsdb, const char *buf)
 
         CDEBUG(D_MGS, "change fsr state of %s from %s to %s\n",
                fsdb->fsdb_name, strings[fsdb->fsdb_ir_state], strings[state]);
-        cfs_down(&fsdb->fsdb_sem);
+        cfs_mutex_lock(&fsdb->fsdb_mutex);
         if (state == IR_FULL && fsdb->fsdb_nonir_clients)
                 state = IR_PARTIAL;
         fsdb->fsdb_ir_state = state;
-        cfs_up(&fsdb->fsdb_sem);
+        cfs_mutex_unlock(&fsdb->fsdb_mutex);
 
         return 0;
 }
@@ -793,7 +793,7 @@ int lprocfs_rd_ir_state(struct seq_file *seq, void *data)
         struct timeval     tv_max;
         struct timeval     tv;
 
-        /* mgs_live_seq_show() already holds fsdb_sem. */
+        /* mgs_live_seq_show() already holds fsdb_mutex. */
         ir_state_graduate(fsdb);
 
         seq_printf(seq, "\nimperative_recovery_state:\n");
@@ -860,7 +860,7 @@ int mgs_fsc_attach(struct obd_export *exp, char *fsname)
                         !!(exp->exp_connect_flags & OBD_CONNECT_IMP_RECOV);
 
         rc = -EEXIST;
-        cfs_down(&fsdb->fsdb_sem);
+        cfs_mutex_lock(&fsdb->fsdb_mutex);
 
         /* tend to find it in export list because this list is shorter. */
         cfs_spin_lock(&data->med_lock);
@@ -887,7 +887,7 @@ int mgs_fsc_attach(struct obd_export *exp, char *fsname)
                 rc = 0;
         }
         cfs_spin_unlock(&data->med_lock);
-        cfs_up(&fsdb->fsdb_sem);
+        cfs_mutex_unlock(&fsdb->fsdb_mutex);
 
         if (new_fsc) {
                 class_export_put(new_fsc->mfc_export);
@@ -911,7 +911,7 @@ void mgs_fsc_cleanup(struct obd_export *exp)
 
                 LASSERT(fsc->mfc_export == exp);
 
-                cfs_down(&fsdb->fsdb_sem);
+                cfs_mutex_lock(&fsdb->fsdb_mutex);
                 cfs_list_del_init(&fsc->mfc_fsdb_list);
                 if (fsc->mfc_ir_capable == 0) {
                         --fsdb->fsdb_nonir_clients;
@@ -920,14 +920,14 @@ void mgs_fsc_cleanup(struct obd_export *exp)
                             fsdb->fsdb_ir_state == IR_PARTIAL)
                                 fsdb->fsdb_ir_state = IR_FULL;
                 }
-                cfs_up(&fsdb->fsdb_sem);
+                cfs_mutex_unlock(&fsdb->fsdb_mutex);
                 cfs_list_del_init(&fsc->mfc_export_list);
                 class_export_put(fsc->mfc_export);
                 OBD_FREE_PTR(fsc);
         }
 }
 
-/* must be called with fsdb->fsdb_sem held */
+/* must be called with fsdb->fsdb_mutex held */
 void mgs_fsc_cleanup_by_fsdb(struct fs_db *fsdb)
 {
         struct mgs_fsc *fsc, *tmp;
diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c
index e44da95..23148f5 100644
--- a/lustre/obdclass/genops.c
+++ b/lustre/obdclass/genops.c
@@ -996,7 +996,7 @@ struct obd_import *class_new_import(struct obd_device *obd)
         imp->imp_last_success_conn = 0;
         imp->imp_state = LUSTRE_IMP_NEW;
         imp->imp_obd = class_incref(obd, "import", imp);
-        cfs_sema_init(&imp->imp_sec_mutex, 1);
+        cfs_mutex_init(&imp->imp_sec_mutex);
         cfs_waitq_init(&imp->imp_recovery_waitq);
 
         cfs_atomic_set(&imp->imp_refcount, 2);
diff --git a/lustre/obdclass/llog_ioctl.c b/lustre/obdclass/llog_ioctl.c
index 3cc0700..e8f9746 100644
--- a/lustre/obdclass/llog_ioctl.c
+++ b/lustre/obdclass/llog_ioctl.c
@@ -437,7 +437,7 @@ int llog_catalog_list(struct obd_device *obd, int count,
         if (!idarray)
                 RETURN(-ENOMEM);
 
-        cfs_mutex_down(&obd->obd_olg.olg_cat_processing);
+        cfs_mutex_lock(&obd->obd_olg.olg_cat_processing);
         rc = llog_get_cat_list(obd, name, 0, count, idarray);
         if (rc)
                 GOTO(out, rc);
@@ -458,7 +458,7 @@ int llog_catalog_list(struct obd_device *obd, int count,
         }
 out:
         /* release semaphore */
-        cfs_mutex_up(&obd->obd_olg.olg_cat_processing);
+        cfs_mutex_unlock(&obd->obd_olg.olg_cat_processing);
 
         OBD_FREE_LARGE(idarray, size);
         RETURN(rc);
diff --git a/lustre/obdclass/llog_obd.c b/lustre/obdclass/llog_obd.c
index 1c8eccf..cb10340 100644
--- a/lustre/obdclass/llog_obd.c
+++ b/lustre/obdclass/llog_obd.c
@@ -177,7 +177,7 @@ int llog_setup_named(struct obd_device *obd,  struct obd_llog_group *olg,
         ctxt->loc_olg = olg;
         ctxt->loc_idx = index;
         ctxt->loc_logops = op;
-        cfs_sema_init(&ctxt->loc_sem, 1);
+        cfs_mutex_init(&ctxt->loc_mutex);
         ctxt->loc_exp = class_export_get(disk_obd->obd_self_export);
         ctxt->loc_flags = LLOG_CTXT_FLAG_UNINITIALIZED;
 
diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c
index c7bedec..f98aaea 100644
--- a/lustre/obdclass/lu_object.c
+++ b/lustre/obdclass/lu_object.c
@@ -737,7 +737,7 @@ EXPORT_SYMBOL(lu_types_stop);
  * Global list of all sites on this node
  */
 static CFS_LIST_HEAD(lu_sites);
-static CFS_DECLARE_MUTEX(lu_sites_guard);
+static CFS_DEFINE_MUTEX(lu_sites_guard);
 
 /**
  * Global environment used by site shrinker.
@@ -980,9 +980,9 @@ EXPORT_SYMBOL(lu_site_init);
  */
 void lu_site_fini(struct lu_site *s)
 {
-        cfs_down(&lu_sites_guard);
+        cfs_mutex_lock(&lu_sites_guard);
         cfs_list_del_init(&s->ls_linkage);
-        cfs_up(&lu_sites_guard);
+        cfs_mutex_unlock(&lu_sites_guard);
 
         if (s->ls_obj_hash != NULL) {
                 cfs_hash_putref(s->ls_obj_hash);
@@ -1007,11 +1007,11 @@ EXPORT_SYMBOL(lu_site_fini);
 int lu_site_init_finish(struct lu_site *s)
 {
         int result;
-        cfs_down(&lu_sites_guard);
+        cfs_mutex_lock(&lu_sites_guard);
         result = lu_context_refill(&lu_shrink_env.le_ctx);
         if (result == 0)
                 cfs_list_add(&s->ls_linkage, &lu_sites);
-        cfs_up(&lu_sites_guard);
+        cfs_mutex_unlock(&lu_sites_guard);
         return result;
 }
 EXPORT_SYMBOL(lu_site_init_finish);
@@ -1691,7 +1691,7 @@ static int lu_cache_shrink(SHRINKER_ARGS(sc, nr_to_scan, gfp_mask))
                 CDEBUG(D_INODE, "Shrink %d objects\n", remain);
         }
 
-        cfs_down(&lu_sites_guard);
+        cfs_mutex_lock(&lu_sites_guard);
         cfs_list_for_each_entry_safe(s, tmp, &lu_sites, ls_linkage) {
                 if (shrink_param(sc, nr_to_scan) != 0) {
                         remain = lu_site_purge(&lu_shrink_env, s, remain);
@@ -1709,7 +1709,7 @@ static int lu_cache_shrink(SHRINKER_ARGS(sc, nr_to_scan, gfp_mask))
                         break;
         }
         cfs_list_splice(&splice, lu_sites.prev);
-        cfs_up(&lu_sites_guard);
+        cfs_mutex_unlock(&lu_sites_guard);
 
         cached = (cached / 100) * sysctl_vfs_cache_pressure;
         if (shrink_param(sc, nr_to_scan) == 0)
@@ -1805,9 +1805,9 @@ int lu_global_init(void)
          * conservatively. This should not be too bad, because this
          * environment is global.
          */
-        cfs_down(&lu_sites_guard);
+        cfs_mutex_lock(&lu_sites_guard);
         result = lu_env_init(&lu_shrink_env, LCT_SHRINKER);
-        cfs_up(&lu_sites_guard);
+        cfs_mutex_unlock(&lu_sites_guard);
         if (result != 0)
                 return result;
 
@@ -1861,9 +1861,9 @@ void lu_global_fini(void)
          * Tear shrinker environment down _after_ de-registering
          * lu_global_key, because the latter has a value in the former.
          */
-        cfs_down(&lu_sites_guard);
+        cfs_mutex_lock(&lu_sites_guard);
         lu_env_fini(&lu_shrink_env);
-        cfs_up(&lu_sites_guard);
+        cfs_mutex_unlock(&lu_sites_guard);
 
         lu_ref_global_fini();
 }
diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c
index f9fa331..86dccec 100644
--- a/lustre/obdclass/obd_config.c
+++ b/lustre/obdclass/obd_config.c
@@ -346,7 +346,7 @@ int class_attach(struct lustre_cfg *lcfg)
         CFS_INIT_LIST_HEAD(&obd->obd_nid_stats);
         cfs_spin_lock_init(&obd->obd_nid_lock);
         cfs_spin_lock_init(&obd->obd_dev_lock);
-        cfs_sema_init(&obd->obd_dev_sem, 1);
+        cfs_mutex_init(&obd->obd_dev_mutex);
         cfs_spin_lock_init(&obd->obd_osfs_lock);
         /* obd->obd_osfs_age must be set to a value in the distant
          * past to guarantee a fresh statfs is fetched on mount. */
diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c
index 6e18246..caac96a 100644
--- a/lustre/obdclass/obd_mount.c
+++ b/lustre/obdclass/obd_mount.c
@@ -65,7 +65,7 @@ static void (*kill_super_cb)(struct super_block *sb) = NULL;
 
 /*********** mount lookup *********/
 
-CFS_DECLARE_MUTEX(lustre_mount_info_lock);
+CFS_DEFINE_MUTEX(lustre_mount_info_lock);
 static CFS_LIST_HEAD(server_mount_info_list);
 
 static struct lustre_mount_info *server_find_mount(const char *name)
@@ -106,10 +106,10 @@ static int server_register_mount(const char *name, struct super_block *sb,
         }
         strcpy(name_cp, name);
 
-        cfs_down(&lustre_mount_info_lock);
+        cfs_mutex_lock(&lustre_mount_info_lock);
 
         if (server_find_mount(name)) {
-                cfs_up(&lustre_mount_info_lock);
+                cfs_mutex_unlock(&lustre_mount_info_lock);
                 OBD_FREE(lmi, sizeof(*lmi));
                 OBD_FREE(name_cp, strlen(name) + 1);
                 CERROR("Already registered %s\n", name);
@@ -120,7 +120,7 @@ static int server_register_mount(const char *name, struct super_block *sb,
         lmi->lmi_mnt = mnt;
         cfs_list_add(&lmi->lmi_list_chain, &server_mount_info_list);
 
-        cfs_up(&lustre_mount_info_lock);
+        cfs_mutex_unlock(&lustre_mount_info_lock);
 
         CDEBUG(D_MOUNT, "reg_mnt %p from %s, vfscount=%d\n",
                lmi->lmi_mnt, name, cfs_atomic_read(&lmi->lmi_mnt->mnt_count));
@@ -134,10 +134,10 @@ static int server_deregister_mount(const char *name)
         struct lustre_mount_info *lmi;
         ENTRY;
 
-        cfs_down(&lustre_mount_info_lock);
+        cfs_mutex_lock(&lustre_mount_info_lock);
         lmi = server_find_mount(name);
         if (!lmi) {
-                cfs_up(&lustre_mount_info_lock);
+                cfs_mutex_unlock(&lustre_mount_info_lock);
                 CERROR("%s not registered\n", name);
                 RETURN(-ENOENT);
         }
@@ -148,7 +148,7 @@ static int server_deregister_mount(const char *name)
         OBD_FREE(lmi->lmi_name, strlen(lmi->lmi_name) + 1);
         cfs_list_del(&lmi->lmi_list_chain);
         OBD_FREE(lmi, sizeof(*lmi));
-        cfs_up(&lustre_mount_info_lock);
+        cfs_mutex_unlock(&lustre_mount_info_lock);
 
         RETURN(0);
 }
@@ -162,9 +162,9 @@ struct lustre_mount_info *server_get_mount(const char *name)
         struct lustre_sb_info *lsi;
         ENTRY;
 
-        cfs_down(&lustre_mount_info_lock);
+        cfs_mutex_lock(&lustre_mount_info_lock);
         lmi = server_find_mount(name);
-        cfs_up(&lustre_mount_info_lock);
+        cfs_mutex_unlock(&lustre_mount_info_lock);
         if (!lmi) {
                 CERROR("Can't find mount for %s\n", name);
                 RETURN(NULL);
@@ -190,9 +190,9 @@ struct lustre_mount_info *server_get_mount_2(const char *name)
         struct lustre_mount_info *lmi;
         ENTRY;
 
-        cfs_down(&lustre_mount_info_lock);
+        cfs_mutex_lock(&lustre_mount_info_lock);
         lmi = server_find_mount(name);
-        cfs_up(&lustre_mount_info_lock);
+        cfs_mutex_unlock(&lustre_mount_info_lock);
         if (!lmi)
                 CERROR("Can't find mount for %s\n", name);
 
@@ -223,9 +223,9 @@ int server_put_mount(const char *name, struct vfsmount *mnt)
         /* This might be the last one, can't deref after this */
         unlock_mntput(mnt);
 
-        cfs_down(&lustre_mount_info_lock);
+        cfs_mutex_lock(&lustre_mount_info_lock);
         lmi = server_find_mount(name);
-        cfs_up(&lustre_mount_info_lock);
+        cfs_mutex_unlock(&lustre_mount_info_lock);
         if (!lmi) {
                 CERROR("Can't find mount for %s\n", name);
                 RETURN(-ENOENT);
@@ -581,7 +581,7 @@ static int server_stop_mgs(struct super_block *sb)
         RETURN(rc);
 }
 
-CFS_DECLARE_MUTEX(mgc_start_lock);
+CFS_DEFINE_MUTEX(mgc_start_lock);
 
 /** Set up a mgc obd to process startup logs
  *
@@ -634,7 +634,7 @@ static int lustre_start_mgc(struct super_block *sb)
                 RETURN(-EINVAL);
         }
 
-        cfs_mutex_down(&mgc_start_lock);
+        cfs_mutex_lock(&mgc_start_lock);
 
         len = strlen(LUSTRE_MGC_OBDNAME) + strlen(libcfs_nid2str(nid)) + 1;
         OBD_ALLOC(mgcname, len);
@@ -835,7 +835,7 @@ out:
            to the same mgc.*/
         lsi->lsi_mgc = obd;
 out_free:
-        cfs_mutex_up(&mgc_start_lock);
+        cfs_mutex_unlock(&mgc_start_lock);
 
         if (data)
                 OBD_FREE_PTR(data);
@@ -861,7 +861,7 @@ static int lustre_stop_mgc(struct super_block *sb)
                 RETURN(-ENOENT);
         lsi->lsi_mgc = NULL;
 
-        cfs_mutex_down(&mgc_start_lock);
+        cfs_mutex_lock(&mgc_start_lock);
         LASSERT(cfs_atomic_read(&obd->u.cli.cl_mgc_refcount) > 0);
         if (!cfs_atomic_dec_and_test(&obd->u.cli.cl_mgc_refcount)) {
                 /* This is not fatal, every client that stops
@@ -913,7 +913,7 @@ out:
                 OBD_FREE(niduuid, len);
 
         /* class_import_put will get rid of the additional connections */
-        cfs_mutex_up(&mgc_start_lock);
+        cfs_mutex_unlock(&mgc_start_lock);
         RETURN(rc);
 }
 
@@ -951,7 +951,7 @@ static int server_mgc_clear_fs(struct obd_device *mgc)
         RETURN(rc);
 }
 
-CFS_DECLARE_MUTEX(server_start_lock);
+CFS_DEFINE_MUTEX(server_start_lock);
 
 /* Stop MDS/OSS if nobody is using them */
 static int server_stop_servers(int lddflags, int lsiflags)
@@ -961,7 +961,7 @@ static int server_stop_servers(int lddflags, int lsiflags)
         int rc = 0;
         ENTRY;
 
-        cfs_mutex_down(&server_start_lock);
+        cfs_mutex_lock(&server_start_lock);
 
         /* Either an MDT or an OST or neither  */
         /* if this was an MDT, and there are no more MDT's, clean up the MDS */
@@ -985,7 +985,7 @@ static int server_stop_servers(int lddflags, int lsiflags)
                         rc = err;
         }
 
-        cfs_mutex_up(&server_start_lock);
+        cfs_mutex_unlock(&server_start_lock);
 
         RETURN(rc);
 }
@@ -1209,7 +1209,7 @@ static int server_start_targets(struct super_block *sb, struct vfsmount *mnt)
         /* If we're an MDT, make sure the global MDS is running */
         if (lsi->lsi_ldd->ldd_flags & LDD_F_SV_TYPE_MDT) {
                 /* make sure the MDS is started */
-                cfs_mutex_down(&server_start_lock);
+                cfs_mutex_lock(&server_start_lock);
                 obd = class_name2obd(LUSTRE_MDS_OBDNAME);
                 if (!obd) {
                         rc = lustre_start_simple(LUSTRE_MDS_OBDNAME,
@@ -1218,19 +1218,19 @@ static int server_start_targets(struct super_block *sb, struct vfsmount *mnt)
                                                  LUSTRE_MDS_OBDNAME"_uuid",
                                                  0, 0);
                         if (rc) {
-                                cfs_mutex_up(&server_start_lock);
+                                cfs_mutex_unlock(&server_start_lock);
                                 CERROR("failed to start MDS: %d\n", rc);
                                 RETURN(rc);
                         }
                 }
-                cfs_mutex_up(&server_start_lock);
+                cfs_mutex_unlock(&server_start_lock);
         }
 #endif
 
         /* If we're an OST, make sure the global OSS is running */
         if (IS_OST(lsi->lsi_ldd)) {
                 /* make sure OSS is started */
-                cfs_mutex_down(&server_start_lock);
+                cfs_mutex_lock(&server_start_lock);
                 obd = class_name2obd(LUSTRE_OSS_OBDNAME);
                 if (!obd) {
                         rc = lustre_start_simple(LUSTRE_OSS_OBDNAME,
@@ -1238,12 +1238,12 @@ static int server_start_targets(struct super_block *sb, struct vfsmount *mnt)
                                                  LUSTRE_OSS_OBDNAME"_uuid",
                                                  0, 0);
                         if (rc) {
-                                cfs_mutex_up(&server_start_lock);
+                                cfs_mutex_unlock(&server_start_lock);
                                 CERROR("failed to start OSS: %d\n", rc);
                                 RETURN(rc);
                         }
                 }
-                cfs_mutex_up(&server_start_lock);
+                cfs_mutex_unlock(&server_start_lock);
         }
 
         /* Set the mgc fs to our server disk.  This allows the MGC to
diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c
index 31f4cbe..53c7c1f 100644
--- a/lustre/obdfilter/filter.c
+++ b/lustre/obdfilter/filter.c
@@ -138,12 +138,12 @@ int filter_finish_transno(struct obd_export *exp, struct inode *inode,
         if (!exp->exp_obd->obd_replayable || oti == NULL)
                 RETURN(rc);
 
-        cfs_mutex_down(&ted->ted_lcd_lock);
+        cfs_mutex_lock(&ted->ted_lcd_lock);
         lcd = ted->ted_lcd;
         /* if the export has already been disconnected, we have no last_rcvd slot,
          * update server data with latest transno then */
         if (lcd == NULL) {
-                cfs_mutex_up(&ted->ted_lcd_lock);
+                cfs_mutex_unlock(&ted->ted_lcd_lock);
                 CWARN("commit transaction for disconnected client %s: rc %d\n",
                       exp->exp_client_uuid.uuid, rc);
                 err = filter_update_server_data(exp->exp_obd);
@@ -168,7 +168,7 @@ int filter_finish_transno(struct obd_export *exp, struct inode *inode,
                         exp->exp_vbr_failed = 1;
                         cfs_spin_unlock(&exp->exp_lock);
                         cfs_spin_unlock(&obt->obt_lut->lut_translock);
-                        cfs_mutex_up(&ted->ted_lcd_lock);
+                        cfs_mutex_unlock(&ted->ted_lcd_lock);
                         RETURN(-EOVERFLOW);
                 }
         }
@@ -210,7 +210,7 @@ int filter_finish_transno(struct obd_export *exp, struct inode *inode,
 
         CDEBUG(log_pri, "wrote trans "LPU64" for client %s at #%d: err = %d\n",
                last_rcvd, lcd->lcd_uuid, ted->ted_lr_idx, err);
-        cfs_mutex_up(&ted->ted_lcd_lock);
+        cfs_mutex_unlock(&ted->ted_lcd_lock);
         RETURN(rc);
 }
 
@@ -355,7 +355,7 @@ static int filter_client_add(struct obd_device *obd, struct obd_export *exp,
         ted->ted_lr_idx = cl_idx;
         ted->ted_lr_off = le32_to_cpu(lsd->lsd_client_start) +
                           cl_idx * le16_to_cpu(lsd->lsd_client_size);
-        cfs_init_mutex(&ted->ted_lcd_lock);
+        cfs_mutex_init(&ted->ted_lcd_lock);
         LASSERTF(ted->ted_lr_off > 0, "ted_lr_off = %llu\n", ted->ted_lr_off);
 
         CDEBUG(D_INFO, "client at index %d (%llu) with UUID '%s' added\n",
@@ -456,12 +456,12 @@ static int filter_client_del(struct obd_export *exp)
          * be in server data or in client data in case of failure */
         filter_update_server_data(exp->exp_obd);
 
-        cfs_mutex_down(&ted->ted_lcd_lock);
+        cfs_mutex_lock(&ted->ted_lcd_lock);
         memset(ted->ted_lcd->lcd_uuid, 0, sizeof ted->ted_lcd->lcd_uuid);
         rc = fsfilt_write_record(exp->exp_obd, obt->obt_rcvd_filp,
                                  ted->ted_lcd,
                                  sizeof(*ted->ted_lcd), &off, 0);
-        cfs_mutex_up(&ted->ted_lcd_lock);
+        cfs_mutex_unlock(&ted->ted_lcd_lock);
         pop_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
 
         CDEBUG(rc == 0 ? D_INFO : D_ERROR,
@@ -1199,14 +1199,14 @@ static int filter_read_groups(struct obd_device *obd, int last_group,
         struct filter_obd *filter = &obd->u.filter;
         int old_count, group, rc = 0;
 
-        cfs_down(&filter->fo_init_lock);
+        cfs_mutex_lock(&filter->fo_init_lock);
         old_count = filter->fo_group_count;
         for (group = old_count; group <= last_group; group++) {
                 rc = filter_read_group_internal(obd, group, create);
                 if (rc != 0)
                         break;
         }
-        cfs_up(&filter->fo_init_lock);
+        cfs_mutex_unlock(&filter->fo_init_lock);
         return rc;
 }
 
@@ -1781,7 +1781,7 @@ static int filter_intent_policy(struct ldlm_namespace *ns,
          * therefore, that res->lr_lvb_data cannot increase beyond the
          * end of already granted lock. As a result, it is safe to
          * check against "stale" reply_lvb->lvb_size value without
-         * res->lr_lvb_sem.
+         * res->lr_lvb_mutex.
          */
         arg.size = reply_lvb->lvb_size;
         arg.victim = &l;
@@ -2050,15 +2050,15 @@ int filter_common_setup(struct obd_device *obd, struct lustre_cfg* lcfg,
         obd->obd_lvfs_ctxt.fs = get_ds();
         obd->obd_lvfs_ctxt.cb_ops = filter_lvfs_ops;
 
-        cfs_init_mutex(&filter->fo_init_lock);
+        cfs_mutex_init(&filter->fo_init_lock);
         filter->fo_committed_group = 0;
         filter->fo_destroys_in_progress = 0;
         for (i = 0; i < 32; i++)
-                cfs_sema_init(&filter->fo_create_locks[i], 1);
+                cfs_mutex_init(&filter->fo_create_locks[i]);
 
         cfs_spin_lock_init(&filter->fo_objidlock);
         CFS_INIT_LIST_HEAD(&filter->fo_export_list);
-        cfs_sema_init(&filter->fo_alloc_lock, 1);
+        cfs_mutex_init(&filter->fo_alloc_lock);
         init_brw_stats(&filter->fo_filter_stats);
         cfs_spin_lock_init(&filter->fo_flags_lock);
         filter->fo_read_cache = 1; /* enable read-only cache by default */
@@ -2406,20 +2406,20 @@ static int filter_llog_finish(struct obd_device *obd, int count)
                  * This is safe to do, as llog is already synchronized
                  * and its import may go.
                  */
-                cfs_mutex_down(&ctxt->loc_sem);
+                cfs_mutex_lock(&ctxt->loc_mutex);
                 if (ctxt->loc_imp) {
                         class_import_put(ctxt->loc_imp);
                         ctxt->loc_imp = NULL;
                 }
-                cfs_mutex_up(&ctxt->loc_sem);
+                cfs_mutex_unlock(&ctxt->loc_mutex);
                 llog_ctxt_put(ctxt);
         }
 
         if (filter->fo_lcm) {
-                cfs_mutex_down(&ctxt->loc_sem);
+                cfs_mutex_lock(&ctxt->loc_mutex);
                 llog_recov_thread_fini(filter->fo_lcm, obd->obd_force);
                 filter->fo_lcm = NULL;
-                cfs_mutex_up(&ctxt->loc_sem);
+                cfs_mutex_unlock(&ctxt->loc_mutex);
         }
         RETURN(filter_olg_fini(&obd->obd_olg));
 }
@@ -3555,7 +3555,7 @@ static int filter_destroy_precreated(struct obd_export *exp, struct obdo *oa,
         int skip_orphan;
         ENTRY;
 
-        LASSERT(down_trylock(&filter->fo_create_locks[oa->o_seq]) != 0);
+        LASSERT_MUTEX_LOCKED(&filter->fo_create_locks[oa->o_seq]);
 
         memset(&doa, 0, sizeof(doa));
 
@@ -3637,11 +3637,11 @@ static int filter_handle_precreate(struct obd_export *exp, struct obdo *oa,
                 }
                 /* This causes inflight precreates to abort and drop lock */
                 cfs_set_bit(group, &filter->fo_destroys_in_progress);
-                cfs_down(&filter->fo_create_locks[group]);
+                cfs_mutex_lock(&filter->fo_create_locks[group]);
                 if (!cfs_test_bit(group, &filter->fo_destroys_in_progress)) {
                         CERROR("%s:["LPU64"] destroys_in_progress already cleared\n",
                                exp->exp_obd->obd_name, group);
-                        cfs_up(&filter->fo_create_locks[group]);
+                        cfs_mutex_unlock(&filter->fo_create_locks[group]);
                         RETURN(0);
                 }
                 diff = oa->o_id - last;
@@ -3666,7 +3666,7 @@ static int filter_handle_precreate(struct obd_export *exp, struct obdo *oa,
                         cfs_clear_bit(group, &filter->fo_destroys_in_progress);
                 }
         } else {
-                cfs_down(&filter->fo_create_locks[group]);
+                cfs_mutex_lock(&filter->fo_create_locks[group]);
                 if (oti->oti_conn_cnt < exp->exp_conn_cnt) {
                         CERROR("%s: dropping old precreate request\n",
                                obd->obd_name);
@@ -3695,7 +3695,7 @@ static int filter_handle_precreate(struct obd_export *exp, struct obdo *oa,
         /* else diff == 0 */
         GOTO(out, rc = 0);
 out:
-        cfs_up(&filter->fo_create_locks[group]);
+        cfs_mutex_unlock(&filter->fo_create_locks[group]);
         return rc;
 }
 
@@ -3815,7 +3815,7 @@ static int filter_precreate(struct obd_device *obd, struct obdo *oa,
 
         filter = &obd->u.filter;
 
-        LASSERT(down_trylock(&filter->fo_create_locks[group]) != 0);
+        LASSERT_MUTEX_LOCKED(&filter->fo_create_locks[group]);
 
         OBD_FAIL_TIMEOUT(OBD_FAIL_TGT_DELAY_PRECREATE, obd_timeout / 2);
 
@@ -4083,9 +4083,9 @@ int filter_create(struct obd_export *exp, struct obdo *oa,
                         rc = -EINVAL;
                 } else {
                         diff = 1;
-                        cfs_down(&filter->fo_create_locks[oa->o_seq]);
+                        cfs_mutex_lock(&filter->fo_create_locks[oa->o_seq]);
                         rc = filter_precreate(obd, oa, oa->o_seq, &diff);
-                        cfs_up(&filter->fo_create_locks[oa->o_seq]);
+                        cfs_mutex_unlock(&filter->fo_create_locks[oa->o_seq]);
                 }
         } else {
                 rc = filter_handle_precreate(exp, oa, oa->o_seq, oti);
diff --git a/lustre/obdfilter/filter_io_26.c b/lustre/obdfilter/filter_io_26.c
index cc0d72c..35df820 100644
--- a/lustre/obdfilter/filter_io_26.c
+++ b/lustre/obdfilter/filter_io_26.c
@@ -484,7 +484,7 @@ int filter_direct_io(int rw, struct dentry *dchild, struct filter_iobuf *iobuf,
         struct inode *inode = dchild->d_inode;
         int blocks_per_page = CFS_PAGE_SIZE >> inode->i_blkbits;
         int rc, rc2, create;
-        cfs_semaphore_t *sem;
+        cfs_mutex_t *mutex;
         ENTRY;
 
         LASSERTF(iobuf->dr_npages <= iobuf->dr_max_pages, "%d,%d\n",
@@ -495,12 +495,12 @@ int filter_direct_io(int rw, struct dentry *dchild, struct filter_iobuf *iobuf,
                 if (iobuf->dr_npages == 0)
                         RETURN(0);
                 create = 0;
-                sem = NULL;
+                mutex = NULL;
         } else {
                 LASSERTF(rw == OBD_BRW_WRITE, "%x\n", rw);
                 LASSERT(iobuf->dr_npages > 0);
                 create = 1;
-                sem = &obd->u.filter.fo_alloc_lock;
+                mutex = &obd->u.filter.fo_alloc_lock;
 
                 lquota_enforce(filter_quota_interface_ref, obd,
                                iobuf->dr_ignore_quota);
@@ -512,7 +512,7 @@ int filter_direct_io(int rw, struct dentry *dchild, struct filter_iobuf *iobuf,
         } else {
                 rc = fsfilt_map_inode_pages(obd, inode, iobuf->dr_pages,
                                     iobuf->dr_npages, iobuf->dr_blocks,
-                                    obdfilter_created_scratchpad, create, sem);
+                                    obdfilter_created_scratchpad, create, mutex);
         }
 
         if (rw == OBD_BRW_WRITE) {
diff --git a/lustre/obdfilter/filter_lvb.c b/lustre/obdfilter/filter_lvb.c
index 080db86..f47a650 100644
--- a/lustre/obdfilter/filter_lvb.c
+++ b/lustre/obdfilter/filter_lvb.c
@@ -66,7 +66,7 @@ static int filter_lvbo_free(struct ldlm_resource *res) {
         return 0;
 }
 
-/* Called with res->lr_lvb_sem held */
+/* Called with res->lr_lvb_mutex held */
 static int filter_lvbo_init(struct ldlm_resource *res)
 {
         struct ost_lvb *lvb = NULL;
@@ -76,7 +76,7 @@ static int filter_lvbo_init(struct ldlm_resource *res)
         ENTRY;
 
         LASSERT(res);
-        LASSERT_SEM_LOCKED(&res->lr_lvb_sem);
+        LASSERT_MUTEX_LOCKED(&res->lr_lvb_mutex);
 
         if (res->lr_lvb_data)
                 RETURN(0);
diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c
index bc1243b..2ea34a7 100644
--- a/lustre/osc/osc_request.c
+++ b/lustre/osc/osc_request.c
@@ -4219,7 +4219,7 @@ static int osc_llog_init(struct obd_device *obd, struct obd_llog_group *olg,
 
         LASSERT(olg == &obd->obd_olg);
 
-        cfs_mutex_down(&olg->olg_cat_processing);
+        cfs_mutex_lock(&olg->olg_cat_processing);
         rc = llog_get_cat_list(disk_obd, name, *index, 1, &catid);
         if (rc) {
                 CERROR("rc: %d\n", rc);
@@ -4243,7 +4243,7 @@ static int osc_llog_init(struct obd_device *obd, struct obd_llog_group *olg,
         }
 
  out:
-        cfs_mutex_up(&olg->olg_cat_processing);
+        cfs_mutex_unlock(&olg->olg_cat_processing);
 
         return rc;
 }
@@ -4494,7 +4494,6 @@ int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                                             ptlrpc_add_rqs_to_pool);
 
                 CFS_INIT_LIST_HEAD(&cli->cl_grant_shrink_list);
-                cfs_sema_init(&cli->cl_grant_sem, 1);
 
                 ns_register_cancel(obd->obd_namespace, osc_cancel_for_recovery);
         }
diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c
index 59ab298..eda118b 100644
--- a/lustre/ost/ost_handler.c
+++ b/lustre/ost/ost_handler.c
@@ -2418,7 +2418,7 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
         lprocfs_ost_init_vars(&lvars);
         lprocfs_obd_setup(obd, lvars.obd_vars);
 
-        cfs_sema_init(&ost->ost_health_sem, 1);
+        cfs_mutex_init(&ost->ost_health_mutex);
 
         if (oss_num_threads) {
                 /* If oss_num_threads is set, it is the min and the max. */
@@ -2535,13 +2535,13 @@ static int ost_cleanup(struct obd_device *obd)
         /* there is no recovery for OST OBD, all recovery is controlled by
          * obdfilter OBD */
         LASSERT(obd->obd_recovering == 0);
-        cfs_down(&ost->ost_health_sem);
+        cfs_mutex_lock(&ost->ost_health_mutex);
         ptlrpc_unregister_service(ost->ost_service);
         ptlrpc_unregister_service(ost->ost_create_service);
         ptlrpc_unregister_service(ost->ost_io_service);
         ost->ost_service = NULL;
         ost->ost_create_service = NULL;
-        cfs_up(&ost->ost_health_sem);
+        cfs_mutex_unlock(&ost->ost_health_mutex);
 
         lprocfs_obd_cleanup(obd);
 
@@ -2553,11 +2553,11 @@ static int ost_health_check(struct obd_device *obd)
         struct ost_obd *ost = &obd->u.ost;
         int rc = 0;
 
-        cfs_down(&ost->ost_health_sem);
+        cfs_mutex_lock(&ost->ost_health_mutex);
         rc |= ptlrpc_service_health_check(ost->ost_service);
         rc |= ptlrpc_service_health_check(ost->ost_create_service);
         rc |= ptlrpc_service_health_check(ost->ost_io_service);
-        cfs_up(&ost->ost_health_sem);
+        cfs_mutex_unlock(&ost->ost_health_mutex);
 
         /*
          * health_check to return 0 on healthy
diff --git a/lustre/ptlrpc/llog_client.c b/lustre/ptlrpc/llog_client.c
index 4305375..13f8a54 100644
--- a/lustre/ptlrpc/llog_client.c
+++ b/lustre/ptlrpc/llog_client.c
@@ -58,7 +58,7 @@
 #include <libcfs/list.h>
 
 #define LLOG_CLIENT_ENTRY(ctxt, imp) do {                             \
-        cfs_mutex_down(&ctxt->loc_sem);                               \
+        cfs_mutex_lock(&ctxt->loc_mutex);                             \
         if (ctxt->loc_imp) {                                          \
                 imp = class_import_get(ctxt->loc_imp);                \
         } else {                                                      \
@@ -67,19 +67,19 @@
                        "but I'll try again next time.  Not fatal.\n", \
                        ctxt->loc_idx);                                \
                 imp = NULL;                                           \
-                cfs_mutex_up(&ctxt->loc_sem);                         \
+                cfs_mutex_unlock(&ctxt->loc_mutex);                   \
                 return (-EINVAL);                                     \
         }                                                             \
-        cfs_mutex_up(&ctxt->loc_sem);                                 \
+        cfs_mutex_unlock(&ctxt->loc_mutex);                           \
 } while(0)
 
 #define LLOG_CLIENT_EXIT(ctxt, imp) do {                              \
-        cfs_mutex_down(&ctxt->loc_sem);                               \
+        cfs_mutex_lock(&ctxt->loc_mutex);                             \
         if (ctxt->loc_imp != imp)                                     \
                 CWARN("loc_imp has changed from %p to %p\n",          \
                        ctxt->loc_imp, imp);                           \
         class_import_put(imp);                                        \
-        cfs_mutex_up(&ctxt->loc_sem);                                 \
+        cfs_mutex_unlock(&ctxt->loc_mutex);                           \
 } while(0)
 
 /* This is a callback from the llog_* functions.
diff --git a/lustre/ptlrpc/llog_net.c b/lustre/ptlrpc/llog_net.c
index cd6ee67..3b11a03 100644
--- a/lustre/ptlrpc/llog_net.c
+++ b/lustre/ptlrpc/llog_net.c
@@ -161,7 +161,7 @@ int llog_receptor_accept(struct llog_ctxt *ctxt, struct obd_import *imp)
         ENTRY;
 
         LASSERT(ctxt);
-        cfs_mutex_down(&ctxt->loc_sem);
+        cfs_mutex_lock(&ctxt->loc_mutex);
         if (ctxt->loc_imp != imp) {
                 if (ctxt->loc_imp) {
                         CWARN("changing the import %p - %p\n",
@@ -170,7 +170,7 @@ int llog_receptor_accept(struct llog_ctxt *ctxt, struct obd_import *imp)
                 }
                 ctxt->loc_imp = class_import_get(imp);
         }
-        cfs_mutex_up(&ctxt->loc_sem);
+        cfs_mutex_unlock(&ctxt->loc_mutex);
         RETURN(0);
 }
 EXPORT_SYMBOL(llog_receptor_accept);
@@ -194,13 +194,13 @@ int llog_initiator_connect(struct llog_ctxt *ctxt)
         new_imp = ctxt->loc_obd->u.cli.cl_import;
         LASSERTF(ctxt->loc_imp == NULL || ctxt->loc_imp == new_imp,
                  "%p - %p\n", ctxt->loc_imp, new_imp);
-        cfs_mutex_down(&ctxt->loc_sem);
+        cfs_mutex_lock(&ctxt->loc_mutex);
         if (ctxt->loc_imp != new_imp) {
                 if (ctxt->loc_imp)
                         class_import_put(ctxt->loc_imp);
                 ctxt->loc_imp = class_import_get(new_imp);
         }
-        cfs_mutex_up(&ctxt->loc_sem);
+        cfs_mutex_unlock(&ctxt->loc_mutex);
         RETURN(0);
 }
 EXPORT_SYMBOL(llog_initiator_connect);
diff --git a/lustre/ptlrpc/llog_server.c b/lustre/ptlrpc/llog_server.c
index 3929127..f67f8be 100644
--- a/lustre/ptlrpc/llog_server.c
+++ b/lustre/ptlrpc/llog_server.c
@@ -605,7 +605,7 @@ static int llog_catinfo_deletions(struct obd_device *obd, char *buf,
         if (!idarray)
                 GOTO(release_ctxt, rc = -ENOMEM);
 
-        cfs_mutex_down(&obd->obd_olg.olg_cat_processing);
+        cfs_mutex_lock(&obd->obd_olg.olg_cat_processing);
         rc = llog_get_cat_list(obd, name, 0, count, idarray);
         if (rc)
                 GOTO(out_free, rc);
@@ -651,7 +651,7 @@ static int llog_catinfo_deletions(struct obd_device *obd, char *buf,
 out_pop:
         pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
 out_free:
-        cfs_mutex_up(&obd->obd_olg.olg_cat_processing);
+        cfs_mutex_unlock(&obd->obd_olg.olg_cat_processing);
         OBD_FREE_LARGE(idarray, size);
 release_ctxt:
         llog_ctxt_put(ctxt);
diff --git a/lustre/ptlrpc/pinger.c b/lustre/ptlrpc/pinger.c
index b95f8ca..c270867 100644
--- a/lustre/ptlrpc/pinger.c
+++ b/lustre/ptlrpc/pinger.c
@@ -51,7 +51,7 @@
 #include <obd_class.h>
 #include "ptlrpc_internal.h"
 
-cfs_semaphore_t pinger_sem;
+cfs_mutex_t pinger_mutex;
 static CFS_LIST_HEAD(pinger_imports);
 static cfs_list_t timeout_list = CFS_LIST_HEAD_INIT(timeout_list);
 struct ptlrpc_request *
@@ -150,14 +150,14 @@ cfs_duration_t pinger_check_timeout(cfs_time_t time)
         cfs_time_t timeout = PING_INTERVAL;
 
         /* The timeout list is a increase order sorted list */
-        cfs_mutex_down(&pinger_sem);
+        cfs_mutex_lock(&pinger_mutex);
         cfs_list_for_each_entry(item, &timeout_list, ti_chain) {
                 int ti_timeout = item->ti_timeout;
                 if (timeout > ti_timeout)
                         timeout = ti_timeout;
                 break;
         }
-        cfs_mutex_up(&pinger_sem);
+        cfs_mutex_unlock(&pinger_mutex);
 
         return cfs_time_sub(cfs_time_add(time, cfs_time_seconds(timeout)),
                                          cfs_time_current());
@@ -285,7 +285,7 @@ static int ptlrpc_pinger_main(void *arg)
                 struct timeout_item *item;
                 cfs_list_t *iter;
 
-                cfs_mutex_down(&pinger_sem);
+                cfs_mutex_lock(&pinger_mutex);
                 cfs_list_for_each_entry(item, &timeout_list, ti_chain) {
                         item->ti_cb(item, item->ti_cb_data);
                 }
@@ -302,7 +302,7 @@ static int ptlrpc_pinger_main(void *arg)
                                                         cfs_time_seconds(PING_INTERVAL))))
                                 ptlrpc_update_next_ping(imp, 0);
                 }
-                cfs_mutex_up(&pinger_sem);
+                cfs_mutex_unlock(&pinger_mutex);
                 /* update memory usage info */
                 obd_update_maxusage();
 
@@ -395,10 +395,10 @@ int ptlrpc_stop_pinger(void)
                 RETURN(-EALREADY);
 
         ptlrpc_pinger_remove_timeouts();
-        cfs_mutex_down(&pinger_sem);
+        cfs_mutex_lock(&pinger_mutex);
         pinger_thread->t_flags = SVC_STOPPING;
         cfs_waitq_signal(&pinger_thread->t_ctl_waitq);
-        cfs_mutex_up(&pinger_sem);
+        cfs_mutex_unlock(&pinger_mutex);
 
         l_wait_event(pinger_thread->t_ctl_waitq,
                      (pinger_thread->t_flags & SVC_STOPPED), &lwi);
@@ -424,7 +424,7 @@ int ptlrpc_pinger_add_import(struct obd_import *imp)
         if (!cfs_list_empty(&imp->imp_pinger_chain))
                 RETURN(-EALREADY);
 
-        cfs_mutex_down(&pinger_sem);
+        cfs_mutex_lock(&pinger_mutex);
         CDEBUG(D_HA, "adding pingable import %s->%s\n",
                imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd));
         /* if we add to pinger we want recovery on this import */
@@ -435,7 +435,7 @@ int ptlrpc_pinger_add_import(struct obd_import *imp)
         class_import_get(imp);
 
         ptlrpc_pinger_wake_up();
-        cfs_mutex_up(&pinger_sem);
+        cfs_mutex_unlock(&pinger_mutex);
 
         RETURN(0);
 }
@@ -446,14 +446,14 @@ int ptlrpc_pinger_del_import(struct obd_import *imp)
         if (cfs_list_empty(&imp->imp_pinger_chain))
                 RETURN(-ENOENT);
 
-        cfs_mutex_down(&pinger_sem);
+        cfs_mutex_lock(&pinger_mutex);
         cfs_list_del_init(&imp->imp_pinger_chain);
         CDEBUG(D_HA, "removing pingable import %s->%s\n",
                imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd));
         /* if we remove from pinger we don't want recovery on this import */
         imp->imp_obd->obd_no_recov = 1;
         class_import_put(imp);
-        cfs_mutex_up(&pinger_sem);
+        cfs_mutex_unlock(&pinger_mutex);
         RETURN(0);
 }
 
@@ -490,7 +490,7 @@ ptlrpc_pinger_register_timeout(int time, enum timeout_event event,
 {
         struct timeout_item *item, *tmp;
 
-        LASSERT_SEM_LOCKED(&pinger_sem);
+        LASSERT_MUTEX_LOCKED(&pinger_mutex);
 
         cfs_list_for_each_entry(item, &timeout_list, ti_chain)
                 if (item->ti_event == event)
@@ -519,14 +519,14 @@ int ptlrpc_add_timeout_client(int time, enum timeout_event event,
 {
         struct timeout_item *ti;
 
-        cfs_mutex_down(&pinger_sem);
+        cfs_mutex_lock(&pinger_mutex);
         ti = ptlrpc_pinger_register_timeout(time, event, cb, data);
         if (!ti) {
-                cfs_mutex_up(&pinger_sem);
+                cfs_mutex_unlock(&pinger_mutex);
                 return (-EINVAL);
         }
         cfs_list_add(obd_list, &ti->ti_obd_list);
-        cfs_mutex_up(&pinger_sem);
+        cfs_mutex_unlock(&pinger_mutex);
         return 0;
 }
 
@@ -537,7 +537,7 @@ int ptlrpc_del_timeout_client(cfs_list_t *obd_list,
 
         if (cfs_list_empty(obd_list))
                 return 0;
-        cfs_mutex_down(&pinger_sem);
+        cfs_mutex_lock(&pinger_mutex);
         cfs_list_del_init(obd_list);
         /**
          * If there are no obd attached to the timeout event
@@ -554,7 +554,7 @@ int ptlrpc_del_timeout_client(cfs_list_t *obd_list,
                 cfs_list_del(&ti->ti_chain);
                 OBD_FREE_PTR(ti);
         }
-        cfs_mutex_up(&pinger_sem);
+        cfs_mutex_unlock(&pinger_mutex);
         return 0;
 }
 
@@ -562,13 +562,13 @@ int ptlrpc_pinger_remove_timeouts(void)
 {
         struct timeout_item *item, *tmp;
 
-        cfs_mutex_down(&pinger_sem);
+        cfs_mutex_lock(&pinger_mutex);
         cfs_list_for_each_entry_safe(item, tmp, &timeout_list, ti_chain) {
                 LASSERT(cfs_list_empty(&item->ti_obd_list));
                 cfs_list_del(&item->ti_chain);
                 OBD_FREE_PTR(item);
         }
-        cfs_mutex_up(&pinger_sem);
+        cfs_mutex_unlock(&pinger_mutex);
         return 0;
 }
 
@@ -771,7 +771,7 @@ static int pinger_check_rpcs(void *arg)
         set = pd->pd_set;
 
         /* add rpcs into set */
-        cfs_mutex_down(&pinger_sem);
+        cfs_mutex_lock(&pinger_mutex);
         cfs_list_for_each(iter, &pinger_imports) {
                 struct obd_import *imp = cfs_list_entry(iter, struct obd_import,
                                                         imp_pinger_chain);
@@ -815,7 +815,7 @@ static int pinger_check_rpcs(void *arg)
                 }
         }
         pd->pd_this_ping = curtime;
-        cfs_mutex_up(&pinger_sem);
+        cfs_mutex_unlock(&pinger_mutex);
 
         /* Might be empty, that's OK. */
         if (cfs_atomic_read(&set->set_remaining) == 0)
@@ -843,7 +843,7 @@ do_check_set:
         }
 
         /* Expire all the requests that didn't come back. */
-        cfs_mutex_down(&pinger_sem);
+        cfs_mutex_lock(&pinger_mutex);
         cfs_list_for_each(iter, &set->set_requests) {
                 req = cfs_list_entry(iter, struct ptlrpc_request,
                                      rq_set_chain);
@@ -869,7 +869,7 @@ do_check_set:
                 cfs_spin_unlock(&imp->imp_lock);
                 cfs_atomic_dec(&set->set_remaining);
         }
-        cfs_mutex_up(&pinger_sem);
+        cfs_mutex_unlock(&pinger_mutex);
 
         ptlrpc_set_destroy(set);
         pd->pd_set = NULL;
@@ -910,7 +910,7 @@ int ptlrpc_stop_pinger(void)
 void ptlrpc_pinger_sending_on_import(struct obd_import *imp)
 {
 #ifdef ENABLE_PINGER
-        cfs_mutex_down(&pinger_sem);
+        cfs_mutex_lock(&pinger_mutex);
         ptlrpc_update_next_ping(imp, 0);
         if (pinger_args.pd_set == NULL &&
             cfs_time_before(imp->imp_next_ping, pinger_args.pd_next_ping)) {
@@ -918,14 +918,14 @@ void ptlrpc_pinger_sending_on_import(struct obd_import *imp)
                         imp->imp_next_ping, cfs_time_current());
                 pinger_args.pd_next_ping = imp->imp_next_ping;
         }
-        cfs_mutex_up(&pinger_sem);
+        cfs_mutex_unlock(&pinger_mutex);
 #endif
 }
 
 void ptlrpc_pinger_commit_expected(struct obd_import *imp)
 {
 #ifdef ENABLE_PINGER
-        cfs_mutex_down(&pinger_sem);
+        cfs_mutex_lock(&pinger_mutex);
         ptlrpc_update_next_ping(imp, 1);
         if (pinger_args.pd_set == NULL &&
             cfs_time_before(imp->imp_next_ping, pinger_args.pd_next_ping)) {
@@ -933,7 +933,7 @@ void ptlrpc_pinger_commit_expected(struct obd_import *imp)
                         imp->imp_next_ping, cfs_time_current());
                 pinger_args.pd_next_ping = imp->imp_next_ping;
         }
-        cfs_mutex_up(&pinger_sem);
+        cfs_mutex_unlock(&pinger_mutex);
 #endif
 }
 
@@ -960,10 +960,10 @@ int ptlrpc_pinger_add_import(struct obd_import *imp)
                imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd));
         ptlrpc_pinger_sending_on_import(imp);
 
-        cfs_mutex_down(&pinger_sem);
+        cfs_mutex_lock(&pinger_mutex);
         cfs_list_add_tail(&imp->imp_pinger_chain, &pinger_imports);
         class_import_get(imp);
-        cfs_mutex_up(&pinger_sem);
+        cfs_mutex_unlock(&pinger_mutex);
 
         RETURN(0);
 }
@@ -974,12 +974,12 @@ int ptlrpc_pinger_del_import(struct obd_import *imp)
         if (cfs_list_empty(&imp->imp_pinger_chain))
                 RETURN(-ENOENT);
 
-        cfs_mutex_down(&pinger_sem);
+        cfs_mutex_lock(&pinger_mutex);
         cfs_list_del_init(&imp->imp_pinger_chain);
         CDEBUG(D_HA, "removing pingable import %s->%s\n",
                imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd));
         class_import_put(imp);
-        cfs_mutex_up(&pinger_sem);
+        cfs_mutex_unlock(&pinger_mutex);
         RETURN(0);
 }
 
diff --git a/lustre/ptlrpc/ptlrpc_module.c b/lustre/ptlrpc/ptlrpc_module.c
index 2053ec6..d6e6054 100644
--- a/lustre/ptlrpc/ptlrpc_module.c
+++ b/lustre/ptlrpc/ptlrpc_module.c
@@ -58,8 +58,8 @@ extern cfs_spinlock_t ptlrpc_last_xid_lock;
 extern cfs_spinlock_t ptlrpc_rs_debug_lock;
 #endif
 extern cfs_spinlock_t ptlrpc_all_services_lock;
-extern cfs_semaphore_t pinger_sem;
-extern cfs_semaphore_t ptlrpcd_sem;
+extern cfs_mutex_t pinger_mutex;
+extern cfs_mutex_t ptlrpcd_mutex;
 
 __init int ptlrpc_init(void)
 {
@@ -71,8 +71,8 @@ __init int ptlrpc_init(void)
         cfs_spin_lock_init(&ptlrpc_rs_debug_lock);
 #endif
         cfs_spin_lock_init(&ptlrpc_all_services_lock);
-        cfs_init_mutex(&pinger_sem);
-        cfs_init_mutex(&ptlrpcd_sem);
+        cfs_mutex_init(&pinger_mutex);
+        cfs_mutex_init(&ptlrpcd_mutex);
         ptlrpc_init_xid();
 
         rc = req_layout_init();
diff --git a/lustre/ptlrpc/ptlrpcd.c b/lustre/ptlrpc/ptlrpcd.c
index e4c5e73..8ee921e 100644
--- a/lustre/ptlrpc/ptlrpcd.c
+++ b/lustre/ptlrpc/ptlrpcd.c
@@ -95,7 +95,7 @@ CFS_MODULE_PARM(ptlrpcd_bind_policy, "i", int, 0644,
 #endif
 static struct ptlrpcd *ptlrpcds;
 
-cfs_semaphore_t ptlrpcd_sem;
+cfs_mutex_t ptlrpcd_mutex;
 static int ptlrpcd_users = 0;
 
 void ptlrpcd_wake(struct ptlrpc_request *req)
@@ -834,18 +834,18 @@ int ptlrpcd_addref(void)
         int rc = 0;
         ENTRY;
 
-        cfs_mutex_down(&ptlrpcd_sem);
+        cfs_mutex_lock(&ptlrpcd_mutex);
         if (++ptlrpcd_users == 1)
                 rc = ptlrpcd_init();
-        cfs_mutex_up(&ptlrpcd_sem);
+        cfs_mutex_unlock(&ptlrpcd_mutex);
         RETURN(rc);
 }
 
 void ptlrpcd_decref(void)
 {
-        cfs_mutex_down(&ptlrpcd_sem);
+        cfs_mutex_lock(&ptlrpcd_mutex);
         if (--ptlrpcd_users == 0)
                 ptlrpcd_fini();
-        cfs_mutex_up(&ptlrpcd_sem);
+        cfs_mutex_unlock(&ptlrpcd_mutex);
 }
 /** @} ptlrpcd */
diff --git a/lustre/ptlrpc/recov_thread.c b/lustre/ptlrpc/recov_thread.c
index d86ab0c..2f0e93c 100644
--- a/lustre/ptlrpc/recov_thread.c
+++ b/lustre/ptlrpc/recov_thread.c
@@ -226,7 +226,7 @@ static int llcd_send(struct llog_canceld_ctxt *llcd)
                 llcd_print(llcd, __FUNCTION__, __LINE__);
                 LBUG();
         }
-        LASSERT_SEM_LOCKED(&ctxt->loc_sem);
+        LASSERT_MUTEX_LOCKED(&ctxt->loc_mutex);
 
         if (llcd->llcd_cookiebytes == 0)
                 GOTO(exit, rc = 0);
@@ -305,7 +305,7 @@ static int
 llcd_attach(struct llog_ctxt *ctxt, struct llog_canceld_ctxt *llcd)
 {
         LASSERT(ctxt != NULL && llcd != NULL);
-        LASSERT_SEM_LOCKED(&ctxt->loc_sem);
+        LASSERT_MUTEX_LOCKED(&ctxt->loc_mutex);
         LASSERT(ctxt->loc_llcd == NULL);
         llcd->llcd_ctxt = llog_ctxt_get(ctxt);
         ctxt->loc_llcd = llcd;
@@ -325,7 +325,7 @@ static struct llog_canceld_ctxt *llcd_detach(struct llog_ctxt *ctxt)
         struct llog_canceld_ctxt *llcd;
 
         LASSERT(ctxt != NULL);
-        LASSERT_SEM_LOCKED(&ctxt->loc_sem);
+        LASSERT_MUTEX_LOCKED(&ctxt->loc_mutex);
 
         llcd = ctxt->loc_llcd;
         if (!llcd)
@@ -574,10 +574,10 @@ int llog_obd_repl_connect(struct llog_ctxt *ctxt,
         /*
          * Start recovery in separate thread.
          */
-        cfs_mutex_down(&ctxt->loc_sem);
+        cfs_mutex_lock(&ctxt->loc_mutex);
         ctxt->loc_gen = *gen;
         rc = llog_recov_thread_replay(ctxt, ctxt->llog_proc_cb, logid);
-        cfs_mutex_up(&ctxt->loc_sem);
+        cfs_mutex_unlock(&ctxt->loc_mutex);
 
         RETURN(rc);
 }
@@ -599,7 +599,7 @@ int llog_obd_repl_cancel(struct llog_ctxt *ctxt,
 
         LASSERT(ctxt != NULL);
 
-        cfs_mutex_down(&ctxt->loc_sem);
+        cfs_mutex_lock(&ctxt->loc_mutex);
         if (!ctxt->loc_lcm) {
                 CDEBUG(D_RPCTRACE, "No lcm for ctxt %p\n", ctxt);
                 GOTO(out, rc = -ENODEV);
@@ -680,7 +680,7 @@ int llog_obd_repl_cancel(struct llog_ctxt *ctxt,
 out:
         if (rc)
                 llcd_put(ctxt);
-        cfs_mutex_up(&ctxt->loc_sem);
+        cfs_mutex_unlock(&ctxt->loc_mutex);
         return rc;
 }
 EXPORT_SYMBOL(llog_obd_repl_cancel);
@@ -693,7 +693,7 @@ int llog_obd_repl_sync(struct llog_ctxt *ctxt, struct obd_export *exp)
         /*
          * Flush any remaining llcd.
          */
-        cfs_mutex_down(&ctxt->loc_sem);
+        cfs_mutex_lock(&ctxt->loc_mutex);
         if (exp && (ctxt->loc_imp == exp->exp_imp_reverse)) {
                 /*
                  * This is ost->mds connection, we can't be sure that mds
@@ -701,7 +701,7 @@ int llog_obd_repl_sync(struct llog_ctxt *ctxt, struct obd_export *exp)
                  */
                 CDEBUG(D_RPCTRACE, "Kill cached llcd\n");
                 llcd_put(ctxt);
-                cfs_mutex_up(&ctxt->loc_sem);
+                cfs_mutex_unlock(&ctxt->loc_mutex);
         } else {
                 /*
                  * This is either llog_sync() from generic llog code or sync
@@ -709,7 +709,7 @@ int llog_obd_repl_sync(struct llog_ctxt *ctxt, struct obd_export *exp)
                  * llcds to the target with waiting for completion.
                  */
                 CDEBUG(D_RPCTRACE, "Sync cached llcd\n");
-                cfs_mutex_up(&ctxt->loc_sem);
+                cfs_mutex_unlock(&ctxt->loc_mutex);
                 rc = llog_cancel(ctxt, NULL, 0, NULL, OBD_LLOG_FL_SENDNOW);
         }
         RETURN(rc);
diff --git a/lustre/ptlrpc/sec.c b/lustre/ptlrpc/sec.c
index 62af35c..414974d 100644
--- a/lustre/ptlrpc/sec.c
+++ b/lustre/ptlrpc/sec.c
@@ -120,7 +120,7 @@ EXPORT_SYMBOL(sptlrpc_unregister_policy);
 static
 struct ptlrpc_sec_policy * sptlrpc_wireflavor2policy(__u32 flavor)
 {
-        static CFS_DECLARE_MUTEX(load_mutex);
+        static CFS_DEFINE_MUTEX(load_mutex);
         static cfs_atomic_t       loaded = CFS_ATOMIC_INIT(0);
         struct ptlrpc_sec_policy *policy;
         __u16                     number = SPTLRPC_FLVR_POLICY(flavor);
@@ -143,7 +143,7 @@ struct ptlrpc_sec_policy * sptlrpc_wireflavor2policy(__u32 flavor)
                         break;
 
                 /* try to load gss module, once */
-                cfs_mutex_down(&load_mutex);
+                cfs_mutex_lock(&load_mutex);
                 if (cfs_atomic_read(&loaded) == 0) {
                         if (cfs_request_module("ptlrpc_gss") == 0)
                                 CWARN("module ptlrpc_gss loaded on demand\n");
@@ -152,7 +152,7 @@ struct ptlrpc_sec_policy * sptlrpc_wireflavor2policy(__u32 flavor)
 
                         cfs_atomic_set(&loaded, 1);
                 }
-                cfs_mutex_up(&load_mutex);
+                cfs_mutex_unlock(&load_mutex);
         }
 
         return policy;
@@ -1475,7 +1475,7 @@ int sptlrpc_import_sec_adapt(struct obd_import *imp,
                               sptlrpc_flavor2name(&sf, str, sizeof(str)));
         }
 
-        cfs_mutex_down(&imp->imp_sec_mutex);
+        cfs_mutex_lock(&imp->imp_sec_mutex);
 
         newsec = sptlrpc_sec_create(imp, svc_ctx, &sf, sp);
         if (newsec) {
@@ -1487,7 +1487,7 @@ int sptlrpc_import_sec_adapt(struct obd_import *imp,
                 rc = -EPERM;
         }
 
-        cfs_mutex_up(&imp->imp_sec_mutex);
+        cfs_mutex_unlock(&imp->imp_sec_mutex);
 out:
         sptlrpc_sec_put(sec);
         RETURN(rc);
diff --git a/lustre/ptlrpc/sec_bulk.c b/lustre/ptlrpc/sec_bulk.c
index dfe6b87..2068064 100644
--- a/lustre/ptlrpc/sec_bulk.c
+++ b/lustre/ptlrpc/sec_bulk.c
@@ -396,7 +396,7 @@ static void enc_pools_insert(cfs_page_t ***pools, int npools, int npages)
 
 static int enc_pools_add_pages(int npages)
 {
-        static CFS_DECLARE_MUTEX(sem_add_pages);
+        static CFS_DEFINE_MUTEX(add_pages_mutex);
         cfs_page_t   ***pools;
         int             npools, alloced = 0;
         int             i, j, rc = -ENOMEM;
@@ -404,7 +404,7 @@ static int enc_pools_add_pages(int npages)
         if (npages < PTLRPC_MAX_BRW_PAGES)
                 npages = PTLRPC_MAX_BRW_PAGES;
 
-        cfs_down(&sem_add_pages);
+        cfs_mutex_lock(&add_pages_mutex);
 
         if (npages + page_pools.epp_total_pages > page_pools.epp_max_pages)
                 npages = page_pools.epp_max_pages - page_pools.epp_total_pages;
@@ -446,7 +446,7 @@ out:
                 CERROR("Failed to allocate %d enc pages\n", npages);
         }
 
-        cfs_up(&sem_add_pages);
+        cfs_mutex_unlock(&add_pages_mutex);
         return rc;
 }
 
diff --git a/lustre/quota/quota_master.c b/lustre/quota/quota_master.c
index 710f801..8ee7c95 100644
--- a/lustre/quota/quota_master.c
+++ b/lustre/quota/quota_master.c
@@ -64,7 +64,7 @@
 
 #ifdef HAVE_QUOTA_SUPPORT
 
-/* lock ordering: mds->mds_qonoff_sem > dquot->dq_sem > lqs->lqs_lock */
+/* lock ordering: mds->mds_qonoff_sem > dquot->dq_mutex > lqs->lqs_lock */
 static cfs_list_t lustre_dquot_hash[NR_DQHASH];
 static cfs_rwlock_t dquot_hash_lock = CFS_RW_LOCK_UNLOCKED;
 
@@ -145,7 +145,8 @@ static struct lustre_dquot *alloc_dquot(struct lustre_quota_info *lqi,
                 RETURN(NULL);
 
         CFS_INIT_LIST_HEAD(&dquot->dq_hash);
-        cfs_init_mutex_locked(&dquot->dq_sem);
+        cfs_mutex_init(&dquot->dq_mutex);
+        cfs_mutex_lock(&dquot->dq_mutex);
         cfs_atomic_set(&dquot->dq_refcnt, 1);
         dquot->dq_info = lqi;
         dquot->dq_id = id;
@@ -203,6 +204,7 @@ static struct lustre_dquot *lustre_dqget(struct obd_device *obd,
         if ((dquot = find_dquot(hashent, lqi, id, type)) != NULL) {
                 cfs_atomic_inc(&dquot->dq_refcnt);
                 cfs_read_unlock(&dquot_hash_lock);
+                cfs_mutex_unlock(&empty->dq_mutex);
                 free_dq = 1;
         } else {
                 int rc;
@@ -211,7 +213,7 @@ static struct lustre_dquot *lustre_dqget(struct obd_device *obd,
 
                 dquot = empty;
                 rc = fsfilt_dquot(obd, dquot, QFILE_RD_DQUOT);
-                cfs_up(&dquot->dq_sem);
+                cfs_mutex_unlock(&dquot->dq_mutex);
                 if (rc) {
                         CERROR("can't read dquot from admin quotafile! "
                                "(rc:%d)\n", rc);
@@ -293,7 +295,7 @@ int dqacq_adjust_qunit_sz(struct obd_device *obd, qid_t id, int type,
         if (!oqaq)
                 GOTO(out, rc = -ENOMEM);
 
-        cfs_down(&dquot->dq_sem);
+        cfs_mutex_lock(&dquot->dq_mutex);
         init_oqaq(oqaq, qctxt, id, type);
 
         rc = dquot_create_oqaq(qctxt, dquot, ost_num, mdt_num,
@@ -327,7 +329,7 @@ int dqacq_adjust_qunit_sz(struct obd_device *obd, qid_t id, int type,
         else
                 qid[USRQUOTA] = dquot->dq_id;
 
-        cfs_up(&dquot->dq_sem);
+        cfs_mutex_unlock(&dquot->dq_mutex);
 
         rc = qctxt_adjust_qunit(obd, qctxt, qid, is_blk, 0, NULL);
         if (rc == -EDQUOT || rc == -EBUSY) {
@@ -351,7 +353,7 @@ out:
 
         RETURN(rc);
 out_sem:
-        cfs_up(&dquot->dq_sem);
+        cfs_mutex_unlock(&dquot->dq_mutex);
 	goto out;
 }
 
@@ -403,7 +405,7 @@ int dqacq_handler(struct obd_device *obd, struct qunit_data *qdata, int opc)
         DQUOT_DEBUG(dquot, "get dquot in dqacq_handler\n");
         QINFO_DEBUG(dquot->dq_info, "get dquot in dqadq_handler\n");
 
-        cfs_down(&dquot->dq_sem);
+        cfs_mutex_lock(&dquot->dq_mutex);
 
         if (QDATA_IS_BLK(qdata)) {
                 grace = info->qi_info[QDATA_IS_GRP(qdata)].dqi_bgrace;
@@ -470,7 +472,7 @@ int dqacq_handler(struct obd_device *obd, struct qunit_data *qdata, int opc)
         rc = fsfilt_dquot(obd, dquot, QFILE_WR_DQUOT);
         EXIT;
 out:
-        cfs_up(&dquot->dq_sem);
+        cfs_mutex_unlock(&dquot->dq_mutex);
         cfs_up_write(&mds->mds_qonoff_sem);
         lustre_dqput(dquot);
         if (rc != -EDQUOT)
@@ -1031,7 +1033,7 @@ int dquot_create_oqaq(struct lustre_quota_ctxt *qctxt,
 
         if (!dquot || !oqaq)
                 RETURN(-EINVAL);
-        LASSERT_SEM_LOCKED(&dquot->dq_sem);
+        LASSERT_MUTEX_LOCKED(&dquot->dq_mutex);
         LASSERT(oqaq->qaq_iunit_sz);
         LASSERT(oqaq->qaq_bunit_sz);
 
@@ -1339,11 +1341,11 @@ int mds_set_dqblk(struct obd_device *obd, struct obd_quotactl *oqctl)
         if (rc)
                 GOTO(out, rc);
 
-        cfs_down(&dquot->dq_sem);
+        cfs_mutex_lock(&dquot->dq_mutex);
         cfs_spin_lock(&lqs->lqs_lock);
         if (LQS_IS_SETQUOTA(lqs) || LQS_IS_RECOVERY(lqs)) {
                 cfs_spin_unlock(&lqs->lqs_lock);
-                cfs_up(&dquot->dq_sem);
+                cfs_mutex_unlock(&dquot->dq_mutex);
                 GOTO(skip, rc = -EBUSY);
         }
         LQS_SET_SETQUOTA(lqs);
@@ -1408,7 +1410,7 @@ int mds_set_dqblk(struct obd_device *obd, struct obd_quotactl *oqctl)
 
         rc = fsfilt_dquot(obd, dquot, QFILE_WR_DQUOT);
 
-        cfs_up(&dquot->dq_sem);
+        cfs_mutex_unlock(&dquot->dq_mutex);
 
         if (rc) {
                 CERROR("set limit failed! (rc:%d)\n", rc);
@@ -1421,9 +1423,9 @@ int mds_set_dqblk(struct obd_device *obd, struct obd_quotactl *oqctl)
         orig_set = ihardlimit || isoftlimit;
         now_set  = dqblk->dqb_ihardlimit || dqblk->dqb_isoftlimit;
         if (dqblk->dqb_valid & QIF_ILIMITS && orig_set != now_set) {
-                cfs_down(&dquot->dq_sem);
+                cfs_mutex_lock(&dquot->dq_mutex);
                 dquot->dq_dqb.dqb_curinodes = 0;
-                cfs_up(&dquot->dq_sem);
+                cfs_mutex_unlock(&dquot->dq_mutex);
                 rc = mds_init_slave_ilimits(obd, oqctl, orig_set);
                 if (rc) {
                         CERROR("init slave ilimits failed! (rc:%d)\n", rc);
@@ -1434,9 +1436,9 @@ int mds_set_dqblk(struct obd_device *obd, struct obd_quotactl *oqctl)
         orig_set = bhardlimit || bsoftlimit;
         now_set  = dqblk->dqb_bhardlimit || dqblk->dqb_bsoftlimit;
         if (dqblk->dqb_valid & QIF_BLIMITS && orig_set != now_set) {
-                cfs_down(&dquot->dq_sem);
+                cfs_mutex_lock(&dquot->dq_mutex);
                 dquot->dq_dqb.dqb_curspace = 0;
-                cfs_up(&dquot->dq_sem);
+                cfs_mutex_unlock(&dquot->dq_mutex);
                 rc = mds_init_slave_blimits(obd, oqctl, orig_set);
                 if (rc) {
                         CERROR("init slave blimits failed! (rc:%d)\n", rc);
@@ -1446,7 +1448,7 @@ int mds_set_dqblk(struct obd_device *obd, struct obd_quotactl *oqctl)
 
 revoke_out:
         cfs_down_write(&mds->mds_qonoff_sem);
-        cfs_down(&dquot->dq_sem);
+        cfs_mutex_lock(&dquot->dq_mutex);
         if (rc) {
                 /* cancel previous setting */
                 dquot->dq_dqb.dqb_ihardlimit = ihardlimit;
@@ -1457,7 +1459,7 @@ revoke_out:
                 dquot->dq_dqb.dqb_itime = itime;
         }
         rc2 = fsfilt_dquot(obd, dquot, QFILE_WR_DQUOT);
-        cfs_up(&dquot->dq_sem);
+        cfs_mutex_unlock(&dquot->dq_mutex);
 update_fail:
         cfs_spin_lock(&lqs->lqs_lock);
         LQS_CLEAR_SETQUOTA(lqs);
@@ -1540,7 +1542,7 @@ int mds_get_dqblk(struct obd_device *obd, struct obd_quotactl *oqctl)
         if (IS_ERR(dquot))
                 GOTO(out, rc = PTR_ERR(dquot));
 
-        cfs_down(&dquot->dq_sem);
+        cfs_mutex_lock(&dquot->dq_mutex);
         dqblk->dqb_ihardlimit = dquot->dq_dqb.dqb_ihardlimit;
         dqblk->dqb_isoftlimit = dquot->dq_dqb.dqb_isoftlimit;
         dqblk->dqb_bhardlimit = dquot->dq_dqb.dqb_bhardlimit;
@@ -1548,7 +1550,7 @@ int mds_get_dqblk(struct obd_device *obd, struct obd_quotactl *oqctl)
         dqblk->dqb_btime = dquot->dq_dqb.dqb_btime;
         dqblk->dqb_itime = dquot->dq_dqb.dqb_itime;
         dqblk->dqb_valid |= QIF_LIMITS | QIF_TIMES;
-        cfs_up(&dquot->dq_sem);
+        cfs_mutex_unlock(&dquot->dq_mutex);
 
         lustre_dqput(dquot);
         cfs_up_read(&mds->mds_qonoff_sem);
@@ -1624,20 +1626,20 @@ dquot_recovery(struct obd_device *obd, unsigned int id, unsigned short type)
         if (rc)
                 GOTO(skip, rc);
 
-        cfs_down(&dquot->dq_sem);
+        cfs_mutex_lock(&dquot->dq_mutex);
 
         /* don't recover the dquot without limits or quota is setting or
          * another recovery is already going on */
         if (!(dquot->dq_dqb.dqb_bhardlimit || dquot->dq_dqb.dqb_bsoftlimit) ||
             LQS_IS_SETQUOTA(lqs) || LQS_IS_RECOVERY(lqs)) {
-                cfs_up(&dquot->dq_sem);
+                cfs_mutex_unlock(&dquot->dq_mutex);
                 GOTO(skip1, rc = 0);
         }
 
         cfs_spin_lock(&lqs->lqs_lock);
         LQS_SET_RECOVERY(lqs);
         cfs_spin_unlock(&lqs->lqs_lock);
-        cfs_up(&dquot->dq_sem);
+        cfs_mutex_unlock(&dquot->dq_mutex);
 
         /* release mds_qonoff_sem during obd_quotactl ops here */
         cfs_up_write(&mds->mds_qonoff_sem);
@@ -1660,7 +1662,7 @@ dquot_recovery(struct obd_device *obd, unsigned int id, unsigned short type)
         total_limits += qctl->qc_dqblk.dqb_bhardlimit;
 
         /* amend the usage of the administrative quotafile */
-        cfs_down(&dquot->dq_sem);
+        cfs_mutex_lock(&dquot->dq_mutex);
 
         dquot->dq_dqb.dqb_curspace = total_limits << QUOTABLOCK_BITS;
 
@@ -1668,7 +1670,7 @@ dquot_recovery(struct obd_device *obd, unsigned int id, unsigned short type)
         if (rc)
                 CERROR("write dquot failed! (rc:%d)\n", rc);
 
-        cfs_up(&dquot->dq_sem);
+        cfs_mutex_unlock(&dquot->dq_mutex);
         EXIT;
 out:
         cfs_spin_lock(&lqs->lqs_lock);
@@ -1753,15 +1755,15 @@ int mds_quota_recovery(struct obd_device *obd)
         if (unlikely(!mds->mds_quota || obd->obd_stopping))
                 RETURN(rc);
 
-        cfs_mutex_down(&obd->obd_dev_sem);
+        cfs_mutex_lock(&obd->obd_dev_mutex);
         if (mds->mds_lov_desc.ld_active_tgt_count != mds->mds_lov_objid_count) {
                 CWARN("Only %u/%u OSTs are active, abort quota recovery\n",
                       mds->mds_lov_desc.ld_active_tgt_count,
                       mds->mds_lov_objid_count);
-                cfs_mutex_up(&obd->obd_dev_sem);
+                cfs_mutex_unlock(&obd->obd_dev_mutex);
                 RETURN(rc);
         }
-        cfs_mutex_up(&obd->obd_dev_sem);
+        cfs_mutex_unlock(&obd->obd_dev_mutex);
 
         data.obd = obd;
         cfs_init_completion(&data.comp);
