NFSv4: Support recalling delegations by stateid part 2
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 6 Jul 2007 19:10:43 +0000 (15:10 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 11 Jul 2007 03:40:41 +0000 (23:40 -0400)
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/delegation.c
fs/nfs/delegation.h
fs/nfs/nfs4proc.c

index cee2ba42b68ddc719bd56ddf5cf77c9fbd387b92..93a9f4bd9bd0cd8276ccbecb76a7637d8d61fc98 100644 (file)
@@ -76,7 +76,7 @@ again:
                        continue;
                get_nfs_open_context(ctx);
                spin_unlock(&inode->i_lock);
-               err = nfs4_open_delegation_recall(ctx, state);
+               err = nfs4_open_delegation_recall(ctx, state, stateid);
                if (err >= 0)
                        err = nfs_delegation_claim_locks(ctx, state);
                put_nfs_open_context(ctx);
index 7b22f1742445744f8cddf755d58da81eccb854cb..8f79a3135167477b0fa111f0ad94cee912897512 100644 (file)
@@ -39,7 +39,7 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp);
 
 /* NFSv4 delegation-related procedures */
 int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4_stateid *stateid);
-int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state);
+int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid);
 int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl);
 int nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode);
 
index 03b60c67ca7cb25e66f3c50a75de371378c1188b..10946415de773b7f31d9e582384121b7ddd012d6 100644 (file)
@@ -510,32 +510,30 @@ static int nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *sta
        return ret;
 }
 
-static int _nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state)
+static int _nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid)
 {
        struct nfs4_state_owner  *sp  = state->owner;
        struct nfs4_opendata *opendata;
        int ret;
 
-       if (!test_bit(NFS_DELEGATED_STATE, &state->flags))
-               return 0;
        opendata = nfs4_opendata_alloc(&ctx->path, sp, 0, NULL);
        if (opendata == NULL)
                return -ENOMEM;
        opendata->o_arg.claim = NFS4_OPEN_CLAIM_DELEGATE_CUR;
-       memcpy(opendata->o_arg.u.delegation.data, state->stateid.data,
+       memcpy(opendata->o_arg.u.delegation.data, stateid->data,
                        sizeof(opendata->o_arg.u.delegation.data));
        ret = nfs4_open_recover(opendata, state);
        nfs4_opendata_put(opendata);
        return ret;
 }
 
-int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state)
+int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid)
 {
        struct nfs4_exception exception = { };
        struct nfs_server *server = NFS_SERVER(state->inode);
        int err;
        do {
-               err = _nfs4_open_delegation_recall(ctx, state);
+               err = _nfs4_open_delegation_recall(ctx, state, stateid);
                switch (err) {
                        case 0:
                                return err;