diff options
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index f03d9d5f5ba4..9e2e1c7291db 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -741,10 +741,10 @@ static void nfs4_open_confirm_done(struct rpc_task *task, void *calldata) | |||
741 | if (data->rpc_status == 0) { | 741 | if (data->rpc_status == 0) { |
742 | memcpy(data->o_res.stateid.data, data->c_res.stateid.data, | 742 | memcpy(data->o_res.stateid.data, data->c_res.stateid.data, |
743 | sizeof(data->o_res.stateid.data)); | 743 | sizeof(data->o_res.stateid.data)); |
744 | nfs_confirm_seqid(&data->owner->so_seqid, 0); | ||
744 | renew_lease(data->o_res.server, data->timestamp); | 745 | renew_lease(data->o_res.server, data->timestamp); |
745 | data->rpc_done = 1; | 746 | data->rpc_done = 1; |
746 | } | 747 | } |
747 | nfs_confirm_seqid(&data->owner->so_seqid, data->rpc_status); | ||
748 | nfs_increment_open_seqid(data->rpc_status, data->c_arg.seqid); | 748 | nfs_increment_open_seqid(data->rpc_status, data->c_arg.seqid); |
749 | } | 749 | } |
750 | 750 | ||
@@ -759,7 +759,6 @@ static void nfs4_open_confirm_release(void *calldata) | |||
759 | /* In case of error, no cleanup! */ | 759 | /* In case of error, no cleanup! */ |
760 | if (!data->rpc_done) | 760 | if (!data->rpc_done) |
761 | goto out_free; | 761 | goto out_free; |
762 | nfs_confirm_seqid(&data->owner->so_seqid, 0); | ||
763 | state = nfs4_opendata_to_nfs4_state(data); | 762 | state = nfs4_opendata_to_nfs4_state(data); |
764 | if (!IS_ERR(state)) | 763 | if (!IS_ERR(state)) |
765 | nfs4_close_state(&data->path, state, data->o_arg.open_flags); | 764 | nfs4_close_state(&data->path, state, data->o_arg.open_flags); |
@@ -886,7 +885,6 @@ static void nfs4_open_release(void *calldata) | |||
886 | /* In case we need an open_confirm, no cleanup! */ | 885 | /* In case we need an open_confirm, no cleanup! */ |
887 | if (data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM) | 886 | if (data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM) |
888 | goto out_free; | 887 | goto out_free; |
889 | nfs_confirm_seqid(&data->owner->so_seqid, 0); | ||
890 | state = nfs4_opendata_to_nfs4_state(data); | 888 | state = nfs4_opendata_to_nfs4_state(data); |
891 | if (!IS_ERR(state)) | 889 | if (!IS_ERR(state)) |
892 | nfs4_close_state(&data->path, state, data->o_arg.open_flags); | 890 | nfs4_close_state(&data->path, state, data->o_arg.open_flags); |
@@ -3333,6 +3331,12 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl, | |||
3333 | 3331 | ||
3334 | p->arg.fh = NFS_FH(inode); | 3332 | p->arg.fh = NFS_FH(inode); |
3335 | p->arg.fl = &p->fl; | 3333 | p->arg.fl = &p->fl; |
3334 | if (!(lsp->ls_seqid.flags & NFS_SEQID_CONFIRMED)) { | ||
3335 | p->arg.open_seqid = nfs_alloc_seqid(&lsp->ls_state->owner->so_seqid); | ||
3336 | if (p->arg.open_seqid == NULL) | ||
3337 | goto out_free; | ||
3338 | |||
3339 | } | ||
3336 | p->arg.lock_seqid = nfs_alloc_seqid(&lsp->ls_seqid); | 3340 | p->arg.lock_seqid = nfs_alloc_seqid(&lsp->ls_seqid); |
3337 | if (p->arg.lock_seqid == NULL) | 3341 | if (p->arg.lock_seqid == NULL) |
3338 | goto out_free; | 3342 | goto out_free; |
@@ -3345,6 +3349,8 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl, | |||
3345 | memcpy(&p->fl, fl, sizeof(p->fl)); | 3349 | memcpy(&p->fl, fl, sizeof(p->fl)); |
3346 | return p; | 3350 | return p; |
3347 | out_free: | 3351 | out_free: |
3352 | if (p->arg.open_seqid != NULL) | ||
3353 | nfs_free_seqid(p->arg.open_seqid); | ||
3348 | kfree(p); | 3354 | kfree(p); |
3349 | return NULL; | 3355 | return NULL; |
3350 | } | 3356 | } |
@@ -3361,23 +3367,23 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) | |||
3361 | .rpc_cred = sp->so_cred, | 3367 | .rpc_cred = sp->so_cred, |
3362 | }; | 3368 | }; |
3363 | 3369 | ||
3364 | if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0) | ||
3365 | return; | ||
3366 | dprintk("%s: begin!\n", __FUNCTION__); | 3370 | dprintk("%s: begin!\n", __FUNCTION__); |
3367 | /* Do we need to do an open_to_lock_owner? */ | 3371 | /* Do we need to do an open_to_lock_owner? */ |
3368 | if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) { | 3372 | if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) { |
3369 | data->arg.open_seqid = nfs_alloc_seqid(&sp->so_seqid); | 3373 | if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0) |
3370 | if (data->arg.open_seqid == NULL) { | 3374 | return; |
3371 | data->rpc_status = -ENOMEM; | ||
3372 | task->tk_action = NULL; | ||
3373 | goto out; | ||
3374 | } | ||
3375 | data->arg.open_stateid = &state->stateid; | 3375 | data->arg.open_stateid = &state->stateid; |
3376 | data->arg.new_lock_owner = 1; | 3376 | data->arg.new_lock_owner = 1; |
3377 | /* Retest in case we raced... */ | ||
3378 | if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) | ||
3379 | goto do_rpc; | ||
3377 | } | 3380 | } |
3381 | if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0) | ||
3382 | return; | ||
3383 | data->arg.new_lock_owner = 0; | ||
3384 | do_rpc: | ||
3378 | data->timestamp = jiffies; | 3385 | data->timestamp = jiffies; |
3379 | rpc_call_setup(task, &msg, 0); | 3386 | rpc_call_setup(task, &msg, 0); |
3380 | out: | ||
3381 | dprintk("%s: done!, ret = %d\n", __FUNCTION__, data->rpc_status); | 3387 | dprintk("%s: done!, ret = %d\n", __FUNCTION__, data->rpc_status); |
3382 | } | 3388 | } |
3383 | 3389 | ||
@@ -3413,8 +3419,6 @@ static void nfs4_lock_release(void *calldata) | |||
3413 | struct nfs4_lockdata *data = calldata; | 3419 | struct nfs4_lockdata *data = calldata; |
3414 | 3420 | ||
3415 | dprintk("%s: begin!\n", __FUNCTION__); | 3421 | dprintk("%s: begin!\n", __FUNCTION__); |
3416 | if (data->arg.open_seqid != NULL) | ||
3417 | nfs_free_seqid(data->arg.open_seqid); | ||
3418 | if (data->cancelled != 0) { | 3422 | if (data->cancelled != 0) { |
3419 | struct rpc_task *task; | 3423 | struct rpc_task *task; |
3420 | task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp, | 3424 | task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp, |
@@ -3424,6 +3428,8 @@ static void nfs4_lock_release(void *calldata) | |||
3424 | dprintk("%s: cancelling lock!\n", __FUNCTION__); | 3428 | dprintk("%s: cancelling lock!\n", __FUNCTION__); |
3425 | } else | 3429 | } else |
3426 | nfs_free_seqid(data->arg.lock_seqid); | 3430 | nfs_free_seqid(data->arg.lock_seqid); |
3431 | if (data->arg.open_seqid != NULL) | ||
3432 | nfs_free_seqid(data->arg.open_seqid); | ||
3427 | nfs4_put_lock_state(data->lsp); | 3433 | nfs4_put_lock_state(data->lsp); |
3428 | put_nfs_open_context(data->ctx); | 3434 | put_nfs_open_context(data->ctx); |
3429 | kfree(data); | 3435 | kfree(data); |