blobfs: add the check for buf allocation
If it fails to allocate the buf, we should conduct the error handling. Change-Id: If36b2dd84236052c777f5007ecbf7295e1c1d3eb Signed-off-by: Ziye Yang <optimistyzy@gmail.com> Reviewed-on: https://review.gerrithub.io/420334 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
f6c5e40aed
commit
e152aa8e51
@ -1608,6 +1608,13 @@ __readwrite(struct spdk_file *file, struct spdk_io_channel *_channel,
|
||||
__get_page_parameters(file, offset, length, &start_page, &page_size, &num_pages);
|
||||
pin_buf_length = num_pages * page_size;
|
||||
args->op.rw.pin_buf = spdk_dma_malloc(pin_buf_length, 4096, NULL);
|
||||
if (args->op.rw.pin_buf == NULL) {
|
||||
SPDK_DEBUGLOG(SPDK_LOG_BLOBFS, "Failed to allocate buf for: file=%s offset=%jx length=%jx\n",
|
||||
file->name, offset, length);
|
||||
free_fs_request(req);
|
||||
cb_fn(cb_arg, -ENOMEM);
|
||||
return;
|
||||
}
|
||||
|
||||
args->op.rw.start_page = start_page;
|
||||
args->op.rw.num_pages = num_pages;
|
||||
|
Loading…
Reference in New Issue
Block a user