*/
 static DEFINE_SPINLOCK(state_lock);
 
+enum nfsd4_st_mutex_lock_subclass {
+       OPEN_STATEID_MUTEX = 0,
+       LOCK_STATEID_MUTEX = 1,
+};
+
 /*
  * A waitqueue for all in-progress 4.0 CLOSE operations that are waiting for
  * the refcount on the open stateid to drop.
 {
        __be32 ret;
 
-       mutex_lock(&stp->st_mutex);
+       mutex_lock_nested(&stp->st_mutex, LOCK_STATEID_MUTEX);
        ret = nfsd4_verify_open_stid(&stp->st_stid);
        if (ret != nfs_ok)
                mutex_unlock(&stp->st_mutex);
        stp = open->op_stp;
        /* We are moving these outside of the spinlocks to avoid the warnings */
        mutex_init(&stp->st_mutex);
-       mutex_lock(&stp->st_mutex);
+       mutex_lock_nested(&stp->st_mutex, OPEN_STATEID_MUTEX);
 
 retry:
        spin_lock(&oo->oo_owner.so_client->cl_lock);
        struct nfs4_ol_stateid *retstp;
 
        mutex_init(&stp->st_mutex);
-       mutex_lock(&stp->st_mutex);
+       mutex_lock_nested(&stp->st_mutex, OPEN_STATEID_MUTEX);
 retry:
        spin_lock(&clp->cl_lock);
        spin_lock(&fp->fi_lock);