Index: linux-3.12.61-rt81/include/linux/spinlock_rt.h
===================================================================
--- linux-3.12.61-rt81.orig/include/linux/spinlock_rt.h
+++ linux-3.12.61-rt81/include/linux/spinlock_rt.h
@@ -28,6 +28,7 @@ extern int __lockfunc rt_spin_trylock_ir
 extern int __lockfunc rt_spin_trylock_bh(spinlock_t *lock);
 extern int __lockfunc rt_spin_trylock(spinlock_t *lock);
 extern int atomic_dec_and_spin_lock(atomic_t *atomic, spinlock_t *lock);
+extern int atomic_dec_and_raw_spin_lock(atomic_t *atomic, raw_spinlock_t *lock);
 
 /*
  * lockdep-less calls, for derived types like rwlock:
@@ -163,4 +164,8 @@ static inline void assert_spin_locked(sp
 #define atomic_dec_and_lock(atomic, lock) \
 	atomic_dec_and_spin_lock(atomic, lock)
 
+#define atomic_dec_and_raw_lock(atomic, lock) \
+	atomic_dec_and_raw_spin_lock(atomic, lock)
+
 #endif
+
Index: linux-3.12.61-rt81/kernel/rtmutex.c
===================================================================
--- linux-3.12.61-rt81.orig/kernel/rtmutex.c
+++ linux-3.12.61-rt81/kernel/rtmutex.c
@@ -1382,6 +1382,21 @@ int atomic_dec_and_spin_lock(atomic_t *a
 }
 EXPORT_SYMBOL(atomic_dec_and_spin_lock);
 
+int atomic_dec_and_raw_spin_lock(atomic_t *atomic, raw_spinlock_t *lock)
+{
+	/* Subtract 1 from counter unless that drops it to 0 (ie. it was 1) */
+	if (atomic_add_unless(atomic, -1, 1))
+		return 0;
+	migrate_disable();
+	raw_spin_lock(lock);
+	if (atomic_dec_and_test(atomic))
+		return 1;
+	raw_spin_unlock(lock);
+	migrate_enable();
+	return 0;
+}
+EXPORT_SYMBOL(atomic_dec_and_raw_spin_lock);
+
 void
 __rt_spin_lock_init(spinlock_t *lock, char *name, struct lock_class_key *key)
 {
Index: linux-3.12.61-rt81/fs/nfs/nfs4state.c
===================================================================
--- linux-3.12.61-rt81.orig/fs/nfs/nfs4state.c
+++ linux-3.12.61-rt81/fs/nfs/nfs4state.c
@@ -159,10 +159,10 @@ static void nfs4_root_machine_cred(struc
 	struct rpc_cred *cred, *new;
 
 	new = rpc_lookup_machine_cred(NULL);
-	spin_lock(&clp->cl_lock);
+	raw_spin_lock(&clp->cl_lock);
 	cred = clp->cl_machine_cred;
 	clp->cl_machine_cred = new;
-	spin_unlock(&clp->cl_lock);
+	raw_spin_unlock(&clp->cl_lock);
 	if (cred != NULL)
 		put_rpccred(cred);
 }
@@ -283,10 +283,10 @@ static int nfs41_setup_state_renewal(str
 	status = nfs4_proc_get_lease_time(clp, &fsinfo);
 	if (status == 0) {
 		/* Update lease time and schedule renewal */
-		spin_lock(&clp->cl_lock);
+		raw_spin_lock(&clp->cl_lock);
 		clp->cl_lease_time = fsinfo.lease_time * HZ;
 		clp->cl_last_renewal = jiffies;
-		spin_unlock(&clp->cl_lock);
+		raw_spin_unlock(&clp->cl_lock);
 
 		nfs4_schedule_state_renewal(clp);
 	}
@@ -363,9 +363,9 @@ struct rpc_cred *nfs4_get_clid_cred(stru
 {
 	struct rpc_cred *cred;
 
-	spin_lock(&clp->cl_lock);
+	raw_spin_lock(&clp->cl_lock);
 	cred = nfs4_get_machine_cred_locked(clp);
-	spin_unlock(&clp->cl_lock);
+	raw_spin_unlock(&clp->cl_lock);
 	return cred;
 }
 
@@ -489,12 +489,12 @@ nfs4_drop_state_owner(struct nfs4_state_
 		struct nfs_server *server = sp->so_server;
 		struct nfs_client *clp = server->nfs_client;
 
-		spin_lock(&clp->cl_lock);
+		raw_spin_lock(&clp->cl_lock);
 		if (!RB_EMPTY_NODE(rb_node)) {
 			rb_erase(rb_node, &server->state_owners);
 			RB_CLEAR_NODE(rb_node);
 		}
-		spin_unlock(&clp->cl_lock);
+		raw_spin_unlock(&clp->cl_lock);
 	}
 }
 
@@ -512,7 +512,7 @@ static void nfs4_gc_state_owners(struct 
 	unsigned long time_min, time_max;
 	LIST_HEAD(doomed);
 
-	spin_lock(&clp->cl_lock);
+	raw_spin_lock(&clp->cl_lock);
 	time_max = jiffies;
 	time_min = (long)time_max - (long)clp->cl_lease_time;
 	list_for_each_entry_safe(sp, tmp, &server->state_owners_lru, so_lru) {
@@ -522,7 +522,7 @@ static void nfs4_gc_state_owners(struct 
 		list_move(&sp->so_lru, &doomed);
 		nfs4_remove_state_owner_locked(sp);
 	}
-	spin_unlock(&clp->cl_lock);
+	raw_spin_unlock(&clp->cl_lock);
 
 	list_for_each_entry_safe(sp, tmp, &doomed, so_lru) {
 		list_del(&sp->so_lru);
@@ -544,9 +544,9 @@ struct nfs4_state_owner *nfs4_get_state_
 	struct nfs_client *clp = server->nfs_client;
 	struct nfs4_state_owner *sp, *new;
 
-	spin_lock(&clp->cl_lock);
+	raw_spin_lock(&clp->cl_lock);
 	sp = nfs4_find_state_owner_locked(server, cred);
-	spin_unlock(&clp->cl_lock);
+	raw_spin_unlock(&clp->cl_lock);
 	if (sp != NULL)
 		goto out;
 	new = nfs4_alloc_state_owner(server, cred, gfp_flags);
@@ -555,9 +555,9 @@ struct nfs4_state_owner *nfs4_get_state_
 	do {
 		if (ida_pre_get(&server->openowner_id, gfp_flags) == 0)
 			break;
-		spin_lock(&clp->cl_lock);
+		raw_spin_lock(&clp->cl_lock);
 		sp = nfs4_insert_state_owner_locked(new);
-		spin_unlock(&clp->cl_lock);
+		raw_spin_unlock(&clp->cl_lock);
 	} while (sp == ERR_PTR(-EAGAIN));
 	if (sp != new)
 		nfs4_free_state_owner(new);
@@ -583,12 +583,12 @@ void nfs4_put_state_owner(struct nfs4_st
 	struct nfs_server *server = sp->so_server;
 	struct nfs_client *clp = server->nfs_client;
 
-	if (!atomic_dec_and_lock(&sp->so_count, &clp->cl_lock))
+	if (!atomic_dec_and_raw_lock(&sp->so_count, &clp->cl_lock))
 		return;
 
 	sp->so_expires = jiffies;
 	list_add_tail(&sp->so_lru, &server->state_owners_lru);
-	spin_unlock(&clp->cl_lock);
+	raw_spin_unlock(&clp->cl_lock);
 }
 
 /**
@@ -604,12 +604,12 @@ void nfs4_purge_state_owners(struct nfs_
 	struct nfs4_state_owner *sp, *tmp;
 	LIST_HEAD(doomed);
 
-	spin_lock(&clp->cl_lock);
+	raw_spin_lock(&clp->cl_lock);
 	list_for_each_entry_safe(sp, tmp, &server->state_owners_lru, so_lru) {
 		list_move(&sp->so_lru, &doomed);
 		nfs4_remove_state_owner_locked(sp);
 	}
-	spin_unlock(&clp->cl_lock);
+	raw_spin_unlock(&clp->cl_lock);
 
 	list_for_each_entry_safe(sp, tmp, &doomed, so_lru) {
 		list_del(&sp->so_lru);
@@ -1513,7 +1513,7 @@ static void nfs4_reset_seqids(struct nfs
 	struct rb_node *pos;
 	struct nfs4_state *state;
 
-	spin_lock(&clp->cl_lock);
+	raw_spin_lock(&clp->cl_lock);
 	for (pos = rb_first(&server->state_owners);
 	     pos != NULL;
 	     pos = rb_next(pos)) {
@@ -1526,7 +1526,7 @@ static void nfs4_reset_seqids(struct nfs
 		}
 		spin_unlock(&sp->so_lock);
 	}
-	spin_unlock(&clp->cl_lock);
+	raw_spin_unlock(&clp->cl_lock);
 }
 
 static void nfs4_state_mark_reclaim_helper(struct nfs_client *clp,
@@ -1563,7 +1563,7 @@ static void nfs4_clear_reclaim_server(st
 	struct rb_node *pos;
 	struct nfs4_state *state;
 
-	spin_lock(&clp->cl_lock);
+	raw_spin_lock(&clp->cl_lock);
 	for (pos = rb_first(&server->state_owners);
 	     pos != NULL;
 	     pos = rb_next(pos)) {
@@ -1577,7 +1577,7 @@ static void nfs4_clear_reclaim_server(st
 		}
 		spin_unlock(&sp->so_lock);
 	}
-	spin_unlock(&clp->cl_lock);
+	raw_spin_unlock(&clp->cl_lock);
 }
 
 static int nfs4_state_clear_reclaim_reboot(struct nfs_client *clp)
@@ -1675,7 +1675,7 @@ restart:
 	rcu_read_lock();
 	list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
 		nfs4_purge_state_owners(server);
-		spin_lock(&clp->cl_lock);
+		raw_spin_lock(&clp->cl_lock);
 		for (pos = rb_first(&server->state_owners);
 		     pos != NULL;
 		     pos = rb_next(pos)) {
@@ -1685,7 +1685,7 @@ restart:
 							&sp->so_flags))
 				continue;
 			atomic_inc(&sp->so_count);
-			spin_unlock(&clp->cl_lock);
+			raw_spin_unlock(&clp->cl_lock);
 			rcu_read_unlock();
 
 			status = nfs4_reclaim_open_state(sp, ops);
@@ -1699,7 +1699,7 @@ restart:
 			nfs4_put_state_owner(sp);
 			goto restart;
 		}
-		spin_unlock(&clp->cl_lock);
+		raw_spin_unlock(&clp->cl_lock);
 	}
 	rcu_read_unlock();
 	return 0;
@@ -1715,9 +1715,9 @@ static int nfs4_check_lease(struct nfs_c
 	/* Is the client already known to have an expired lease? */
 	if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
 		return 0;
-	spin_lock(&clp->cl_lock);
+	raw_spin_lock(&clp->cl_lock);
 	cred = ops->get_state_renewal_cred_locked(clp);
-	spin_unlock(&clp->cl_lock);
+	raw_spin_unlock(&clp->cl_lock);
 	if (cred == NULL) {
 		cred = nfs4_get_clid_cred(clp);
 		status = -ENOKEY;
Index: linux-3.12.61-rt81/include/linux/nfs_fs_sb.h
===================================================================
--- linux-3.12.61-rt81.orig/include/linux/nfs_fs_sb.h
+++ linux-3.12.61-rt81/include/linux/nfs_fs_sb.h
@@ -61,7 +61,7 @@ struct nfs_client {
 	nfs4_verifier		cl_confirm;	/* Clientid verifier */
 	unsigned long		cl_state;
 
-	spinlock_t		cl_lock;
+	raw_spinlock_t		cl_lock;
 
 	unsigned long		cl_lease_time;
 	unsigned long		cl_last_renewal;
Index: linux-3.12.61-rt81/fs/nfs/nfs4client.c
===================================================================
--- linux-3.12.61-rt81.orig/fs/nfs/nfs4client.c
+++ linux-3.12.61-rt81/fs/nfs/nfs4client.c
@@ -75,7 +75,7 @@ nfs4_add_ds_client(struct nfs_client *ds
 {
 	struct nfs4_ds_server *dss;
 
-	spin_lock(&ds_clp->cl_lock);
+	raw_spin_lock(&ds_clp->cl_lock);
 	list_for_each_entry(dss, &ds_clp->cl_ds_clients, list) {
 		if (dss->rpc_clnt->cl_auth->au_flavor != flavor)
 			continue;
@@ -85,7 +85,7 @@ nfs4_add_ds_client(struct nfs_client *ds
 		list_add_rcu(&new->list, &ds_clp->cl_ds_clients);
 	dss = new;
 out:
-	spin_unlock(&ds_clp->cl_lock); /* need some lock to protect list */
+	raw_spin_unlock(&ds_clp->cl_lock); /* need some lock to protect list */
 	return dss;
 }
 
@@ -190,7 +190,7 @@ struct nfs_client *nfs4_alloc_client(con
 		goto error;
 	}
 
-	spin_lock_init(&clp->cl_lock);
+	raw_spin_lock_init(&clp->cl_lock);
 	INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state);
 	INIT_LIST_HEAD(&clp->cl_ds_clients);
 	rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client");
Index: linux-3.12.61-rt81/fs/nfs/nfs4proc.c
===================================================================
--- linux-3.12.61-rt81.orig/fs/nfs/nfs4proc.c
+++ linux-3.12.61-rt81/fs/nfs/nfs4proc.c
@@ -453,10 +453,10 @@ static bool _nfs4_is_integrity_protected
 
 static void do_renew_lease(struct nfs_client *clp, unsigned long timestamp)
 {
-	spin_lock(&clp->cl_lock);
+	raw_spin_lock(&clp->cl_lock);
 	if (time_before(clp->cl_last_renewal,timestamp))
 		clp->cl_last_renewal = timestamp;
-	spin_unlock(&clp->cl_lock);
+	raw_spin_unlock(&clp->cl_lock);
 }
 
 static void renew_lease(const struct nfs_server *server, unsigned long timestamp)
@@ -3909,10 +3909,10 @@ static int nfs4_do_fsinfo(struct nfs_ser
 		if (err == 0) {
 			struct nfs_client *clp = server->nfs_client;
 
-			spin_lock(&clp->cl_lock);
+			raw_spin_lock(&clp->cl_lock);
 			clp->cl_lease_time = fsinfo->lease_time * HZ;
 			clp->cl_last_renewal = now;
-			spin_unlock(&clp->cl_lock);
+			raw_spin_unlock(&clp->cl_lock);
 			break;
 		}
 		err = nfs4_handle_exception(server, err, &exception);
Index: linux-3.12.61-rt81/fs/nfs/nfs4renewd.c
===================================================================
--- linux-3.12.61-rt81.orig/fs/nfs/nfs4renewd.c
+++ linux-3.12.61-rt81/fs/nfs/nfs4renewd.c
@@ -68,7 +68,7 @@ nfs4_renew_state(struct work_struct *wor
 	if (test_bit(NFS_CS_STOP_RENEW, &clp->cl_res_state))
 		goto out;
 
-	spin_lock(&clp->cl_lock);
+	raw_spin_lock(&clp->cl_lock);
 	lease = clp->cl_lease_time;
 	last = clp->cl_last_renewal;
 	now = jiffies;
@@ -80,7 +80,7 @@ nfs4_renew_state(struct work_struct *wor
 
 	if (renew_flags != 0) {
 		cred = ops->get_state_renewal_cred_locked(clp);
-		spin_unlock(&clp->cl_lock);
+		raw_spin_unlock(&clp->cl_lock);
 		if (cred == NULL) {
 			if (!(renew_flags & NFS4_RENEW_DELEGATION_CB)) {
 				set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
@@ -104,7 +104,7 @@ nfs4_renew_state(struct work_struct *wor
 	} else {
 		dprintk("%s: failed to call renewd. Reason: lease not expired \n",
 				__func__);
-		spin_unlock(&clp->cl_lock);
+		raw_spin_unlock(&clp->cl_lock);
 	}
 	nfs4_schedule_state_renewal(clp);
 out_exp:
@@ -118,7 +118,7 @@ nfs4_schedule_state_renewal(struct nfs_c
 {
 	long timeout;
 
-	spin_lock(&clp->cl_lock);
+	raw_spin_lock(&clp->cl_lock);
 	timeout = (2 * clp->cl_lease_time) / 3 + (long)clp->cl_last_renewal
 		- (long)jiffies;
 	if (timeout < 5 * HZ)
@@ -127,7 +127,7 @@ nfs4_schedule_state_renewal(struct nfs_c
 			__func__, (timeout + HZ - 1) / HZ);
 	mod_delayed_work(system_wq, &clp->cl_renewd, timeout);
 	set_bit(NFS_CS_RENEWD, &clp->cl_res_state);
-	spin_unlock(&clp->cl_lock);
+	raw_spin_unlock(&clp->cl_lock);
 }
 
 void
Index: linux-3.12.61-rt81/fs/nfs/delegation.c
===================================================================
--- linux-3.12.61-rt81.orig/fs/nfs/delegation.c
+++ linux-3.12.61-rt81/fs/nfs/delegation.c
@@ -266,9 +266,9 @@ static struct nfs_delegation *nfs_detach
 {
 	struct nfs_client *clp = server->nfs_client;
 
-	spin_lock(&clp->cl_lock);
+	raw_spin_lock(&clp->cl_lock);
 	delegation = nfs_detach_delegation_locked(nfsi, delegation, clp);
-	spin_unlock(&clp->cl_lock);
+	raw_spin_unlock(&clp->cl_lock);
 	return delegation;
 }
 
@@ -314,7 +314,7 @@ int nfs_inode_set_delegation(struct inod
 	delegation->flags = 1<<NFS_DELEGATION_REFERENCED;
 	spin_lock_init(&delegation->lock);
 
-	spin_lock(&clp->cl_lock);
+	raw_spin_lock(&clp->cl_lock);
 	old_delegation = rcu_dereference_protected(nfsi->delegation,
 					lockdep_is_held(&clp->cl_lock));
 	if (old_delegation != NULL) {
@@ -355,7 +355,7 @@ int nfs_inode_set_delegation(struct inod
 	trace_nfs4_set_delegation(inode, res->delegation_type);
 
 out:
-	spin_unlock(&clp->cl_lock);
+	raw_spin_unlock(&clp->cl_lock);
 	if (delegation != NULL)
 		nfs_free_delegation(delegation);
 	if (freeme != NULL)