blobfs: Add the return value check for calling cache_append_buffer

Reason: We need to detect this issue. Otherwise, it will
cause null pointer issue later

Change-Id: I4d9aec0570e0b46274ebf3b9642b4727049a4a3b
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448594
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Ziye Yang 2019-03-21 21:18:47 +08:00 committed by Changpeng Liu
parent 11b38a585a
commit b151999f06

View File

@ -2142,10 +2142,11 @@ spdk_file_write(struct spdk_file *file, struct spdk_io_channel *_channel,
pthread_spin_lock(&file->lock);
file->open_for_writing = true;
if (file->last == NULL) {
if (file->append_pos % CACHE_BUFFER_SIZE == 0) {
if ((file->last == NULL) && (file->append_pos % CACHE_BUFFER_SIZE == 0)) {
cache_append_buffer(file);
} else {
}
if (file->last == NULL) {
int rc;
file->append_pos += length;
@ -2155,7 +2156,6 @@ spdk_file_write(struct spdk_file *file, struct spdk_io_channel *_channel,
sem_wait(&channel->sem);
return rc;
}
}
blob_size = __file_get_blob_size(file);