return;
} else {
rpc_set_error(nfs->rpc, "RPC error: Failed to send READ call for %s", data->path);
- data->error = 1;
+ data->oom = 1;
}
}
}
mdata = malloc(sizeof(struct nfs_mcb_data));
if (mdata == NULL) {
rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_mcb_data structure");
- if (data->num_calls == 0)
+ if (data->num_calls == 0) {
free_nfs_cb_data(data);
- return -1;
+ return -1;
+ }
+ data->oom = 1;
}
memset(mdata, 0, sizeof(struct nfs_mcb_data));
mdata->data = data;
if (rpc_nfs3_read_async(nfs->rpc, nfs_pread_mcb, &args, mdata) != 0) {
rpc_set_error(nfs->rpc, "RPC error: Failed to send READ call for %s", data->path);
- data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
free(mdata);
- if (data->num_calls == 0)
+ if (data->num_calls == 0) {
free_nfs_cb_data(data);
- return -1;
+ return -1;
+ }
+ data->oom = 1;
}
count -= readcount;
return;
} else {
rpc_set_error(nfs->rpc, "RPC error: Failed to send WRITE call for %s", data->path);
- data->error = 1;
+ data->oom = 1;
}
}
}
/* still waiting for more replies */
return;
}
-
+ if (data->oom != 0) {
+ data->cb(-ENOMEM, nfs, command_data, data->private_data);
+ free_nfs_cb_data(data);
+ return;
+ }
if (data->error != 0) {
data->cb(-EFAULT, nfs, command_data, data->private_data);
free_nfs_cb_data(data);
mdata = malloc(sizeof(struct nfs_mcb_data));
if (mdata == NULL) {
rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_mcb_data structure");
- if (data->num_calls == 0)
+ if (data->num_calls == 0) {
free_nfs_cb_data(data);
- return -1;
+ return -1;
+ }
+ data->oom = 1;
}
memset(mdata, 0, sizeof(struct nfs_mcb_data));
mdata->data = data;
if (rpc_nfs3_write_async(nfs->rpc, nfs_pwrite_mcb, &args, mdata) != 0) {
rpc_set_error(nfs->rpc, "RPC error: Failed to send WRITE call for %s", data->path);
- data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
free(mdata);
- if (data->num_calls == 0)
+ if (data->num_calls == 0) {
free_nfs_cb_data(data);
-
- return -1;
+ return -1;
+ }
+ data->oom = 1;
}
count -= writecount;