diff options
Diffstat (limited to 'fs/nfs/callback_proc.c')
-rw-r--r-- | fs/nfs/callback_proc.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index 7b861bbc0b43..315967354954 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c | |||
@@ -686,20 +686,24 @@ __be32 nfs4_callback_offload(void *data, void *dummy, | |||
686 | { | 686 | { |
687 | struct cb_offloadargs *args = data; | 687 | struct cb_offloadargs *args = data; |
688 | struct nfs_server *server; | 688 | struct nfs_server *server; |
689 | struct nfs4_copy_state *copy; | 689 | struct nfs4_copy_state *copy, *tmp_copy; |
690 | bool found = false; | 690 | bool found = false; |
691 | 691 | ||
692 | copy = kzalloc(sizeof(struct nfs4_copy_state), GFP_NOFS); | ||
693 | if (!copy) | ||
694 | return htonl(NFS4ERR_SERVERFAULT); | ||
695 | |||
692 | spin_lock(&cps->clp->cl_lock); | 696 | spin_lock(&cps->clp->cl_lock); |
693 | rcu_read_lock(); | 697 | rcu_read_lock(); |
694 | list_for_each_entry_rcu(server, &cps->clp->cl_superblocks, | 698 | list_for_each_entry_rcu(server, &cps->clp->cl_superblocks, |
695 | client_link) { | 699 | client_link) { |
696 | list_for_each_entry(copy, &server->ss_copies, copies) { | 700 | list_for_each_entry(tmp_copy, &server->ss_copies, copies) { |
697 | if (memcmp(args->coa_stateid.other, | 701 | if (memcmp(args->coa_stateid.other, |
698 | copy->stateid.other, | 702 | tmp_copy->stateid.other, |
699 | sizeof(args->coa_stateid.other))) | 703 | sizeof(args->coa_stateid.other))) |
700 | continue; | 704 | continue; |
701 | nfs4_copy_cb_args(copy, args); | 705 | nfs4_copy_cb_args(tmp_copy, args); |
702 | complete(©->completion); | 706 | complete(&tmp_copy->completion); |
703 | found = true; | 707 | found = true; |
704 | goto out; | 708 | goto out; |
705 | } | 709 | } |
@@ -707,15 +711,11 @@ __be32 nfs4_callback_offload(void *data, void *dummy, | |||
707 | out: | 711 | out: |
708 | rcu_read_unlock(); | 712 | rcu_read_unlock(); |
709 | if (!found) { | 713 | if (!found) { |
710 | copy = kzalloc(sizeof(struct nfs4_copy_state), GFP_NOFS); | ||
711 | if (!copy) { | ||
712 | spin_unlock(&cps->clp->cl_lock); | ||
713 | return htonl(NFS4ERR_SERVERFAULT); | ||
714 | } | ||
715 | memcpy(©->stateid, &args->coa_stateid, NFS4_STATEID_SIZE); | 714 | memcpy(©->stateid, &args->coa_stateid, NFS4_STATEID_SIZE); |
716 | nfs4_copy_cb_args(copy, args); | 715 | nfs4_copy_cb_args(copy, args); |
717 | list_add_tail(©->copies, &cps->clp->pending_cb_stateids); | 716 | list_add_tail(©->copies, &cps->clp->pending_cb_stateids); |
718 | } | 717 | } else |
718 | kfree(copy); | ||
719 | spin_unlock(&cps->clp->cl_lock); | 719 | spin_unlock(&cps->clp->cl_lock); |
720 | 720 | ||
721 | return 0; | 721 | return 0; |