]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/nfs/delegation.c
NFSv4: Implement the fs_locations function call
[linux-2.6-omap-h63xx.git] / fs / nfs / delegation.c
index 75dfb1c717a0dcea68d9ee65e3233a216700a5b4..d3be923d4e437651ae4c6eadade69ec125e71d0e 100644 (file)
@@ -131,6 +131,7 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct
                        sizeof(delegation->stateid.data));
        delegation->type = res->delegation_type;
        delegation->maxsize = res->maxsize;
+       delegation->change_attr = nfsi->change_attr;
        delegation->cred = get_rpccred(cred);
        delegation->inode = inode;
 
@@ -158,8 +159,6 @@ static int nfs_do_return_delegation(struct inode *inode, struct nfs_delegation *
 {
        int res = 0;
 
-       __nfs_revalidate_inode(NFS_SERVER(inode), inode);
-
        res = nfs4_proc_delegreturn(inode, delegation->cred, &delegation->stateid);
        nfs_free_delegation(delegation);
        return res;
@@ -237,7 +236,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:
@@ -251,10 +249,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);
@@ -424,3 +421,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;
+}