]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/nfs/delegation.c
Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for...
[linux-2.6-omap-h63xx.git] / fs / nfs / delegation.c
index 66cc720e39277b7d6f9f6b9d0a8cf34538d24c51..9540a316c05e6e103a64cffd3dad567a170fbddb 100644 (file)
@@ -6,7 +6,6 @@
  * NFS file delegation management
  *
  */
-#include <linux/config.h>
 #include <linux/completion.h>
 #include <linux/kthread.h>
 #include <linux/module.h>
@@ -236,7 +235,6 @@ int nfs_do_expire_all_delegations(void *ptr)
        struct nfs4_client *clp = ptr;
        struct nfs_delegation *delegation;
        struct inode *inode;
-       int err = 0;
 
        allow_signal(SIGKILL);
 restart:
@@ -250,10 +248,9 @@ restart:
                if (inode == NULL)
                        continue;
                spin_unlock(&clp->cl_lock);
-               err = nfs_inode_return_delegation(inode);
+               nfs_inode_return_delegation(inode);
                iput(inode);
-               if (!err)
-                       goto restart;
+               goto restart;
        }
 out:
        spin_unlock(&clp->cl_lock);
@@ -423,3 +420,22 @@ void nfs_delegation_reap_unclaimed(struct nfs4_client *clp)
                nfs_free_delegation(delegation);
        }
 }
+
+int nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode)
+{
+       struct nfs4_client *clp = NFS_SERVER(inode)->nfs4_state;
+       struct nfs_inode *nfsi = NFS_I(inode);
+       struct nfs_delegation *delegation;
+       int res = 0;
+
+       if (nfsi->delegation_state == 0)
+               return 0;
+       spin_lock(&clp->cl_lock);
+       delegation = nfsi->delegation;
+       if (delegation != NULL) {
+               memcpy(dst->data, delegation->stateid.data, sizeof(dst->data));
+               res = 1;
+       }
+       spin_unlock(&clp->cl_lock);
+       return res;
+}