Linux 3.2.88
[pandora-kernel.git] / fs / nfs / delegation.c
index 7f26540..92cf07d 100644 (file)
@@ -149,8 +149,8 @@ void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred,
                                  &delegation->flags);
                        NFS_I(inode)->delegation_state = delegation->type;
                        spin_unlock(&delegation->lock);
-                       put_rpccred(oldcred);
                        rcu_read_unlock();
+                       put_rpccred(oldcred);
                } else {
                        /* We appear to have raced with a delegation return. */
                        spin_unlock(&delegation->lock);
@@ -466,6 +466,17 @@ static void nfs_delegation_run_state_manager(struct nfs_client *clp)
                nfs4_schedule_state_manager(clp);
 }
 
+void nfs_remove_bad_delegation(struct inode *inode)
+{
+       struct nfs_delegation *delegation;
+
+       delegation = nfs_detach_delegation(NFS_I(inode), NFS_SERVER(inode));
+       if (delegation) {
+               nfs_inode_find_state_and_recover(inode, &delegation->stateid);
+               nfs_free_delegation(delegation);
+       }
+}
+
 /**
  * nfs_expire_all_delegation_types
  * @clp: client to process