|
@@ -686,20 +686,24 @@ __be32 nfs4_callback_offload(void *data, void *dummy,
|
|
{
|
|
{
|
|
struct cb_offloadargs *args = data;
|
|
struct cb_offloadargs *args = data;
|
|
struct nfs_server *server;
|
|
struct nfs_server *server;
|
|
- struct nfs4_copy_state *copy;
|
|
|
|
|
|
+ struct nfs4_copy_state *copy, *tmp_copy;
|
|
bool found = false;
|
|
bool found = false;
|
|
|
|
|
|
|
|
+ copy = kzalloc(sizeof(struct nfs4_copy_state), GFP_NOFS);
|
|
|
|
+ if (!copy)
|
|
|
|
+ return htonl(NFS4ERR_SERVERFAULT);
|
|
|
|
+
|
|
spin_lock(&cps->clp->cl_lock);
|
|
spin_lock(&cps->clp->cl_lock);
|
|
rcu_read_lock();
|
|
rcu_read_lock();
|
|
list_for_each_entry_rcu(server, &cps->clp->cl_superblocks,
|
|
list_for_each_entry_rcu(server, &cps->clp->cl_superblocks,
|
|
client_link) {
|
|
client_link) {
|
|
- list_for_each_entry(copy, &server->ss_copies, copies) {
|
|
|
|
|
|
+ list_for_each_entry(tmp_copy, &server->ss_copies, copies) {
|
|
if (memcmp(args->coa_stateid.other,
|
|
if (memcmp(args->coa_stateid.other,
|
|
- copy->stateid.other,
|
|
|
|
|
|
+ tmp_copy->stateid.other,
|
|
sizeof(args->coa_stateid.other)))
|
|
sizeof(args->coa_stateid.other)))
|
|
continue;
|
|
continue;
|
|
- nfs4_copy_cb_args(copy, args);
|
|
|
|
- complete(©->completion);
|
|
|
|
|
|
+ nfs4_copy_cb_args(tmp_copy, args);
|
|
|
|
+ complete(&tmp_copy->completion);
|
|
found = true;
|
|
found = true;
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
@@ -707,15 +711,11 @@ __be32 nfs4_callback_offload(void *data, void *dummy,
|
|
out:
|
|
out:
|
|
rcu_read_unlock();
|
|
rcu_read_unlock();
|
|
if (!found) {
|
|
if (!found) {
|
|
- copy = kzalloc(sizeof(struct nfs4_copy_state), GFP_NOFS);
|
|
|
|
- if (!copy) {
|
|
|
|
- spin_unlock(&cps->clp->cl_lock);
|
|
|
|
- return htonl(NFS4ERR_SERVERFAULT);
|
|
|
|
- }
|
|
|
|
memcpy(©->stateid, &args->coa_stateid, NFS4_STATEID_SIZE);
|
|
memcpy(©->stateid, &args->coa_stateid, NFS4_STATEID_SIZE);
|
|
nfs4_copy_cb_args(copy, args);
|
|
nfs4_copy_cb_args(copy, args);
|
|
list_add_tail(©->copies, &cps->clp->pending_cb_stateids);
|
|
list_add_tail(©->copies, &cps->clp->pending_cb_stateids);
|
|
- }
|
|
|
|
|
|
+ } else
|
|
|
|
+ kfree(copy);
|
|
spin_unlock(&cps->clp->cl_lock);
|
|
spin_unlock(&cps->clp->cl_lock);
|
|
|
|
|
|
return 0;
|
|
return 0;
|